mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-22 06:28:19 +02:00
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:
1 parent
45abdc5973
commit
37092a95ba
3 files changed
+177
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { Pool } from 'pg';
|
||||
import { drizzle } from 'drizzle-orm/node-postgres';
|
||||
import * as schema from "@shared/schema";
|
||||
import { runProductionMigrations } from './migrations.production.js';
|
||||
|
||||
console.log('🐳 PRODUCTION: Configuring standard PostgreSQL database');
|
||||
|
||||
@@ -36,4 +37,16 @@ pool.on('error', (err) => {
|
||||
console.error('❌ PostgreSQL connection error:', err);
|
||||
});
|
||||
|
||||
// Run migrations automatically when database is configured
|
||||
(async () => {
|
||||
try {
|
||||
console.log('🔄 Running automatic database migrations...');
|
||||
await runProductionMigrations();
|
||||
console.log('✅ Database migrations completed');
|
||||
} catch (error) {
|
||||
console.error('❌ Database migrations failed:', error);
|
||||
// Don't fail the application startup for migration errors
|
||||
}
|
||||
})();
|
||||
|
||||
console.log('✅ Production PostgreSQL database configured');
|
||||
Reference in new issue
Block a user