Skip to content

postgrelize / BeforeDestroy

Variable: BeforeDestroy ​

const BeforeDestroy: ModelStaticMethodDecorator

Defined in: src/decorators/hook-decorators.ts:152

Registers the decorated static method as a beforeDestroy hook of the model (like Model.beforeDestroy). The method receives the hook arguments; static methods only. Registered when sequelize.addModels applies the class. Accepts the TC39 and the legacy experimentalDecorators call signature.

Example ​

ts
class User extends Model {
  @BeforeDestroy
  static async onBeforeDestroy(user: User, options: unknown) {}
}

Released under the MIT License.