Feat(utils): psql unique index instead of constraint (#6386)
**What** - always return an index expression, also for unique constraints **why** - constraints can't be partial, meaning `UNIQUE ... WHERE` is not possible with constraints - constraints are indicies under the hood so it doesn't change the behavior of the system when we're not using constraint specific features but just using them for `UNIQUE`
This commit is contained in:
@@ -73,9 +73,9 @@ describe("createPsqlIndexStatementHelper", function () {
|
||||
|
||||
const indexStatement = createPsqlIndexStatementHelper(options)
|
||||
expect(indexStatement).toEqual(
|
||||
`ALTER TABLE IF EXISTS "${options.tableName}" ADD CONSTRAINT "${
|
||||
options.name
|
||||
}" UNIQUE (${options.columns.join(", ")}) WHERE ${options.where}`
|
||||
`CREATE UNIQUE INDEX IF NOT EXISTS "${options.name}" ON "${
|
||||
options.tableName
|
||||
}" (${options.columns.join(", ")}) WHERE ${options.where}`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user