Makes schema changes deploy automatically: edit schema -> db:generate -> commit -> push -> Dokploy redeploys -> migrations apply on container start. No more Dokploy database terminal. Components: - src/db/migrate.ts: standalone migrator (single short-lived connection, fails loud on error so a bad migration crashes the container instead of letting the app serve a half-migrated schema) - scripts/build-migrator.mjs: esbuild bundles migrate.ts -> dist/migrate.mjs with drizzle-orm + postgres inlined. Needed because Next.js standalone output keeps neither as a separate node_modules package. - Dockerfile: builder runs db:build-migrator; runner copies migrate.mjs + drizzle/; CMD is 'node migrate.mjs && node server.js' - package.json: db:generate / db:migrate / db:studio / db:pull / db:build-migrator scripts; esbuild promoted to an explicit devDependency - pnpm-lock.yaml resynced BUG FIX: .dockerignore had 'drizzle/' — migration SQL was excluded from the build context, so even a correct Dockerfile COPY would have found nothing. This was the second half (with the .gitignore bug in commit 1) of why the migration pipeline never worked. Now only _archived/_introspected are excluded. Verified: full docker build succeeds; runner image contains migrate.mjs + drizzle baseline; migrator tested end-to-end against a scratch DB (35 tables created, __drizzle_migrations populated, idempotent on rerun).
54 lines
1.4 KiB
JSON
54 lines
1.4 KiB
JSON
{
|
|
"name": "tia",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"scripts": {
|
|
"dev": "next dev",
|
|
"build": "next build",
|
|
"start": "next start",
|
|
"db:generate": "drizzle-kit generate",
|
|
"db:migrate": "tsx src/db/migrate.ts",
|
|
"db:studio": "drizzle-kit studio",
|
|
"db:pull": "drizzle-kit pull",
|
|
"db:build-migrator": "node scripts/build-migrator.mjs"
|
|
},
|
|
"dependencies": {
|
|
"@auth/drizzle-adapter": "^1.11.2",
|
|
"@aws-sdk/client-s3": "^3.1045.0",
|
|
"@aws-sdk/s3-request-presigner": "^3.1045.0",
|
|
"@react-pdf/renderer": "^4.5.1",
|
|
"bcryptjs": "^3.0.3",
|
|
"chart.js": "^4.5.1",
|
|
"date-fns": "^4.1.0",
|
|
"drizzle-orm": "^0.45.2",
|
|
"framer-motion": "^12.38.0",
|
|
"nanoid": "^5.1.11",
|
|
"next": "16.2.6",
|
|
"next-auth": "5.0.0-beta.31",
|
|
"next-pwa": "^5.6.0",
|
|
"nodemailer": "^7.0.13",
|
|
"openai": "^6.37.0",
|
|
"postgres": "^3.4.9",
|
|
"rate-limiter-flexible": "^11.1.0",
|
|
"react": "19.2.4",
|
|
"react-chartjs-2": "^5.3.1",
|
|
"react-dom": "19.2.4",
|
|
"recharts": "^3.8.1",
|
|
"resend": "^6.12.3",
|
|
"sharp": "^0.34.5",
|
|
"zod": "^4.4.3"
|
|
},
|
|
"devDependencies": {
|
|
"@tailwindcss/postcss": "^4",
|
|
"@types/bcryptjs": "^3.0.0",
|
|
"@types/node": "^20",
|
|
"@types/react": "^19",
|
|
"@types/react-dom": "^19",
|
|
"@types/sharp": "^0.32.0",
|
|
"drizzle-kit": "^0.31.10",
|
|
"esbuild": "^0.25.12",
|
|
"tailwindcss": "^4",
|
|
"tsx": "^4.21.0",
|
|
"typescript": "^5"
|
|
}
|
|
}
|