Enum as Type results in a error inside Prisma




i am having some troubles using an enum. My types are:

type MrX {
    id: ID! @unique
    moves: [Move!]!

type PoliceOfficer {
    id: ID! @unique
    moves: [Move!]!

type Move {
    id: ID! @unique
    mrX: MrX
    policeOffice: PoliceOfficer
    isVisible: Boolean!
    station: Station!
    vehicle: Vehicle!

enum Vehicle {
    Taxi, Bus, Metro

and my query is:

    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

but when i want to call it, i get a exception with “whoops” and the log looks like this:

 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','cjdhgkcrb00c70151gg59rhzk']
prisma-database_1  |

I think somehow prisma does not get that i want the Vehicle to be a column. But I do not know why. Does anybody see how i am using the enum wrong here?


It looks like your database does not contain the vehicle column. Is this on your local cluster? Then you can look into it as described here.

There are a couple of approaches for you to take:

  • remove and add the vehicle: Vehicle! field back, deploying in between
  • remove and add the Move type back, deploying in between
  • create a new service with the same data model
  • use prisma local nuke to wipe all data and internal data from your local cluster
  • manually add the column to the database

We are already looking into better tooling around these workflows :slight_smile:

Do you remember how your database ended up in this inconsistent state? If this is reproducible, we can look into a fix.



ok, removing move and vehicle plus deploying did the job. Thanks alot! =) Sorry, but i do not know how i exactly got there :confused:


More on…Java Enum