Add auto-migration on server startup
Run Drizzle migrations before seeding admin user so tables exist on fresh database. Migration files generated from current schema. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import { auth } from './routes/auth';
|
||||
import { savesRouter } from './routes/saves';
|
||||
import { leaderboardRouter } from './routes/leaderboard';
|
||||
import { invitesRouter } from './routes/invites';
|
||||
import { runMigrations } from './db';
|
||||
import { seedAdmin } from './db/seed';
|
||||
|
||||
if (!process.env.JWT_SECRET) {
|
||||
@@ -40,6 +41,7 @@ const port = Number(process.env.PORT) || 3001;
|
||||
|
||||
console.log(`AI Tycoon API server starting on port ${port}...`);
|
||||
|
||||
await runMigrations();
|
||||
await seedAdmin();
|
||||
|
||||
serve({ fetch: app.fetch, port });
|
||||
|
||||
Reference in New Issue
Block a user