mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Add automatic creation of webhook configuration table during database migration
Modify the auto-migrate script to check for and create the `webhook_bap_config` table if it does not exist, including a default entry and description. Remove explicit migration calls from `server/index.ts` as they are now handled by the Docker entrypoint script. Replit-Commit-Author: Agent Replit-Commit-Session-Id: cfbfe47c-0c9a-4ebf-8a41-2937407eccff Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/cfbfe47c-0c9a-4ebf-8a41-2937407eccff/qkkp1hi
This commit is contained in:
1 parent
c55ec19939
commit
3304d1c912
3 files changed
+36
-17
No files matched your search
@@ -37,4 +37,4 @@ args = "npm run dev"
|
||||
waitForPort = 5000
|
||||
|
||||
[agent]
|
||||
integrations = ["javascript_database==1.0.0", "javascript_log_in_with_replit==1.0.0", "javascript_object_storage==1.0.0"]
|
||||
integrations = ["javascript_object_storage==1.0.0", "javascript_database==1.0.0", "javascript_log_in_with_replit==1.0.0"]
|
||||
Executable → Regular
+33
-1
@@ -79,4 +79,36 @@ else
|
||||
echo "ℹ️ [AUTO-MIGRATE] Colonnes stock épuisé existent déjà"
|
||||
fi
|
||||
|
||||
echo "✅ [AUTO-MIGRATE] Migration terminée!"
|
||||
# Vérifier si la table webhook_bap_config existe
|
||||
echo "🔄 [AUTO-MIGRATE] Vérification de la table webhook_bap_config..."
|
||||
if psql "$DATABASE_URL" -tAc "SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_schema='public' AND table_name='webhook_bap_config');" | grep -q "f"; then
|
||||
echo "🔧 [AUTO-MIGRATE] Création de la table webhook_bap_config..."
|
||||
psql "$DATABASE_URL" << 'EOF'
|
||||
CREATE TABLE webhook_bap_config (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(100) NOT NULL DEFAULT 'Configuration BAP',
|
||||
webhook_url TEXT NOT NULL,
|
||||
description TEXT,
|
||||
is_active BOOLEAN NOT NULL DEFAULT true,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Configuration par défaut webhook BAP
|
||||
INSERT INTO webhook_bap_config (name, webhook_url, description, is_active)
|
||||
VALUES (
|
||||
'Configuration BAP',
|
||||
'https://workflow.ffnancy.fr/webhook/a3d03176-b72f-412d-8fb9-f920b9fbab4d',
|
||||
'Configuration par défaut pour envoi des fichiers BAP vers n8n',
|
||||
true
|
||||
);
|
||||
|
||||
-- Commentaire sur la table
|
||||
COMMENT ON TABLE webhook_bap_config IS 'Configuration pour webhook BAP n8n';
|
||||
EOF
|
||||
echo "✅ [AUTO-MIGRATE] Table webhook_bap_config créée avec succès"
|
||||
else
|
||||
echo "ℹ️ [AUTO-MIGRATE] Table webhook_bap_config existe déjà - aucune action nécessaire"
|
||||
fi
|
||||
|
||||
echo "✅ [AUTO-MIGRATE] Migration terminée avec succès - webhook_bap_config incluse!"
|
||||
+2
-15
@@ -2,21 +2,8 @@ import express, { type Request, Response, NextFunction } from "express";
|
||||
import { registerRoutes } from "./routes.js";
|
||||
import { setupVite, serveStatic } from "./vite.js";
|
||||
|
||||
// Run database migrations first - FORCER EN PRODUCTION
|
||||
console.log('🔄 [STARTUP] Running database migrations...');
|
||||
console.log('🔍 [STARTUP] Environment:', process.env.NODE_ENV);
|
||||
console.log('🔍 [STARTUP] Has DATABASE_URL:', !!process.env.DATABASE_URL);
|
||||
|
||||
try {
|
||||
const { runMigrations } = await import('./migrations.js');
|
||||
await runMigrations();
|
||||
console.log('✅ [STARTUP] Database migrations completed');
|
||||
} catch (error) {
|
||||
console.error('❌ [STARTUP] Database migrations failed:', error);
|
||||
console.error('❌ [STARTUP] Error details:', JSON.stringify(error, null, 2));
|
||||
// NE PAS arrêter l'app pour éviter les boucles de redémarrage
|
||||
console.warn('⚠️ [STARTUP] Continuing without migrations to avoid restart loop');
|
||||
}
|
||||
// Les migrations sont gérées par docker-entrypoint.sh -> auto-migrate-production.sh
|
||||
console.log('ℹ️ [STARTUP] Migrations gérées par le script Docker au démarrage du conteneur');
|
||||
|
||||
// Initialize weather system
|
||||
console.log('🌤️ [STARTUP] Initializing weather system...');
|
||||
|
||||
Reference in new issue
Block a user