Assuming my ES6 JavaScript project with Sequelize, I have three different model files.
My sequelize.rc
config file is well configured, but when I want to generate the very first migration files for my brand new models with migration:generate
:
node-user@778125a03bb5:/usr/app$ ./node_modules/.bin/sequelize migration:generate --name init
Sequelize CLI [Node: 14.17.1, CLI: 6.2.0, ORM: 6.6.2]
Successfully created migrations folder at "/usr/app/src/database/migrations".
New migration was created at /usr/app/src/database/migrations/20210624144147-init.js .
The migration file the command generates is empty (it only has a squeleton):
'use strict';
module.exports = {
up: async (queryInterface, Sequelize) => {
/**
* Add altering commands here.
*
* Example:
* await queryInterface.createTable('users', { id: Sequelize.INTEGER });
*/
},
down: async (queryInterface, Sequelize) => {
/**
* Add reverting commands here.
*
* Example:
* await queryInterface.dropTable('users');
*/
}
};
So how can I make it generating consistent migration files according to my models? Is there any way to automate that, like TypeORM does?