Reputation: 81
I'm creating a Node apps with sequelize mysql
To create table I usually using command with
npx sequelize-cli model:generate --name ...... etc.
It turns out my migration file become so many, and I want to put it in folder something goes like version of the update.
migration.version_0.1
-->20221221133159-create_database_sec_user
-->20221221133162-create_database_sec_agen
migration.version_0.2
-->20221221133170-create_database_sec_application
-->20221221133172-sec_user_add_new_column
How can I do that? I just want to simplify my migration folder so it doesn't contain too many files in one folder.
Do I need to rebuild the migration?
Upvotes: 0
Views: 1328
Reputation: 9
Create The subfolders version1 and version2 in your migrations file.
After adding the different sub-folders in your migrations folder. EDIT the .sequelizerc file and add the different paths to the sub-folders in the migrations file.
const path = require('path');
module.exports = {
config: path.resolve('./src/database/config', 'config.js'),
'models-path': path.resolve('./src/database/models'),
'seeders-path': path.resolve('./src/database/seeds'),
// 'migrations-path': path.resolve('./src/database/migrations'),
// 'migrations-path': path.resolve('./src/database/migrations/version1'),
'migrations-path': path.resolve('./src/database/migrations/version2'),
};
Upvotes: 0