Files
Randify.pro/package.json
T
emilandClaude Opus 4.7 e6dec1eb95 fix(deploy): apply drizzle migrations to prod on container startup
The deploy pipeline was building the app image with only `dist/` inside
and rsync'ing only `dist package*.json docker-compose.yml Dockerfile`
to the server. The drizzle migrations folder never reached prod, so
new schema changes (Wave 1 added `tier`, `boosty_verified_at`, and 5
tables) silently went missing. App requests then failed with
"column does not exist" errors at runtime.

Wave-1 CI step `npm run db:migrate` ran against the in-job postgres
service, not against prod — so it never helped.

Changes:
- src/db/migrate.ts -> src/db/migrate.mjs: plain JS so the prod image
  can run it via `node` without devDependencies (no tsx needed).
- Dockerfile: COPY drizzle and src/db/migrate.mjs into the image,
  prepend `node ./src/db/migrate.mjs &&` to the CMD. Container fails
  to start if migrations fail — better than serving with stale schema.
- .github/workflows/deploy.yml: rsync now also sends `drizzle` and
  `src` so the build context on the server has what the Dockerfile
  COPYs reference.
- package.json: `db:migrate` script switched to `node src/db/migrate.mjs`.
- eslint.config.mjs: enable node globals for the migrator script.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 00:29:32 +03:00

56 lines
1.5 KiB
JSON

{
"name": "randify",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"test": "vitest run",
"test:unit": "vitest run",
"test:e2e": "playwright test",
"test:ui": "playwright test",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier --write .",
"format:check": "prettier --check .",
"db:generate": "drizzle-kit generate",
"db:migrate": "node src/db/migrate.mjs",
"db:studio": "drizzle-kit studio"
},
"dependencies": {
"@astrojs/node": "^8.3.4",
"@astrojs/rss": "^4.0.18",
"@astrojs/sitemap": "^3.2.1",
"@tailwindcss/vite": "^4.0.0",
"astro": "^4.16.0",
"drizzle-orm": "^0.45.2",
"jose": "^6.2.3",
"pg": "^8.20.0",
"tailwindcss": "^4.0.0",
"zod": "^3.25.7"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@playwright/test": "^1.60.0",
"@tailwindcss/typography": "^0.5.19",
"@testing-library/dom": "^10.4.1",
"@typescript-eslint/eslint-plugin": "^8.59.2",
"@typescript-eslint/parser": "^8.59.2",
"@vitest/coverage-v8": "^4.1.5",
"drizzle-kit": "^0.31.10",
"eslint": "^10.3.0",
"eslint-plugin-astro": "^1.7.0",
"globals": "^17.6.0",
"happy-dom": "^20.9.0",
"prettier": "^3.8.3",
"prettier-plugin-astro": "^0.14.1",
"tsx": "^4.22.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.59.2",
"vitest": "^4.1.5"
}
}