javascript - Can Sequelize.js for Node.js define a table where the Primary Key is not named 'id'? -
i have simple mysql table named things. things table has 3 columns:
column name data type =========== ============ thing_id int // auto increment primary key thing_name varchar(255) thing_size int as far can tell sequelize.js expects/requires primary key named 'id'.
is there way use standard sequelize.define() call define things table? if not, there way?
try
var test = sequelize.define( 'things', { thing_id : {type: sequelize.integer(11), primarykey: true, autoincrement: true}, thing_name : {type: sequelize.string(255)}, thing_size : {type: sequelize.integer} },{ }); test.sync() .success(function(){ console.log('table created'); }) .error(function(error){ console.log('failed', error) })
Comments
Post a Comment