Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to locate the sequelize migration file?

There are a lot of posts on sequelize migration file access through the sequilize-cli file structure. However, if I am not using the sequilize-cli, how does one locate the migration file?

like image 705
Val Avatar asked Feb 28 '17 04:02

Val


1 Answers

Well, in order to work with migrations and run them, you will need to use sequelize-cli, you can run the command sequelize init which will initialize the folders/files needed to work with the cli.

However, you can ignore that step by using your own structure and creating a file named .sequelizerc where you will place your migrations/seeds, for example mine looks like the folowing:

const path = require('path')

module.exports = {
  'config': path.resolve('config', 'db.json'),
  'migrations-path': path.resolve('db', 'migrate'),
  'seeders-path': path.resolve('db', 'seeders')
}

So if I run sequelize db:migrate the cli will automatically look for the migrations in the db/migrate folder

like image 185
Omar Vazquez Avatar answered Nov 14 '22 23:11

Omar Vazquez