How can I dynamically update a Sequelize model definition, e.g. remove an association?

25 views Asked by At

Is there a way to update a Sequelize 6 model so as to remove a previously added association? E.g. if I have defined MyModel.hasOne(SomeOtherModel), how do I later undo this association?

I have tried manually removing the association column via sequelize.getQueryInterface() but when i later perform a SomeOtherModel.sync({alter:true}) operation, the foreignKey column gets re-added back automatically.

Any help would be much appreciated.

0

There are 0 answers