blacksmith migrations rollback
This command roll backs previously run migrations by executing their down
logic.
Example:
$ blacksmith migrations rollback \
--integration warehouse \
--version 20210422135835
2 migrations to roll back for warehouse:
- 20210422140548.fix_userid_pk.down.sql (applied)
- 20210422135835.init.down.sql (applied)
Blacksmith will roll back the migrations as shown above. Do you confirm?
Only 'yes' will be accepted to confirm.
> yes
Executing migrations:
-> Executing 20210422140548.fix_userid_pk.down.sql...
Success!
-> Executing 20210422135835.init.down.sql...
Success!
Required flags
-
--integration [integration]
: Integration to rollback the migrations for. In the following example, the migrations previously run for the integrationwarehouse
will be rollbacked, until the version20210422135835
is reached (including).Aliases:
-i [integration]
Example:
$ blacksmith migrations rollback \ --integration warehouse \ --version 20210422135835
-
--version [time]
: Time representation down to which the migrations shall be rollbacked. In the following example, every migrations previously run down to the version20210422135835
will be rollbacked, ordered by version from newest to oldest.Aliases:
-v [time]
Example:
$ blacksmith migrations rollback \ --integration warehouse \ --version 20210422135835
Optional flags
-
--discard
: Mark the migrations down to the specified version asdiscarded
. Whereas a rollbacked migration can run again when therun
command is executed, a discarded migration will not. In the following example, every migrations down to the version20210422135835
will be discarded, meaning theirup
logic can not be executed again.Aliases:
-d
Example:
$ blacksmith migrations rollback \ --integration warehouse \ --version 20210422135835 \ --discard
-
--auto-approve
: Skip interactive approval before rolling back migration(s). This option is useful for rolling back migrations in a non-interactive environment, such as inside a CI / CD platform.Example:
$ blacksmith migrations rollback \ --integration warehouse \ --version 20210422135835 \ --auto-approve
If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the repository. Once we merge it, the changes will be reflected on the website the next time it is deployed.
Thank you for your contributions!