I'm currently working on a completely new project with sailsJs, using waterline on a mysql adapter/connection.
For now, all I have are 2 tables/models. One is User, which seems to work as expected. Any changes I make to this model are applied to the mysql instance when I 'sails lift'
.
However, the other model/table is Company, which other than first time creation of the table after I generated the model, seems to be ignored completely when I 'sails lift'
.
Obviously, I can make the changes as I wish on the instance and not rely on sails/waterline, but it's driving me nuts anyway.
Here is the model being ignored:
module.exports = {
tableName: 'Companies',
attributes: {
name: {
type: 'string',
required: true,
minLength: 2,
notNull: true,
maxLength: 50
},
description: {
type: 'string',
minLength: 2,
maxLength: 1024,
notNull: true,
defaultsTo: ''
},
industry: {
type: 'string',
required: true,
defaultsTo: 'generic'
},
employeeCount: {
type: 'integer',
required: true,
min: 1,
defaultsTo: 1
},
createdBy: {
type: 'integer',
required: true
},
//address fields
country: {
type: 'string',
required: true
},
city: {
type: 'string',
required: true
},
street: {
type: 'string',
required: true
},
areaCode: {
type: 'string',
required: true
},
phone: {
type: 'string',
required: true
}
},
beforeCreate: function(company, cb){
//do something
}
};
EDIT: This is only a problem after the table has been already created. When I dropped the table and restarted sails, the table was once again created with all of my changes, but after changing the model again, it does not apply them to the table. I'm guessing it's a waterline bug that still needs to be fixed, but I'm still wondering why it ignores one model but is perfectly fine with the other.