mysql - Set column order in sequelize.js -


i put user_id column before timestamps, how can tell sequelize.define?

sequelize.define('userpassport', {     method: datatype.string,     token:  datatype.string,     social_id: datatype.string   }, {     classmethods: {       associate: function(models) {         userpassport.belongsto(models.user);       }     },     tablename:   'user_passports',     underscored: true   }); 

schema of table:

create table `user_passports` (       `id` int(11) not null auto_increment,       `method` varchar(255) default null,       `token` varchar(255) default null,       `social_id` varchar(255) default null,       `created_at` datetime not null,       `updated_at` datetime not null,       `user_id` int(11) default null,       primary key (`id`),       key `user_id` (`user_id`),       constraint `user_passports_ibfk_1` foreign key (`user_id`) references `users` (`id`) on delete set null on update cascade     ) engine=innodb auto_increment=3 default charset=utf8; 

p.s: possible make composite key out of method , social_id both compose pk instead of id field.

all need add in define stage wherever want, so:

var user_passport = sequelize.define('user_passport', {     method: datatypes.string,     token: datatypes.string,     social_id: datatypes.string,     user_id: datatypes.integer }, {     classmethods: {         associate: function(models) {             user_passport.belongsto(models.user, { foreignkey: 'user_id' });         }     },     tablename: 'user_passports',     underscored: true }); 

and in associate attach reference field:

user_passport.belongsto(models.settings, { foreignkey: 'user_id' }); 

Comments