【发布时间】:2017-08-20 18:26:28
【问题描述】:
我通读了documentation for Sequelize 并了解了如何使用define,但我看不到如何从Sequelize 定义中读取type/allowNull/primaryKey/autoIncrement 属性。这是我由sequelize-auto生成的文件的一部分;
/* jshint indent: 2 */
module.exports = function(sequelize, DataTypes) {
return sequelize.define('account', {
id: {
type: DataTypes.BIGINT,
allowNull: false,
primaryKey: true,
autoIncrement: true
},
parent_account_id: {
type: DataTypes.BIGINT,
allowNull: false,
references: {
model: 'account',
key: 'id'
}
},
master_account_id: {
type: DataTypes.BIGINT,
allowNull: false,
references: {
model: 'account',
key: 'id'
}
},
name: {
type: DataTypes.STRING,
allowNull: false
},
// ...
【问题讨论】:
标签: javascript node.js sequelize.js