Configuration Reference
Emigrate can be configured using a configuration file, and it uses Cosmiconfig under the hood so you can use a variety of formats and locations for your configuration file.
Configure Emigrate
You can specify the following options:
directory
type: string
Set the directory where your migrations are located, relative to the project root. This option is required by all Emigrate commands.
reporter
type: "pretty" | "json" | string | EmigrateReporter | Promise<EmigrateReporter> | (() => Promise<EmigrateReporter>)
default: "pretty"
- the default reporter
Set the reporter to use for the different commands. Specifying a reporter is most useful in a CI or production environment where you either ship logs or want to have a machine-readable format.
If you want to use different reporters for different commands, you can use an object:
color
type: boolean | undefined
default: undefined
Set whether to force colors in the output or not. This option is passed to the reporter which should respect it.
storage
type: string | EmigrateStorage | Promise<EmigrateStorage> | (() => Promise<EmigrateStorage>)
Set the storage plugin to use for storing and reading the migration history. This option is required by all Emigrate commands except new
which doesn’t use it.
plugins
type: Array<string | EmigratePlugin | Promise<EmigratePlugin> | (() => Promise<EmigratePlugin>)>
Set the plugins to use for the different commands. There are different types of plugins, and some are only useful for specific commands.
In short:
- Loader Plugins - are used for transforming non-JavaScript files into JavaScript files that can be executed by Node.js. These are only used by the
up
command. - Generator Plugins - are used for generating new migration files. These are only used by the
new
command.
template
type: string
Set the path to a template file to use when creating new migrations. This option is only used by the new
command.
The migration file will use the template file’s extension, unless the extension option is set.
extension
type: string
Set the extension to use for new migrations. This option is only used by the new
command.
Will create new migration files with the .ts
extension.
abortRespite
type: number
default: 10
Customize the number of seconds to wait before abandoning a running migration when the process is about to shutdown, for instance when the user presses Ctrl+C
or when the container is being stopped (if running inside a container).