0
I am trying to create a Schema with Graphcool in an Angular application. The types are as follows::
type User @model {
id: ID! @isUnique
name: String!
email: String! @isUnique
password: String!
createdAt: DateTime!
updatedAt: DateTime!
chats: [Chat!]! @relation(name: "UsersOnChats")
messages: [Message!]! @relation(name: "MessagesOnUser")
photo: File @relation(name: "UserPhoto")
}
type Chat @model {
id: ID! @isUnique
title: String
isGroup: Boolean @defaultValue(value: "false")
createdAt: DateTime!
updatedAt: DateTime!
users: [User!]! @relation(name: "UsersOnChats")
messages: [Message!]! @relation(name: "MessagesOnChat")
photo: File @relation(name: "ChatPhoto")
}
type Message @model {
id: ID! @isUnique
text: String!
createdAt: DateTime!
sender: User! @relation(name: "MessagesOnUser")
chat: Chat! @relation(name: "MessagesOnChat")
}
type File @model {
id: ID! @isUnique
secret: String
name: String
size: Int
url: String
contentType: String
user: User @relation(name: "UserPhoto")
chat: Chat @relation(name: "ChatPhoto")
}
While running the application and trying to run the console to check my Mutation, I get the following error:
ERROR Error: "Graphql error: A Unique Constraint would be violated on User. Details: Field name = email"