Tanner
10/17/2018, 3:50 PM@relation
tag I’m having trouble getting it to work.
type User {
id: ID! @unique
bookings: [Booking!]! @relation(name: "BookingsByUser")
createdBookings: [Booking!]! @relation(name: "BookingsCreatedByUser")
}
type Booking {
id: ID! @unique
user: User! @relation(name: "BookingsByUser")
orignalUser: User @relation(name: "BookingsCreatedByUser")
}
This throws an error on deployment ERROR: There is a relation ambiguity during the migration. Please first name the old relation on your schema. The ambiguity is on a relation between Booking and User. Please name relations or change the schema in steps.
marcus
10/18/2018, 9:54 AMtype User {
id: ID! @unique
bookings: [Booking!]!
}
type Booking {
id: ID! @unique
user: User!
The error message suggests to do this now as an intermediate step. This will inform Prisma about the name you want to use from now on for this relation.
type User {
id: ID! @unique
bookings: [Booking!]! @relation(name: "BookingsByUser")
}
type Booking {
id: ID! @unique
user: User! @relation(name: "BookingsByUser")
}
Afterwards you can deploy your final schema correctly.