fix: bundle migration script and ensure file_hash column exists

- Compile src/db/migrate.ts to dist/migrate.js during build
- Copy dist/migrate.js to Stage 2 (runner) inside Dockerfile
- Run bun dist/migrate.js on db:migrate command
- Modify schema.sql to use CREATE TABLE IF NOT EXISTS and ALTER TABLE to add file_hash to existing database instances on VPS

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-05-18 19:46:21 +07:00
co-authored by Claude Opus 4.7
parent b2de5f583d
commit bf6d5f04c4
3 changed files with 11 additions and 7 deletions
+2 -2
View File
@@ -5,9 +5,9 @@
"type": "module",
"scripts": {
"dev": "bun --hot src/index.ts",
"build": "bun build src/index.ts --target=bun --outfile=dist/index.js",
"build": "bun build src/index.ts --target=bun --outfile=dist/index.js && bun build src/db/migrate.ts --target=bun --outfile=dist/migrate.js",
"start": "NODE_ENV=production bun dist/index.js",
"db:migrate": "bun src/db/migrate.ts",
"db:migrate": "bun dist/migrate.js",
"test": "bun test test/rateLimit.test.ts && bun test test/file.test.ts && bun test test/telegram.test.ts && bun test test/upload.test.ts && bun test test/files.test.ts && bun test test/health.test.ts && bun test test/bot.test.ts && bun test test/bootstrap.test.ts && bun test test/swagger.test.ts",
"lint": "bunx biome check src test",
"format": "bunx biome format --write src test"