-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3255 from prisma/psl/multi-schema-map-conflict
- Loading branch information
Showing
9 changed files
with
137 additions
and
26 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
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
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
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
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
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
23 changes: 23 additions & 0 deletions
23
psl/psl/tests/validation/attributes/map/duplicate_models_with_map_on_both_sides.prisma
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,23 @@ | ||
datasource mydb { | ||
provider = "sqlite" | ||
url = env("TEST_DB_URL") | ||
} | ||
|
||
model Dog { | ||
id Int @id | ||
@@map("pets") | ||
} | ||
|
||
model Cat { | ||
id Int @id | ||
@@map("pets") | ||
} | ||
|
||
// [1;91merror[0m: [1mThe model with database name "pets" could not be defined because another model with this name exists: "Dog"[0m | ||
// [1;94m-->[0m [4mschema.prisma:15[0m | ||
// [1;94m | [0m | ||
// [1;94m14 | [0m | ||
// [1;94m15 | [0m [1;91m@@map("pets")[0m | ||
// [1;94m | [0m |
30 changes: 30 additions & 0 deletions
30
...sts/validation/attributes/schema/tables_in_different_schemas_with_same_mapped_name.prisma
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,30 @@ | ||
// issue: https://github.com/prisma/prisma/issues/15009 | ||
|
||
generator client { | ||
provider = "prisma-client-js" | ||
previewFeatures = ["multiSchema"] | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("TEST_DATABASE_URL") | ||
schemas = ["base", "transactional"] | ||
} | ||
|
||
model User { | ||
id String @id | ||
email String | ||
posts Post[] | ||
@@map("some_table") | ||
@@schema("base") | ||
} | ||
|
||
model Post { | ||
title String | ||
authorId String @unique | ||
author User? @relation(fields: [authorId], references: [id]) | ||
@@map("some_table") | ||
@@schema("transactional") | ||
} |
32 changes: 32 additions & 0 deletions
32
...psl/tests/validation/attributes/schema/tables_in_same_schema_with_same_mapped_name.prisma
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,32 @@ | ||
datasource mydb { | ||
provider = "sqlserver" | ||
url = env("TEST_DB_URL") | ||
schemas = ["base", "transactional"] | ||
} | ||
|
||
generator client { | ||
provider = "prisma-client-js" | ||
previewFeatures = ["multiSchema"] | ||
} | ||
|
||
|
||
model Dog { | ||
id Int @id | ||
@@map("pets") | ||
@@schema("base") | ||
} | ||
|
||
model Cat { | ||
id Int @id(map: "cat_pets_pkey") | ||
@@map("pets") | ||
@@schema("base") | ||
} | ||
|
||
// [1;91merror[0m: [1mThe model with database name "pets" could not be defined because another model with this name exists: "Dog"[0m | ||
// [1;94m-->[0m [4mschema.prisma:23[0m | ||
// [1;94m | [0m | ||
// [1;94m22 | [0m | ||
// [1;94m23 | [0m [1;91m@@map("pets")[0m | ||
// [1;94m | [0m |