This repository has been archived by the owner on Sep 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 860
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 #4747 from prisma/CustomIdsWithRelationsOnPostgres…
…AndMySql Fix Relationtable bug in Postgres and SQLite
- Loading branch information
Showing
3 changed files
with
69 additions
and
4 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
65 changes: 65 additions & 0 deletions
65
...ration-tests-mysql/src/test/scala/com/prisma/integration/DeployingCustomIdNamesSpec.scala
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,65 @@ | ||
package com.prisma.integration | ||
|
||
import org.scalatest.{FlatSpec, Matchers} | ||
|
||
class DeployingCustomIdNamesSpec extends FlatSpec with Matchers with IntegrationBaseSpec { | ||
|
||
"Using Custom Id field names with relations" should "work" in { | ||
|
||
val schema = | ||
"""type Person { | ||
| id: ID! @id | ||
| age: Int! @unique | ||
|}""" | ||
|
||
val (project, _) = setupProject(schema) | ||
|
||
val schema1 = | ||
"""type Game { | ||
| gameId: ID! @id | ||
| createdAt: DateTime! @createdAt | ||
| updatedAt: DateTime! @updatedAt | ||
| lastUpdatedOn: String! | ||
| players: [Player!]! @relation(link: TABLE, name: "GamePlayer") | ||
|} | ||
| | ||
|type Player { | ||
| playerId: ID! @id | ||
| createdAt: DateTime! @createdAt | ||
| updatedAt: DateTime! @updatedAt | ||
| lastUpdatedOn: String! | ||
| games: [Game!]! @relation(name: "GamePlayer") | ||
|}""" | ||
|
||
deployServer.deploySchemaThatMustSucceed(project, schema1, 3, true) | ||
} | ||
|
||
"Using [typename]id as a field for relations" should "work" in { | ||
|
||
val schema = | ||
"""type Person { | ||
| id: ID! @id | ||
| age: Int! @unique | ||
|}""" | ||
|
||
val (project, _) = setupProject(schema) | ||
|
||
val schema1 = | ||
"""type Contact @db(name: "contact") { | ||
|id: Int! @id | ||
|info: String! | ||
|type: String! | ||
|customerid: Customer | ||
|} | ||
| | ||
|type Customer @db(name: "customer") { | ||
|id: Int! @id | ||
|contact: [Contact] | ||
|firstname: String! | ||
|lastname: String! | ||
|}""" | ||
|
||
deployServer.deploySchemaThatMustSucceed(project, schema1, 3, true) | ||
} | ||
|
||
} |