mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Update storage logic to use database when available
Modify server/storage.ts to prioritize DatabaseStorage when DATABASE_URL is set, falling back to MemStorage otherwise. Includes updated logging to reflect this logic. Also adds attached reports detailing PostgreSQL production database schema and contents. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 1e4433b5-47ab-464c-b663-fea2e53367dd Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/1e4433b5-47ab-464c-b663-fea2e53367dd/AVGwNHS
This commit is contained in:
1 parent
c975871110
commit
c675429634
4 files changed
+1293
-6
No files matched your search
+7
-6
@@ -4633,18 +4633,19 @@ export class MemStorage implements IStorage {
|
||||
}
|
||||
}
|
||||
|
||||
// Use MemStorage in development, DatabaseStorage in production
|
||||
// Use DatabaseStorage when DATABASE_URL is available, MemStorage as fallback
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
const hasDatabase = !!process.env.DATABASE_URL;
|
||||
console.log('🔗 Database initialization:', {
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
isProduction: isProduction,
|
||||
hasDbUrl: !!process.env.DATABASE_URL,
|
||||
hasDbUrl: hasDatabase,
|
||||
dbHost: process.env.DATABASE_URL?.split('@')[1]?.split('/')[0] || 'unknown'
|
||||
});
|
||||
|
||||
export const storage: IStorage = isProduction ? new DatabaseStorage() : new MemStorage();
|
||||
if (isProduction) {
|
||||
console.log('✅ Using DatabaseStorage (production PostgreSQL)');
|
||||
export const storage: IStorage = hasDatabase ? new DatabaseStorage() : new MemStorage();
|
||||
if (hasDatabase) {
|
||||
console.log('✅ Using DatabaseStorage (PostgreSQL database detected)');
|
||||
} else {
|
||||
console.log('🔧 DEV: Using MemStorage (development fallback)');
|
||||
console.log('🔧 DEV: Using MemStorage (no database URL found)');
|
||||
}
|
||||
Reference in new issue
Block a user