Enable automatic database updates for production environments

Adds automatic execution of database migrations, including schema modifications for the Service After-Sales (SAV) module, upon server startup.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/EXHO0Ia
This commit is contained in:
michaelschal committed 2025-08-14 09:24:47 +00:00
1 parent 45abdc5973
commit 37092a95ba
3 files changed
+177

No files matched your search

+5
View File
@@ -6,6 +6,7 @@ import { dirname, join } from 'path';
// Database will be configured in storage.js
import { storage } from "./storage.js";
import { setupLocalAuth, requireAuth } from "./localAuth.production.js";
import { runProductionMigrations } from "./migrations.production.js";
// Get directory paths
const __filename = fileURLToPath(import.meta.url);
@@ -43,6 +44,10 @@ import { registerRoutes } from "./routes.js";
async function registerProductionRoutes(app: Express): Promise<void> {
console.log('🔧 Registering all production routes...');
// Run automatic migrations before registering routes
console.log('🔄 Running automatic production migrations...');
await runProductionMigrations();
// Register ALL API routes (same as development)
await registerRoutes(app);
console.log('✅ All routes registered successfully for production');