You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the @Unique constraint with postgresql/sqlite doesn't set the desired constraint name.
Versions
sequelize: 6.35.2
sequelize-typescript: 2.1.6
typescript: 5.3.3
Issue type
bug report
feature request
Actual behavior
Indexes follow a default naming convention - e.g. TableName_fieldName_key (TableName_fieldName1_fieldName2_key in case of composite indexes) in the case of PostgreSQL
Expected behavior
Model fields annotated with @Unique("IndexName"), @Unique({ name: "IndexName", msg: "msg" }), and @Column({ type: DataType.WHATEVER, unique: "IndexName" }) should result in unique indexes with the appropriate names in PostgreSQL and sqlite.
Steps to reproduce
Run the code below with npx ts-node index.ts. PostgreSQL and sqlite (didn't test other engines) follow Actual Behavior, while MySQL follows Expected behavior for all 4 columns, confirming what the behavior should be.
Issue
Using the
@Unique
constraint withpostgresql
/sqlite
doesn't set the desired constraint name.Versions
6.35.2
2.1.6
5.3.3
Issue type
Actual behavior
Indexes follow a default naming convention - e.g.
TableName_fieldName_key
(TableName_fieldName1_fieldName2_key
in case of composite indexes) in the case of PostgreSQLExpected behavior
Model fields annotated with
@Unique("IndexName")
,@Unique({ name: "IndexName", msg: "msg" })
, and@Column({ type: DataType.WHATEVER, unique: "IndexName" })
should result in unique indexes with the appropriate names in PostgreSQL and sqlite.Steps to reproduce
Run the code below with
npx ts-node index.ts
. PostgreSQL and sqlite (didn't test other engines) follow Actual Behavior, while MySQL follows Expected behavior for all 4 columns, confirming what the behavior should be.Related code
Code:
Output:
tsconfig:
The text was updated successfully, but these errors were encountered: