Fix jwt-token

This commit is contained in:
2025-09-20 23:11:57 +02:00
parent 4df5a628de
commit b74772f71d
3 changed files with 58 additions and 24 deletions

View File

@@ -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, () => {