bdurand / capture_migration_sql

Capture SQL generated by ActiveRecord migrations.
MIT License
15 stars 3 forks source link

Make the "don't overwrite" feature optional #5

Open opensourceame opened 2 years ago

opensourceame commented 2 years ago

The new feature that does not overwrite SQL files if they exist is counterintuitive.

Imagine you create a migration that adds a string column to a table. You run the migration. Then you realise that you should have added a limit to the string size. So you adjust the migration file, reload the original schema, and then run the migration again. Now your SQL files don't have the correct SQL to be executed, and if that SQL is now run on production (by the dev, or a DBA who takes over from the dev) it will perform the wrong actions.

At the very least I think there should be a warning that SQL files are not going to be written. Even better would be a prompt asking the dev whether they want to update the SQL files.