Skip to content

Commit 377c779

Browse files
Merge pull request #8 from pritpatel2412/feature/admin-panel
fix: Auto-migrate created_at on db connection to fix Vercel crash
2 parents fb8076f + b10b4c7 commit 377c779

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

server/db.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ if (!process.env.DATABASE_URL) {
1111
}
1212

1313
export const pool = new Pool({ connectionString: process.env.DATABASE_URL });
14+
15+
// Auto-migrate created_at for users to prevent Vercel crashes
16+
pool.query(`ALTER TABLE users ADD COLUMN IF NOT EXISTS created_at TIMESTAMP DEFAULT NOW()`).catch(console.error);
17+
1418
export const db = drizzle(pool, { schema });

0 commit comments

Comments
 (0)