Home > OS >  TS Sequelize - Specifying the type of fields on the model
TS Sequelize - Specifying the type of fields on the model

Time:02-17

I have these two lines of code. I cannot find any docs for them:

declare setClasa: HasOneSetAssociationMixin<Clasa, 'id'>;
declare createClasa: HasOneCreateAssociationMixin<Clasa>;

I can't really understand the difference between the two. What is each of them supposed to do? What's the difference between Set and Create?

CodePudding user response:

Set is about setting a foreign key value in the existing Clasa record and Create is about creating a new Clasa record and associating it with the record on the other end of the association.

  • Related