Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.
This repository was archived by the owner on Oct 29, 2025. It is now read-only.

Creating first user in Prisma studio "The column Availability.label does not exist in the current database." #122

Open

Description

@drwb

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,
  }
})
  

Activity

  1. asantarissy commented on May 24, 2022

    @asantarissy

    The Prisma schema in the published docker image is a bit old or outdated, I had to access the database through pgadmin and added my first user there.

  2. drwb commented on May 24, 2022

    @drwb
    Author

    Given I’m building locally with docker compose build calcom is there a possibility of updating the schema in the local repository before the build?

  3. krumware commented on May 25, 2022

    @krumware
    Contributor

    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

  4. krumware commented on Jun 3, 2022

    @krumware
    Contributor

    @drwb that updated image has been pushed. I know we're working through other things, but in the context of this particular issue, were you able to use the image to run the migration?

  5. Software-Design commented on Jun 7, 2022

    @Software-Design

    Currently the same issue appears with another column:

    Prisma Studio says: The column Booking.confirmed does not exist in the current database.

  6. YBAAC commented on Jun 9, 2022

    @YBAAC

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

    The column Booking.confirmed does not exist in the current database.

    Code: P2022

    Query:
    [object Object]

    Getting exactly the same error when creating a user

  7. marcoadasilvaa commented on Jun 15, 2022

    @marcoadasilvaa

    Same error here with last update at main branch

    Prisma Studio says: The column Booking.confirmed does not exist in the current database.

  8. cderszteler commented on Jun 15, 2022

    @cderszteler

    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
  9. howephillip commented on Jul 21, 2022

    @howephillip

    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

  10. deepak-lather-v0746 commented on Jul 29, 2022

    @deepak-lather-v0746

    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.

  11. zomars commented on Jul 29, 2022

    @zomars
    Contributor

    It's seems like a faulty migration on our side. Investigating...

  12. timowevel1 commented on Aug 3, 2022

    @timowevel1

    Same error here
    @zomars Any progress on this?

  13. samjaninf commented on Aug 30, 2022

    @samjaninf

    Having a very similar issue with the migrations,
    image

    Any updates?

  14. krumware commented on Aug 30, 2022

    @krumware
    Contributor
  15. zomars commented on Aug 30, 2022

    @zomars
    Contributor

    This should be already fixed on latest release.

  16. Pamalosebi commented on Sep 1, 2022

    @Pamalosebi

    Hey,

    I did prune everything from docker and pulled new. But I got this also:

    Message: Error in Prisma Client request: 
    
    
    Invalid `prisma.user.findMany()` invocation:
    
    
      The column `DestinationCalendar.bookingId` does not exist in the current database.
      
    Query:
    {
      "modelName": "User",
      "operation": "findMany",
      "args": {
        "take": 100,
        "skip": 0,
        "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,
          "trialEndsAt": true,
          "eventTypes": true,
          "credentials": true,
          "teams": true,
          "bookings": true,
          "schedules": true,
          "defaultScheduleId": true,
          "selectedCalendars": true,
          "completedOnboarding": true,
          "locale": true,
          "timeFormat": true,
          "twoFactorSecret": true,
          "twoFactorEnabled": true,
          "identityProvider": true,
          "identityProviderId": true,
          "availability": true,
          "invitedTo": true,
          "plan": true,
          "webhooks": true,
          "brandColor": true,
          "darkBrandColor": true,
          "destinationCalendar": true,
          "away": true,
          "allowDynamicBooking": true,
          "metadata": true,
          "verified": true,
          "role": true,
          "disableImpersonation": true,
          "impersonatedUsers": true,
          "impersonatedBy": true,
          "apiKeys": true,
          "accounts": true,
          "sessions": true,
          "Feedback": true
        }
      }
    } 
    

    or

    Type: undefined
    Message: 
    Invalid `prisma.user.create()` invocation:
    
    
      The column `DestinationCalendar.bookingId` does not exist in the current database.
    
    Code: P2022
    
    Query:
    [object Object]
    
  17. xoda commented on Sep 4, 2022

    @xoda

    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
    
  18. PeerRich commented on Sep 4, 2022

    @PeerRich
    Member

    @zomars can you take a look?

  19. PeerRich commented on Sep 4, 2022

    @PeerRich
    Member
  20. xoda commented on Sep 5, 2022

    @xoda

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions