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:
michaelschal committed 2025-09-03 13:58:55 +00:00
1 parent c55ec19939
commit 3304d1c912
3 files changed
+36 -17

No files matched your search

+33 -1
View File
@@ -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!"