Skip to content

Commit 3b8dadb

Browse files
committed
Upgrade Prisma to v7
1 parent d373db5 commit 3b8dadb

65 files changed

Lines changed: 1067 additions & 577 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/e2e-api-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
env:
1818
NODE_ENV: test
1919
STACK_ENABLE_HARDCODED_PASSKEY_CHALLENGE_FOR_TESTING: yes
20-
STACK_DIRECT_DATABASE_CONNECTION_STRING: "postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@localhost:8128/stackframe"
20+
STACK_DATABASE_CONNECTION_STRING: "postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@localhost:8128/stackframe"
2121

2222
strategy:
2323
matrix:

.github/workflows/e2e-custom-base-port-api-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
env:
1818
NODE_ENV: test
1919
STACK_ENABLE_HARDCODED_PASSKEY_CHALLENGE_FOR_TESTING: yes
20-
STACK_DIRECT_DATABASE_CONNECTION_STRING: "postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@localhost:6728/stackframe"
20+
STACK_DATABASE_CONNECTION_STRING: "postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@localhost:6728/stackframe"
2121
NEXT_PUBLIC_STACK_PORT_PREFIX: "67"
2222

2323
strategy:

.github/workflows/e2e-source-of-truth-api-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
STACK_ENABLE_HARDCODED_PASSKEY_CHALLENGE_FOR_TESTING: yes
2020
STACK_OVERRIDE_SOURCE_OF_TRUTH: '{"type": "postgres", "connectionString": "postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@localhost:8128/source-of-truth-db?schema=sot-schema"}'
2121
STACK_TEST_SOURCE_OF_TRUTH: true
22-
STACK_DIRECT_DATABASE_CONNECTION_STRING: "postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@localhost:8128/stackframe"
22+
STACK_DATABASE_CONNECTION_STRING: "postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@localhost:8128/stackframe"
2323

2424
strategy:
2525
matrix:

apps/backend/.env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ STACK_DEFAULT_EMAIL_CAPACITY_PER_HOUR=# the number of emails a new project can s
4848
# Database
4949
# For local development: `docker run -it --rm -e POSTGRES_PASSWORD=password -p "8128:5432" postgres`
5050
STACK_DATABASE_CONNECTION_STRING=# enter your connection string here. For local development: `postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@localhost:8128/stackframe`
51-
STACK_DIRECT_DATABASE_CONNECTION_STRING=# enter your direct (unpooled or session mode) database connection string here. For local development: same as above
5251

5352
# Webhooks
5453
STACK_SVIX_SERVER_URL=# For prod, leave it empty. For local development, use `http://localhost:8113`

apps/backend/.env.development

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ STACK_SPOTIFY_CLIENT_SECRET=MOCK
2727
STACK_ALLOW_SHARED_OAUTH_ACCESS_TOKENS=true
2828

2929
STACK_DATABASE_CONNECTION_STRING=postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@localhost:${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}28/stackframe?connection_limit=20
30-
STACK_DIRECT_DATABASE_CONNECTION_STRING=postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@localhost:${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}28/stackframe?connection_limit=20
3130

3231
STACK_EMAIL_HOST=127.0.0.1
3332
STACK_EMAIL_PORT=${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}29

apps/backend/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@
5959
"@opentelemetry/sdk-trace-node": "^1.26.0",
6060
"@opentelemetry/semantic-conventions": "^1.27.0",
6161
"@oslojs/otp": "^1.1.0",
62-
"@prisma/adapter-neon": "^6.12.0",
63-
"@prisma/adapter-pg": "^6.12.0",
64-
"@prisma/client": "^6.12.0",
65-
"@prisma/instrumentation": "^6.12.0",
62+
"@prisma/adapter-neon": "^7.0.0",
63+
"@prisma/adapter-pg": "^7.0.0",
64+
"@prisma/client": "^7.0.0",
65+
"@prisma/instrumentation": "^7.0.0",
6666
"@react-email/render": "^1.2.1",
6767
"@sentry/nextjs": "^10.11.0",
6868
"@simplewebauthn/server": "^11.0.0",
@@ -110,7 +110,7 @@
110110
"concurrently": "^8.2.2",
111111
"glob": "^10.4.1",
112112
"import-in-the-middle": "1.14.2",
113-
"prisma": "^6.12.0",
113+
"prisma": "^7.0.0",
114114
"require-in-the-middle": "^7.4.0",
115115
"rimraf": "^5.0.5",
116116
"tsup": "^8.3.0",

apps/backend/prisma.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import 'dotenv/config'
2+
import { defineConfig, env } from 'prisma/config'
3+
4+
export default defineConfig({
5+
schema: 'prisma/schema.prisma',
6+
migrations: {
7+
path: 'prisma/migrations',
8+
seed: 'pnpm run db-seed-script',
9+
},
10+
datasource: {
11+
url: env('STACK_DATABASE_CONNECTION_STRING'),
12+
},
13+
})
14+

apps/backend/prisma/schema.prisma

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
generator client {
2-
provider = "prisma-client-js"
3-
previewFeatures = ["driverAdapters", "relationJoins"]
2+
provider = "prisma-client"
3+
output = "../src/generated/prisma"
44
}
55

66
datasource db {
7-
provider = "postgresql"
8-
url = env("STACK_DATABASE_CONNECTION_STRING")
9-
directUrl = env("STACK_DIRECT_DATABASE_CONNECTION_STRING")
7+
provider = "postgresql"
108
}
119

1210
model SchemaMigration {

apps/backend/prisma/seed.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
import { teamMembershipsCrudHandlers } from '@/app/api/latest/team-memberships/crud';
33
import { teamsCrudHandlers } from '@/app/api/latest/teams/crud';
44
import { usersCrudHandlers } from '@/app/api/latest/users/crud';
5+
import { CustomerType, EmailOutboxCreatedWith, Prisma, PrismaClient, PurchaseCreationSource, SubscriptionStatus } from '@/generated/prisma/client';
56
import { overrideEnvironmentConfigOverride } from '@/lib/config';
67
import { ensurePermissionDefinition, grantTeamPermission } from '@/lib/permissions';
78
import { createOrUpdateProjectWithLegacyConfig, getProject } from '@/lib/projects';
89
import { DEFAULT_BRANCH_ID, getSoleTenancyFromProjectBranch, type Tenancy } from '@/lib/tenancies';
910
import { getPrismaClientForTenancy, globalPrismaClient } from '@/prisma-client';
10-
import { CustomerType, EmailOutboxCreatedWith, Prisma, PrismaClient, PurchaseCreationSource, SubscriptionStatus } from '@prisma/client';
1111
import { ALL_APPS } from '@stackframe/stack-shared/dist/apps/apps-config';
1212
import { DEFAULT_EMAIL_THEME_ID } from '@stackframe/stack-shared/dist/helpers/emails';
1313
import { AdminUserProjectsCrud, ProjectsCrud } from '@stackframe/stack-shared/dist/interface/crud/projects';
@@ -16,7 +16,7 @@ import { throwErr } from '@stackframe/stack-shared/dist/utils/errors';
1616
import { typedEntries, typedFromEntries } from '@stackframe/stack-shared/dist/utils/objects';
1717
import { generateUuid } from '@stackframe/stack-shared/dist/utils/uuids';
1818

19-
const globalPrisma = new PrismaClient();
19+
const globalPrisma = globalPrismaClient;
2020
const DUMMY_PROJECT_ID = '6fbbf22e-f4b2-4c6e-95a1-beab6fa41063';
2121
const EXPLORATORY_TEAM_DISPLAY_NAME = 'Exploratory Research and Insight Partnership With Very Long Collaborative Name For Testing';
2222

apps/backend/scripts/db-migrations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { applyMigrations } from "@/auto-migrations";
22
import { MIGRATION_FILES_DIR, getMigrationFiles } from "@/auto-migrations/utils";
33
import { globalPrismaClient, globalPrismaSchema, sqlQuoteIdent } from "@/prisma-client";
4-
import { Prisma } from "@prisma/client";
4+
import { Prisma } from "@/generated/prisma/client";
55
import { spawnSync } from "child_process";
66
import fs from "fs";
77
import path from "path";
@@ -74,7 +74,7 @@ const generateMigrationFile = async () => {
7474
const folderName = `${timestampPrefix()}_${migrationName}`;
7575
const migrationDir = path.join(MIGRATION_FILES_DIR, folderName);
7676
const migrationSqlPath = path.join(migrationDir, 'migration.sql');
77-
const diffUrl = getEnvVariable('STACK_DIRECT_DATABASE_CONNECTION_STRING');
77+
const diffUrl = getEnvVariable('STACK_DATABASE_CONNECTION_STRING');
7878

7979
console.log(`Generating migration ${folderName}...`);
8080
const diffResult = spawnSync(

0 commit comments

Comments
 (0)