问题描述
假设我的 ES6 JavaScript 项目使用 Sequelize,我有三个不同的模型文件。
我的 sequelize.rc
配置文件配置良好,但是当我想使用 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 .
'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');
*/
}
};
那么如何让它根据我的模型生成一致的迁移文件? 有没有办法像 TypeORM 那样自动化?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)