Skip to content

postgrelize / InitOptions

Type Alias: InitOptions ​

InitOptions = DefinitionOptions & Readonly<{ defaultScope?: ScopeOptions; hooks?: HooksOption; scopes?: Readonly<Record<string, ScopeDefinition>>; sequelize: RuntimeOwner; validate?: Readonly<Record<string, ModelValidatorFunction>>; validationSchema?: StandardSchemaV1; whereMergeStrategy?: WhereMergeStrategy; }>

Defined in: src/model/options.ts:107

Options of Model.init: table-level options plus hooks, scopes and validation.

Extends DefinitionOptions.

See ​

Model.init

Example ​

ts
User.init(
  { name: DataTypes.STRING, email: DataTypes.STRING },
  {
    sequelize,
    modelName: 'User',
    paranoid: true,
    defaultScope: { where: { active: true } },
    scopes: { admins: { where: { role: 'admin' } } },
  },
);

Released under the MIT License.