-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ie: replicate pre-datamodel-renderer single-field unique behaviour
The first unique index defined on the field wins. This became visible in introspection CI after #3333 was merged. Arguably, we should instead introspect `@@unique()`s on the model for extra single-field uniques, but that would be a change.
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...introspection-engine-tests/tests/simple/postgres/multiple_single_field_unique_indexes.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- tags=postgres | ||
-- exclude=cockroachdb | ||
|
||
CREATE TABLE mymodel ( | ||
id UUID PRIMARY KEY, | ||
thefield TEXT | ||
); | ||
|
||
CREATE UNIQUE INDEX unq2 ON mymodel(thefield); | ||
CREATE UNIQUE INDEX unq3 ON mymodel(thefield); | ||
CREATE UNIQUE INDEX unq1 ON mymodel(thefield); | ||
|
||
/* | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
datasource db { | ||
provider = "postgresql" | ||
url = "env(TEST_DATABASE_URL)" | ||
} | ||
model mymodel { | ||
id String @id @db.Uuid | ||
thefield String? @unique(map: "unq1") | ||
} | ||
*/ |