lucid icon indicating copy to clipboard operation
lucid copied to clipboard

feat: add a "dontDrop" property in shared config to define tables not to be dropped

Open Julien-R44 opened this issue 3 years ago • 3 comments

Fix #820

Hey 👋

So I just added a dontDrop property in the SharedConfigNode interface, which allows users to give a list of table names not to be dropped when the dropAllTables function is called. As a reminder, this function is also called when doing a db:wipe, or a db:fresh

When used on Postgres and Redshift, the default value of dontDrop is spatial_ref_sys, which is the table created and used by the commonly used PostGIS extension

I added this feature on Redshift, Mysql, and Postgres

Julien-R44 avatar May 27 '22 14:05 Julien-R44

Oh, also, I was wondering if there was any particular reason why the drop-tables.spec.ts test file was ignored?

https://github.com/adonisjs/lucid/blob/27381c4dabf797164359ed6bdfe17d54fdb2f086/bin/test.ts#L24

Julien-R44 avatar May 27 '22 14:05 Julien-R44

Ahh sorry for sitting on it for that long.

For some reasons keeping a command specific config within the database connection config seems bit off to me.

I like how rails do it. ActiveRecord::SchemaDumper.ignore_tables.

Can we introduce another property called wipe within the config object. Something like the following.

{
  wipe: {
    ignoreTables: ['']
  }
}

Also, I remember correctly the internal classes of migration and seeder do not read config from the user config, its the commands that reads that config and passes a subset of it to the internal classes.

thetutlage avatar Jun 10 '22 04:06 thetutlage

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 11 '22 20:08 stale[bot]

After discussing it, we just need to make it works with Sqlite and Mssql I'm gonna try to look at this quickly

Julien-R44 avatar Sep 09 '22 07:09 Julien-R44

I screwed up with git 😅 I'll open a new PR

Julien-R44 avatar Sep 17 '22 15:09 Julien-R44