I am getting an error while doing `prisma deploy` ...
# orm-help
s
I am getting an error while doing
prisma deploy
. The error says
You are updating the field _permissions_ to be required. But there are already nodes for the model _User_ that would violate that constraint
What does this really mean? Here is how my
user
model looks like:
Copy code
type User {
  id: ID! @id
  email: String @unique
  firstName: String!
  lastName: String!
  isActive: Boolean! @default(value: true)
  isVerified: Boolean! @default(value: false)
  isUsingSystemPassword: Boolean! @default(value: true)
  userType: UserType @default(value:Admin)
  password: Password! @relation(name: "UserPassword", onDelete: CASCADE)
  projects: [Project] @relation(name:"UserProjects", onDelete: CASCADE)
  productFeedback: [ProductFeedback] @relation(name: "ProductFeedback")
  permissions: Permissions! @relation(name: "UserPermissions", onDelete: CASCADE)
  createdBy: UserCreationMap! @relation(name: "CreationMap", onDelete: CASCADE)
}
and how my
Permissions
models looks like
Copy code
type Permissions {
    id: ID! @id
    createUser: Boolean! @default(value: false)
    editUser: Boolean! @default(value: false)
    deleteUser: Boolean! @default(value: false)
    viewAllUsers: Boolean! @default(value: false)
    userId: User @relation(link: INLINE, name: "UserPermissions")
}
d
It means you already have data in the database that is not unique. E.g. you have 2 rows already, both containing the value "test" (in that specific field).
r
A way to get around this is make a copy of the table, then delete all the records from the origional table, run the update and then select the data from the copied table back to the origional table.
or - if the data isn't important and can be recreated, delete everything int he table and the update should run fine.