docker: Creating first user in Prisma studio "The column `Availability.label` does not exist in the current database."

In step 8 of the readme.md instructions, notwithstanding the workaround for #121, Prisma studio throws the following error when trying to save the fist user:

Type: PrismaClientKnownRequestError
Message: 
Invalid `prisma.user.create()` invocation:


  The column `Availability.label` does not exist in the current database.

Code: P2022

Query:
prisma.user.create(
{
  data: {
    username: "drwb",
    name: "Name",
    email: "email@domain.tld",
    emailVerified: "2022-05-22T00:00:00.000Z",
    password: "bcrypthash",
    bio: null,
    avatar: null,
    timeZone: "Region/City",
    weekStart: "Sunday",
    startTime: 0,
    endTime: 1440,
    bufferTime: 0,
    hideBranding: true,
    theme: null,
    createdDate: "2022-05-22T00:00:00.000Z",
    eventTypes: {

    },
    credentials: {

    },
    teams: {

    },
    bookings: {

    },
    availability: {

    },
    selectedCalendars: {

    },
    completedOnboarding: false,
    locale: null,
    twoFactorSecret: null,
    twoFactorEnabled: false,
    plan: "PRO",
    Schedule: {

    },
    webhooks: {

    },
  },
  select: {
    id: true,
    username: true,
    name: true,
    email: true,
    emailVerified: true,
    password: true,
    bio: true,
    avatar: true,
    timeZone: true,
    weekStart: true,
    startTime: true,
    endTime: true,
    bufferTime: true,
    hideBranding: true,
    theme: true,
    createdDate: true,
    eventTypes: true,
    credentials: true,
    teams: true,
    bookings: true,
    availability: true,
    selectedCalendars: true,
    completedOnboarding: true,
    locale: true,
    twoFactorSecret: true,
    twoFactorEnabled: true,
    plan: true,
    Schedule: true,
    webhooks: true,
  },
}
)

When browsing the availability field, it throws the error:

Message: Error in Prisma Client request: 
Invalid `prisma.availability.findMany()` invocation:
  The column `Availability.label` does not exist in the current database.
Query:
prisma.availability.findMany({
  where: {
    AND: [
    ]
  },
  take: 100,
  skip: 0,
  select: {
    id: true,
    label: true,
    user: true,
    userId: true,
    eventType: true,
    eventTypeId: true,
    days: true,
    startTime: true,
    endTime: true,
    date: true,
  }
})
  

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 20 (7 by maintainers)

Most upvoted comments

Also seems to be happening on destinationCalendar

`Message: Error in Prisma Client request:

Invalid prisma.destinationCalendar.findMany() invocation:

The column DestinationCalendar.bookingId does not exist in the current database.`

It follows with “Unable to run script” error

I can confirm latest release has a mismatch between the Prisma schema and the schema in place for real. By looking at the long history of this issue, I guess the use of Primsa is a sub-optimal idea to add an user.

I suggest everyone that faces a similar issue to solve it via CLI by doing the following in the postgres machine:

# psql -U [DB_USERNAME] -d [DB_NAME] -c "INSERT INTO users (username, name, email, password, metadata) VALUES ('[USER]', '[NAME]', '[EMAIL]', '[BCRYPT-HASH]', '{}');"

If you’re here and you’re a docker newbie, basically what you need to do is to execute the following while the containers are running:

$ docker ps
CONTAINER ID   IMAGE                      COMMAND                  CREATED          STATUS         PORTS                              NAMES
01e594e7c225   calcom-docker_calcom       "docker-entrypoint.s…"   9 seconds ago    Up 8 seconds   0.0.0.0:3000->3000/tcp             calcom-docker_calcom_1
104705ba8b4e   calendso/calendso:latest   "docker-entrypoint.s…"   9 seconds ago    Up 8 seconds   3000/tcp, 0.0.0.0:5555->5555/tcp   calcom-docker_studio_1
5f873249c74b   postgres                   "docker-entrypoint.s…"   10 seconds ago   Up 9 seconds   5432/tcp                           database

Collect the Container ID of the postgres database and use it to get a shell inside the container:

$ docker exec -it 5f873249c74b bash

afterwards, just execute the following query, by paying attention to replace every field with your desired data:

# psql -U unicorn_user -d calendso
psql (14.5 (Debian 14.5-1.pgdg110+1))
Type "help" for help.
calendso=# INSERT INTO users (username, name, email, password, metadata) VALUES ('user', 'user', 'user@localhost.localdomain', '$2a$12$gRhRo3xgNaHziqGweOHBv.YgF6LGf3QjE8T5h5HxqwTfH.6NHeRtO', '{}');
INSERT 0 1

For the ones needing a quick solution, I just used pgAdmin4 temporarily to create an user:

  pgadmin:
    container_name: pgadmin4_container
    image: dpage/pgadmin4
    restart: always
    environment:
      PGADMIN_DEFAULT_EMAIL: admin@admin.com
      PGADMIN_DEFAULT_PASSWORD: root
    ports:
      - 127.0.0.1:5050:80
    depends_on:
      - database
    networks:
      - stack

@PeerRich I didn’t, but since I pulled everything from scratch just yesterday, I assumed everything was up-to-date and I had no reason to update the database. If it’s not the case I can help testing it out.

Following error is thrown while trying to create first user.

Type: undefined
Message: 
Invalid `prisma.user.create()` invocation:


  The column `DestinationCalendar.bookingId` does not exist in the current database.

Code: P2022

Query:
[object Object]

Have already tried troubleshooting steps. Also removed past volume to have fresh start as advised earlier.

You may have a database volume leftover from a previous setup. Is this a fresh instance? If you need to start from scratch, you can find the database-data volume and delete it docker volume ls docker volume rm {name of offending volume}

I am working now on getting the updated image pushed, so you can try running locally without building