package.json > create deploy script

This commit is contained in:
2026-07-31 09:31:13 +02:00
parent bac93c853a
commit 587ace3366
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -22,4 +22,4 @@
7. **ONE-TIME, before ever running `prisma migrate deploy` on this server:** the o2switch database already has the `conversion_jobs` table (created by hand, before this project used Prisma), but no `_prisma_migrations` tracking table. Running `migrate deploy` first would try to `CREATE TABLE conversion_jobs` again and fail with a "table already exists" MySQL error, leaving Prisma's migration history stuck and needing manual recovery. Avoid that by baselining the existing table once, ever, on this server, before step 8's `migrate deploy` runs for the first time:
`DATABASE_URL=$(node scripts/printDatabaseUrl.js) npx prisma migrate resolve --applied 0_init`
Do **not** repeat this step on later deployments — after this one-time run, `migrate deploy` (step 8) is the correct command going forward.
8. On every subsequent deployment: pull changes, `npm install`, apply any pending migrations with `DATABASE_URL=$(node scripts/printDatabaseUrl.js) npx prisma migrate deploy`, `npm run build` (frontend), then restart the Passenger app from cPanel and `pm2 restart convert-worker`.
8. On every subsequent deployment: pull changes, `npm run deploy`
+4 -1
View File
@@ -9,7 +9,10 @@
"cleanup": "node src/cleanup.js",
"test": "vitest run",
"build": "npm install --prefix frontend --include=dev && npm run build --prefix frontend",
"postinstall": "./node_modules/.bin/prisma generate --schema=\"$INIT_CWD/prisma/schema.prisma\""
"prisma-generate": "./node_modules/.bin/prisma generate --schema=\"$INIT_CWD/prisma/schema.prisma\"",
"prisma-migration": "DATABASE_URL=$(node scripts/printDatabaseUrl.js) npx prisma migrate deploy",
"worker-restart": "./node_modules/.bin/pm2 restart convert-worker",
"deploy": "npm install --include=dev && npm run prisma-migration && npm run build && npm run worker-restart"
},
"dependencies": {
"@prisma/client": "^6.19.3",