Add SQL execution tool for administrators to manage database tables

Introduce a new admin-only utility tab allowing direct SQL query execution, file uploads (.sql), and logging of operations. Includes server-side endpoint and client-side UI for executing raw SQL commands against the database.

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/ECRh2Iu
This commit is contained in:
michaelschal committed 2025-09-03 14:11:12 +00:00
1 parent 5b338b224e
commit 2c36650edd
6 files changed
+324 -101

No files matched your search

-56
View File
@@ -1,56 +0,0 @@
#!/bin/bash
# Script de secours pour créer la table webhook_bap_config manuellement
set -e
echo "🔧 [MANUAL-FIX] Création manuelle de la table webhook_bap_config..."
# Vérifier la connection
if ! psql "$DATABASE_URL" -c "SELECT 1;" > /dev/null 2>&1; then
echo "❌ [MANUAL-FIX] Impossible de se connecter à la base de données"
echo "🔍 [MANUAL-FIX] DATABASE_URL: ${DATABASE_URL:0:50}..."
exit 1
fi
echo "✅ [MANUAL-FIX] Connexion à la base de données réussie"
# Créer la table
echo "🔧 [MANUAL-FIX] Création de la table webhook_bap_config..."
psql "$DATABASE_URL" << 'EOF'
-- Création sécurisée de la table
CREATE TABLE IF NOT EXISTS 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
);
-- Insérer la configuration par défaut si pas présente
INSERT INTO webhook_bap_config (name, webhook_url, description, is_active)
SELECT
'Configuration BAP',
'https://workflow.ffnancy.fr/webhook/a3d03176-b72f-412d-8fb9-f920b9fbab4d',
'Configuration par défaut pour envoi des fichiers BAP vers n8n',
true
WHERE NOT EXISTS (SELECT 1 FROM webhook_bap_config);
-- Commentaire
COMMENT ON TABLE webhook_bap_config IS 'Configuration pour webhook BAP n8n';
EOF
if [ $? -eq 0 ]; then
echo "✅ [MANUAL-FIX] Table webhook_bap_config créée avec succès!"
# Vérification
echo "🔍 [MANUAL-FIX] Vérification finale..."
psql "$DATABASE_URL" -c "SELECT COUNT(*) as nb_configs FROM webhook_bap_config;"
psql "$DATABASE_URL" -c "SELECT * FROM webhook_bap_config;"
else
echo "❌ [MANUAL-FIX] Échec de la création de la table"
exit 1
fi
echo "🎉 [MANUAL-FIX] Terminé avec succès!"