can i not use the enum like this?
# prisma-whats-new
s
can i not use the enum like this?
m
Copy code
enum UserRole {
  USER
  ADMIN
}

type User {
  id: ID! @unique
  createdAt: DateTime!
  name: String!
  email: String! @unique
  role: UserRole! @defaultValue(value: USER)
  password: String!
}
for vehicle, I think you have to use a string for your input var at creation
@Simon
s
hmm, that did not seem to work
where did you find this example?
a
I think you need to set the default value as a string so:
Copy code
enum UserRole {
  USER
  ADMIN
}

type User {
  id: ID! @unique
  createdAt: DateTime!
  name: String!
  email: String! @unique
  role: UserRole! @defaultValue(value: "USER")
  password: String!
}
s
no, that did change nothing, would be weird also… And i also do not want a default value, it has to be set individually
hmmm
Caused by: java.sql.SQLException: Unknown column ‘vehicle’ in ‘field list’ prisma-database_1 | Query is: insert into
rnv-graphql-backend@dev
.
Move
(
isVisible
,
vehicle
,
id
) values ( ? , ? , ? ), parameters [1,‘Taxi’,‘cjdhfvbbe00b80151mag0pqsj’]
this is the exception
m
@Simon did you deploy your updated types and enum to Prisma?
What's the mutation you're trying to run?
s
movePoliceOfficer(parent, {stationId, policeOfficerId, vehicle}, context: Context, info) { return context.db.mutation.createMove( { data: { station: { connect: { id: stationId } }, policeOffice: { connect: { id: policeOfficerId } }, vehicle: vehicle, isVisible: true }, }, info ) },
this one
the full model is like this
type MrX { id: ID! @unique name: String! gameSession: GameSession! moves: [Move!]! } type PoliceOfficer { id: ID! @unique name: String! gameSession: GameSession! moves: [Move!]! } type Move { id: ID! @unique mrX: MrX policeOffice: PoliceOfficer isVisible: Boolean! station: Station! vehicle: Vehicle! }
m
your enum is in the same file?
Did you deploy your changes to Prisma?
s
do you know how i can check out the database? i think the enum/table thing does not get deployed correctly
jeah i did
and it is in the same file
m
@Simon hmmm not sure what to do. Maybe try posting on the forum or contacting support@graph.cool
s
ok i will try the forum first
thanks 😃
if you are interested: it seems to be some bug they could not reproduce yet. The workaround is to delete the types, deploy, add them back and deploy again. That fixed it for me
@max
m
thanks