diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 70c637e25a..47e6039f89 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3982,6 +3982,41 @@ declare namespace sequelize { } + interface AddUniqueConstraintOptions { + type: 'unique'; + name?: string; + } + + interface AddDefaultConstraintOptions { + type: 'default'; + name?: string; + defaultValue?: any; + } + + interface AddCheckConstraintOptions { + type: 'check'; + name?: string; + where?: WhereOptions; + } + + interface AddPrimaryKeyConstraintOptions { + type: 'primary key'; + name?: string; + } + + interface AddForeignKeyConstraintOptions { + type: 'foreign key'; + name?: string; + references?: { + table: string; + field: string; + }; + onDelete: string; + onUpdate: string; + } + + type AddConstraintOptions = AddUniqueConstraintOptions | AddDefaultConstraintOptions | AddCheckConstraintOptions | AddPrimaryKeyConstraintOptions | AddForeignKeyConstraintOptions; + /** * The interface that Sequelize uses to talk to all databases. * @@ -4133,6 +4168,16 @@ declare namespace sequelize { removeIndex(tableName: string, indexNameOrAttributes: string[] | string, options?: QueryInterfaceOptions): Promise; + /** + * Adds constraints to a table + */ + addConstraint(tableName: string, attributes: string[], options?: AddConstraintOptions | QueryInterfaceOptions): Promise; + + /** + * Removes constraints from a table + */ + removeConstraint(tableName: string, constraintName: string, options?: QueryInterfaceOptions): Promise; + /** * Inserts a new record */