docker
docker copied to clipboard
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 protected]",
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,
}
})
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.
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?
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
@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?
Currently the same issue appears with another column:
Prisma Studio says: The column
Booking.confirmed does not exist in the current database.
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
Same error here with last update at main branch
Prisma Studio says: The column Booking.confirmed does not exist in the current database.
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: [email protected]
PGADMIN_DEFAULT_PASSWORD: root
ports:
- 127.0.0.1:5050:80
depends_on:
- database
networks:
- stack
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
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.
It's seems like a faulty migration on our side. Investigating...
Same error here @zomars Any progress on this?
Having a very similar issue with the migrations,
Any updates?
@zomars
This should be already fixed on latest release.
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]
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', '[email protected]', '$2a$12$gRhRo3xgNaHziqGweOHBv.YgF6LGf3QjE8T5h5HxqwTfH.6NHeRtO', '{}');
INSERT 0 1
@zomars can you take a look?
just to confirm @xoda did you try this? https://developer.cal.com/self-hosting/database-migrations
@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.