如何从 sequelizejs 模型定义创建数据库 table?
How to create database table from sequelizejs model definition?
我的 nodejs 项目用 sequelizejs
定义了几个模型。这是 event.js
中的事件模型示例:
const Event = db.define('event', {
id: {type: Sql.INTEGER,
primaryKey:true,
min: 1},
name: {type: Sql.STRING,
min:2,
allowNull: false,
},
event_info: {type: Sql.JSON},
current_step: {type: Sql.STRING},
customer_id: {type: Sql.INTEGER},
access_list: {type: Sql.JSON},
event_snapshot: {type: Sql.JSON},
event_category_id: {type: Sql.INTEGER,
},
status: {type: Sql.STRING,
isIn: ['active', 'cancelled', 'aborted', 'completed']},
last_updated_by_id: {type: Sql.INTEGER},
createdAt: Sql.DATE,
updatedAt: Sql.DATE
});
有没有办法在命令行中从 event.js
创建 event
table?
我的 nodejs 项目用 sequelizejs
定义了几个模型。这是 event.js
中的事件模型示例:
const Event = db.define('event', {
id: {type: Sql.INTEGER,
primaryKey:true,
min: 1},
name: {type: Sql.STRING,
min:2,
allowNull: false,
},
event_info: {type: Sql.JSON},
current_step: {type: Sql.STRING},
customer_id: {type: Sql.INTEGER},
access_list: {type: Sql.JSON},
event_snapshot: {type: Sql.JSON},
event_category_id: {type: Sql.INTEGER,
},
status: {type: Sql.STRING,
isIn: ['active', 'cancelled', 'aborted', 'completed']},
last_updated_by_id: {type: Sql.INTEGER},
createdAt: Sql.DATE,
updatedAt: Sql.DATE
});
有没有办法在命令行中从 event.js
创建 event
table?