Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

build: Connection pool to suport new supabase (#2828)

Ivan Starkov9edc0d76611f
diff --git a/packages/prisma-client/package.json b/packages/prisma-client/package.json
index a8b6c7bdee..fae24863b9 100644
--- a/packages/prisma-client/package.json
+++ b/packages/prisma-client/package.json
@@ -17,12 +17,12 @@
"migrations": "./migrations-cli/cli.ts"
},
"devDependencies": {
- "@prisma/client": "^4.14.0",
+ "@prisma/client": "^5.8.1",
"@types/node": "^18.17.1",
"@types/prompts": "^2.4.5",
"@webstudio-is/scripts": "workspace:*",
"@webstudio-is/tsconfig": "workspace:*",
- "prisma": "^4.14.0",
+ "prisma": "^5.8.1",
"tsx": "^3.12.8",
"typescript": "5.2.2",
"zod": "^3.21.4"
diff --git a/packages/prisma-client/prisma/schema.prisma b/packages/prisma-client/prisma/schema.prisma
index 0ab2e6dbf3..877735e688 100644
--- a/packages/prisma-client/prisma/schema.prisma
+++ b/packages/prisma-client/prisma/schema.prisma
@@ -3,7 +3,7 @@
generator client {
provider = "prisma-client-js"
- previewFeatures = ["views", "clientExtensions", "jsonProtocol"]
+ previewFeatures = ["views"]
// see commands.ts
// <output-placeholder-for-migrations>
output = "../src/__generated__"
@@ -11,8 +11,9 @@ generator client {
}
datasource db {
- provider = "postgres"
- url = env("DATABASE_URL")
+ provider = "postgres"
+ url = env("DATABASE_URL")
+ directUrl = env("DIRECT_URL")
}
model Team {
diff --git a/packages/prisma-client/src/prisma.ts b/packages/prisma-client/src/prisma.ts
index 21c7514537..ef7f6e18f9 100644
--- a/packages/prisma-client/src/prisma.ts
+++ b/packages/prisma-client/src/prisma.ts
@@ -16,38 +16,12 @@ declare global {
const logPrisma = process.env.NODE_ENV === "production";
-/**
- * All the code below like initialize prisma should be moved into the builder and apps if used.
- * The issue that this project depends on env variables not available in some frameworks
- * getPgBouncerUrl() can be moved as a default fallback for db url at apps/builder/app/env/env.server.ts
- **/
-const getPgBouncerUrl = () => {
- if (process.env.PGBOUNCER !== "true") {
- return process.env.DATABASE_URL;
- }
-
- const databaseUrl = new URL(
- process.env.DATABASE_URL ?? "postgresql://localhost:5432/postgres"
- );
-
- // https://supabase.com/docs/guides/database/connecting-to-postgres#connection-pooler
- databaseUrl.port = "6543";
- // https://www.prisma.io/docs/guides/performance-and-optimization/connection-management/configure-pg-bouncer
- databaseUrl.searchParams.set("pgbouncer", "true");
-
- return databaseUrl.href;
-};
-
-const pgUrl = getPgBouncerUrl();
-
// this fixes the issue with `warn(prisma-client) There are already 10 instances of Prisma Client actively running.`
// explanation here
// https://www.prisma.io/docs/guides/database/troubleshooting-orm/help-articles/nextjs-prisma-client-dev-practices
export const prisma =
global.prisma ||
new PrismaClient({
- datasources: pgUrl === undefined ? undefined : { db: { url: pgUrl } },
-
...(logPrisma
? {
log: [
diff --git a/packages/prisma-client/src/types.ts b/packages/prisma-client/src/types.ts
index f2c14b09c8..0386ee2565 100644
--- a/packages/prisma-client/src/types.ts
+++ b/packages/prisma-client/src/types.ts
@@ -5,7 +5,6 @@ export type {
Asset,
File,
DashboardProject,
- AuthorizationRelation,
AuthorizationToken,
DomainStatus,
Domain,
@@ -14,4 +13,5 @@ export type {
LatestBuildPerProject,
PublishStatus,
Product,
+ $Enums,
} from "./__generated__";
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 0a3ac8e4e1..184b4da894 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1486,8 +1486,8 @@ importers:
version: 3.2.1
devDependencies:
'@prisma/client':
- specifier: ^4.14.0
- version: 4.14.0([email protected])
+ specifier: ^5.8.1
+ version: 5.8.1([email protected])
'@types/node':
specifier: ^18.17.1
version: 18.17.1
@@ -1501,8 +1501,8 @@ importers:
specifier: workspace:*
version: link:../tsconfig
prisma:
- specifier: ^4.14.0
- version: 4.14.0
+ specifier: ^5.8.1
+ version: 5.8.1
tsx:
specifier: ^3.12.8
version: 3.12.8
@@ -5195,9 +5195,9 @@ packages:
requiresBuild: true
optional: true
- resolution: {integrity: sha512-MK/XaA2sFdfaOa7I9MjNKz6dxeIEdeZlnpNRoF2w3JuRLlFJLkpp6cD3yaqw2nUUhbrn3Iqe3ZpVV+VuGGil7Q==}
- engines: {node: '>=14.17'}
+ resolution: {integrity: sha512-xQtMPfbIwLlbm0VVIVQY2yqQVOxPwRQhvIp7Z3m2900g1bu/zRHKhYZJQWELqmjl6d8YwBy0K2NvMqh47v1ubw==}
+ engines: {node: '>=16.13'}
requiresBuild: true
peerDependencies:
prisma: '*'
@@ -5205,17 +5205,39 @@ packages:
prisma:
optional: true
dependencies:
- '@prisma/engines-version': 4.14.0-67.d9a4c5988f480fa576d43970d5a23641aa77bc9c
- prisma: 4.14.0
+ prisma: 5.8.1
+ dev: true
+
+ /@prisma/[email protected]:
+ resolution: {integrity: sha512-tjuw7eA0Us3T42jx9AmAgL58rzwzpFGYc3R7Y4Ip75EBYrKMBA1YihuWMcBC92ILmjlQ/u3p8VxcIE0hr+fZfg==}
dev: true
- /@prisma/engines-version@4.14.0-67.d9a4c5988f480fa576d43970d5a23641aa77bc9c:
- resolution: {integrity: sha512-3jum8/YSudeSN0zGW5qkpz+wAN2V/NYCQ+BPjvHYDfWatLWlQkqy99toX0GysDeaUoBIJg1vaz2yKqiA3CFcQw==}
+ /@prisma/[email protected]:
+ resolution: {integrity: sha512-f5C3JM3l9yhGr3cr4FMqWloFaSCpNpMi58Om22rjD2DOz3owci2mFdFXMgnAGazFPKrCbbEhcxdsRfspEYRoFQ==}
dev: true
- /@prisma/[email protected]:
- resolution: {integrity: sha512-PDNlhP/1vyTgmNyiucGqGCdXIp7HIkkvKO50si3y3PcceeHvqtiKPaH1iJdz63jCWMVMbj2MElSxXPOeBvEVIQ==}
+ /@prisma/[email protected]:
+ resolution: {integrity: sha512-TJgYLRrZr56uhqcXO4GmP5be+zjCIHtLDK20Cnfg+o9d905hsN065QOL+3Z0zQAy6YD31Ol4u2kzSfRmbJv/uA==}
requiresBuild: true
+ dependencies:
+ '@prisma/debug': 5.8.1
+ '@prisma/engines-version': 5.8.1-1.78caf6feeaed953168c64e15a249c3e9a033ebe2
+ '@prisma/fetch-engine': 5.8.1
+ '@prisma/get-platform': 5.8.1
+ dev: true
+
+ /@prisma/[email protected]:
+ resolution: {integrity: sha512-+bgjjoSFa6uYEbAPlklfoVSStOEfcpheOjoBoNsNNSQdSzcwE2nM4Q0prun0+P8/0sCHo18JZ9xqa8gObvgOUw==}
+ dependencies:
+ '@prisma/debug': 5.8.1
+ '@prisma/engines-version': 5.8.1-1.78caf6feeaed953168c64e15a249c3e9a033ebe2
+ '@prisma/get-platform': 5.8.1
+ dev: true
+
+ /@prisma/[email protected]:
+ resolution: {integrity: sha512-wnA+6HTFcY+tkykMokix9GiAkaauPC5W/gg0O5JB0J8tCTNWrqpnQ7AsaGRfkYUbeOIioh6woDjQrGTTRf1Zag==}
+ dependencies:
+ '@prisma/debug': 5.8.1
dev: true
/@radix-ui/[email protected]:
@@ -14967,13 +14989,13 @@ packages:
parse-ms: 2.1.0
dev: true
- resolution: {integrity: sha512-+5dMl1uxMQb4RepndY6AwR9xi1cDcaGFICu+ws6/Nmgt93mFPNj8tYxSfTdmfg+rkNrUId9rk/Ac2vTgLe/oXA==}
- engines: {node: '>=14.17'}
+ resolution: {integrity: sha512-N6CpjzECnUHZ5beeYpDzkt2rYpEdAeqXX2dweu6BoQaeYkNZrC/WJHM+5MO/uidFHTak8QhkPKBWck1o/4MD4A==}
+ engines: {node: '>=16.13'}
hasBin: true
requiresBuild: true
dependencies:
- '@prisma/engines': 4.14.0
+ '@prisma/engines': 5.8.1
dev: true