Skip to content

Scheduling infrastructure for absolutely everyone.

chore: adds failsafe auto migrations back (#13569)

Omar Lópeze88434880764
diff --git a/.env.example b/.env.example
index b471e34c2e9..1f957d7445d 100644
--- a/.env.example
+++ b/.env.example
@@ -23,6 +23,9 @@ CALCOM_LICENSE_KEY=
# - DATABASE ************************************************************************************************
DATABASE_URL="postgresql://postgres:@localhost:5450/calendso"
+# Needed to run migrations while using a connection pooler like PgBouncer
+# Use the same one as DATABASE_URL if you're not using a connection pooler
+DATABASE_DIRECT_URL=
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=
INSIGHTS_DATABASE_URL=
diff --git a/packages/prisma/package.json b/packages/prisma/package.json
index afb4e193f8a..3ab565f633c 100644
--- a/packages/prisma/package.json
+++ b/packages/prisma/package.json
@@ -4,6 +4,7 @@
"private": true,
"scripts": {
"clean": "rm -rf .turbo && rm -rf node_modules",
+ "build": "yarn prisma migrate deploy || true",
"db-deploy": "yarn prisma migrate deploy",
"db-migrate": "yarn prisma migrate dev",
"db-nuke": "docker compose down --volumes --remove-orphans || docker-compose down --volumes --remove-orphans",
diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prisma
index df0ed82720d..6f7330f32bb 100644
--- a/packages/prisma/schema.prisma
+++ b/packages/prisma/schema.prisma
@@ -2,8 +2,9 @@
// learn more about it in the docs: https://pris.ly/d/prisma-schema
datasource db {
- provider = "postgresql"
- url = env("DATABASE_URL")
+ provider = "postgresql"
+ url = env("DATABASE_URL")
+ directUrl = env("DATABASE_DIRECT_URL")
}
generator client {
@@ -294,9 +295,9 @@ model Profile {
organization Team @relation(fields: [organizationId], references: [id], onDelete: Cascade)
username String
eventTypes EventType[]
- movedFromUser User? @relation("moved_to_profile")
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
+ movedFromUser User? @relation("moved_to_profile")
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
@@unique([userId, organizationId])
@@index([uid])