migrate down 1 # run one down migrationmigrate down # run *all* down migrations
Running a down migration is generally a destructive act, making it dangerous. For instance, in the simple migration pair:
-- 1_add_foo.up.sql
ALTER TABLE my_table ADD COLUMN foo int;
-- 1_add_foo.down.sql
ALTER TABLE my_table DROP COLUMN foo int;
the down migration will drop any data in column foo.
Since down migrations typically drop data, having down run all down migrations by default is dangerous--the default of down is to drop your database, which is almost never what you want. It would be preferable imo to make down require an argument, which would eliminate this class of error.
I can work around this by implementing my own CLI off of the lib, but I'd much prefer to use yours :)
Hello,
The current behavior of down is as follows:
migrate down 1 # run one down migration
migrate down # run *all* down migrations
Running a down migration is generally a destructive act, making it dangerous. For instance, in the simple migration pair:
the down migration will drop any data in column
foo
.Since down migrations typically drop data, having
down
run all down migrations by default is dangerous--the default ofdown
is to drop your database, which is almost never what you want. It would be preferable imo to makedown
require an argument, which would eliminate this class of error.I can work around this by implementing my own CLI off of the lib, but I'd much prefer to use yours :)
Thanks for all the work on this!
Andrew