Fix jwt-token
This commit is contained in:
@@ -169,20 +169,24 @@ async function startServer() {
|
||||
console.log('Database force synchronized.');
|
||||
}
|
||||
|
||||
// STEP 2: Run migrations after tables exist
|
||||
try {
|
||||
await runMigrations();
|
||||
} catch (migrationError) {
|
||||
console.error('Migration error:', migrationError);
|
||||
throw migrationError; // Fatal error - don't continue
|
||||
}
|
||||
|
||||
// STEP 3: Seed database with initial data
|
||||
try {
|
||||
await seedDatabase();
|
||||
} catch (seedError) {
|
||||
console.error('Seeding error:', seedError);
|
||||
throw seedError; // Fatal error - don't continue
|
||||
// STEP 2: Run migrations after tables exist (skip if DB_INITIALIZED is set)
|
||||
if (!process.env.DB_INITIALIZED) {
|
||||
try {
|
||||
await runMigrations();
|
||||
} catch (migrationError) {
|
||||
console.error('Migration error:', migrationError);
|
||||
throw migrationError; // Fatal error - don't continue
|
||||
}
|
||||
|
||||
// STEP 3: Seed database with initial data
|
||||
try {
|
||||
await seedDatabase();
|
||||
} catch (seedError) {
|
||||
console.error('Seeding error:', seedError);
|
||||
throw seedError; // Fatal error - don't continue
|
||||
}
|
||||
} else {
|
||||
console.log('ℹ️ Database already initialized by setup script, skipping migrations and seeding');
|
||||
}
|
||||
|
||||
server.listen(PORT, () => {
|
||||
|
||||
Reference in New Issue
Block a user