

Should on update and on delete constraints be enabled on the foreign key. (sqlite not supported for N:M)Ĭascade if this is a n:m, and set null if it is a 1:m Defaults to the name of target + primary key of targetĪ key/value set that will be used for association create and find defaults on the target. When using an object, you can add a name property to set the name of the column. The name of the foreign key in the join table (representing the target model) or an object representing the type definition for the other column (see fine for syntax). Defaults to the name of source + primary key of source The name of the foreign key in the join table (representing the source model) or an object representing the type definition for the foreign column (see fine for syntax). Defaults to the pluralized name of target If you provide an alias when creating the association, you should provide the same alias when eager loading and when getting associated models. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you want to control the singular version yourself, provide an object with plural and singular keys. If you provide a string, it should be plural, and will be singularized using node.inflection. If true the generated join table will be paranoid If true a unique key will be generated from the foreign keys used (might want to turn this off and create specific unique keys when using scopes) (Remember to add the attributes to the through model)

The model used to join both sides of the N:M association.Ī key/value set that will be used for association create and find defaults on the through model. Can also be a sequelize model if you want to define the junction table yourself and add extra attributes to it. The name of the table that is used to join source and target in n:m associations. Otherwise the profile will be deleted without invoking any hooks For example if User.hasOne(Profile, ), the before-/afterDestroy hooks for profile will be called when a user is deleted. Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade. If additional attributes are specified, along with group clauses, set plain to false to return all values of all returned rows. When true, the first returned value of aggregateFunction is cast to dataType and returned. If field is a field in this Model, the default will be the type of that field, otherwise defaults to float.Īpplies DISTINCT to the field being aggregated over Pass query execution time in milliseconds as second argument to logging function (options.logging).

#Psequel create table full#
See sequelize.query for full optionsĪ function that gets executed while running the query to log the sql. The function to use for aggregation, e.g. errors/validation C UniqueConstraintError.errors/database C ExclusionConstraintError.dialects/postgres C PostgresQueryInterface.
