1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

sequelize-cliのmigrationディレクトリを変更したい

Last updated at Posted at 2021-04-18

毎回忘れるので書いておく。

まとめ

$ npx sequelize migration:generate \
  --config db/config.js \
  --migrations-path db/migrations \
  --seeders-path db/seeders \
  --name user

または、.sequelizercに書き出す。

.sequelizerc
module.exports = {
  'config': 'db/config.js',
  'migrations-path': 'db/migrations',
  'seeders-path': 'db/seeders',
}

バージョン

調べるとき

ヘルプに書いてある。

$ npx sequelize-cli  migration:generate --help

Sequelize CLI [Node: 15.11.0, CLI: 6.2.0, ORM: 6.6.2]

オプション:
  --version          バージョンを表示                                                                                                                                [真偽]
  --help             ヘルプを表示                                                                                                                                    [真偽]
  --env              The environment to run the command in                                                                             [文字列] [デフォルト: "development"]
  --config           The path to the config file                                                                                                                   [文字列]
  --options-path     The path to a JSON file with additional options                                                                                               [文字列]
  --migrations-path  The path to the migrations folder                                                                                  [文字列] [デフォルト: "migrations"]
  --seeders-path     The path to the seeders folder                                                                                        [文字列] [デフォルト: "seeders"]
  --models-path      The path to the models folder                                                                                          [文字列] [デフォルト: "models"]
  --url              The database connection string to use. Alternative to using --config files                                                                    [文字列]
  --debug            When available show various debug information                                                                               [真偽] [デフォルト: false]
  --name             Defines the name of the migration                                                                                                      [文字列] [必須]
  --underscored      Use snake case for the timestamp's attribute names                                                                          [真偽] [デフォルト: false]
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?