emigrate remove
The remove
command is used to remove a migration from the history. This is useful if you want to retry a migration that has failed.
Usage
Arguments
<name/path>
The name of the migration file to remove, including the extension, e.g. 20200101000000_some_migration.js
, or a relative file path to a migration file to remove, e.g: migrations/20200101000000_some_migration.js
.
Using relative file paths is useful in terminals that support autocomplete, and also when you copy and use the relative migration file path from the output of the list
command.
Options
-h
, --help
Show command help and exit
-d
, --directory <path>
The directory where the migration files are located. The given path should be absolute or relative to the current working directory.
-f
, --force
Force removal of the migration history entry even if the migration file does not exist or it’s in a non-failed state.
-i
, --import <module>
A module to import before remove the migration. This option can be specified multiple times.
Can for instance be used to load environment variables using dotenv with --import dotenv/config
.
-s
, --storage <name>
The storage plugin to use, which is responsible for where to store the migration history.
The name can be either a path to a module or a package name. For package names Emigrate will automatically prefix the given name with these prefixes in order:
@emigrate/storage-
emigrate-storage-
@emigrate/plugin-storage-
@emigrate/
And then try to load the module/package with the given name.
For example, if you want to use the emigrate-storage-somedb
package, you can specify either emigrate-storage-somedb
or just somedb
as the name.
In case you have both a emigrate-storage-somedb
and a somedb
package installed, the emigrate-storage-somedb
package will be used.
-r
, --reporter <name>
type: "pretty" | "json" | string
default: "pretty"
The reporter to use for listing the migrations.
The name can be either a path to a module or a package name. For package names Emigrate will automatically prefix the given name with these prefixes in order:
@emigrate/reporter-
emigrate-reporter-
@emigrate/
And then try to load the module/package with the given name.
For example, if you want to use the emigrate-reporter-somereporter
package, you can specify either emigrate-reporter-somereporter
or just somereporter
as the name.
--color
, --no-color
Force enable/disable colored output, option is passed to the reporter which should respect it.