Open vladuva opened 9 years ago
Thanks for the feedback,
This hook uses the alias to match the association, you should specify the alias as
for the foreign key.
Take a look at this samples
Let me know if you got it.
I did not. I extended the definition according to your example:
User.hasMany(Trade, {
as: 'Trades',
foreignKey: {
name: 'UserId',
as: 'Trades',
},
});
Trade.belongsTo(User, {
as: 'User',
foreignKey: {
name: 'UserId',
as: 'User',
},
});
There are no errors during startup, but there's an error when I try /users/list"
SequelizeDatabaseError: ER_BAD_FIELD_ERROR: Unknown column 'Trades.daySequence' in 'field list'
Do I still do something wrong?
Why sails-hook-sequelize-blueprints cannot just work with Sequelize default assignment setup?
It's seems there's other error causing this.
this hook doesn't loads the sequelize actually, https://github.com/festo/sails-hook-sequelize does it
there's something wrong with daySequence
column, have you force the sequelize syncronization at config/models.js
?
module.exports.models = {
migrate: 'drop'
}
can i have a full sample to reproduce it?
I have two models: User and Trade and I have these associations:
I get blueprint error when starting Sails:
If I explicitly define foreignKey:
I get a Sequelize error:
Did I do something wrong or is there something wrong with blueprints?