mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Add SQL script to create missing webhook configuration table
Add SQL script `fix-webhook-bap-FINAL.sql` and shell script `scripts/manual-create-webhook-table.sh` to address the `relation "webhook_bap_config" does not exist` error by creating and populating the `webhook_bap_config` table. 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
ac9622233a
commit
4ef702f44b
3 files changed
+298
No files matched your search
+201
@@ -0,0 +1,201 @@
|
||||
|
||||
|
||||
{
|
||||
|
||||
id: 8,
|
||||
|
||||
title: 'Bon de Livraison',
|
||||
|
||||
content: 'Lorsque vous rentrez un numéro de bon de livraison, faite le a l identique, même les majuscules. Pour My candy Shop, prendre le numéro de commande.',
|
||||
|
||||
type: 'info',
|
||||
|
||||
storeId: null,
|
||||
|
||||
createdBy: 'admin_local',
|
||||
|
||||
createdAt: 2025-08-07T11:04:38.123Z
|
||||
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
🔍 [PRODUCTION] Looking for user with username: admin
|
||||
|
||||
🔍 [PRODUCTION] Looking for user with username: admin_local
|
||||
|
||||
Customer Orders API called with: { groupIds: [ 1 ], userRole: 'admin' }
|
||||
|
||||
🔍 [PRODUCTION] User search result: Found
|
||||
|
||||
🔍 [PRODUCTION] User search result: Not found
|
||||
|
||||
🎯 [PRODUCTION] Found announcements: 2
|
||||
|
||||
❌ [PRODUCTION] User not found with username: admin_local
|
||||
|
||||
GET /api/announcements 304 in 103ms
|
||||
|
||||
Customer Orders returned: 7 items
|
||||
|
||||
GET /api/customer-orders 304 in 108ms
|
||||
|
||||
🔗 PRODUCTION: getDeliveries() récupéré 72 livraisons avec relations
|
||||
|
||||
Deliveries returned: 72 items
|
||||
|
||||
GET /api/deliveries 304 in 171ms
|
||||
|
||||
GET /api/groups 304 in 109ms
|
||||
|
||||
GET /api/user 304 in 4ms
|
||||
|
||||
GET /api/user 304 in 6ms
|
||||
|
||||
GET /api/backups 304 in 8ms
|
||||
|
||||
⚠️ Table webhook_bap_config n'existe pas, retour config par défaut
|
||||
|
||||
GET /api/webhook-bap-config 304 in 7ms
|
||||
|
||||
❌ Erreur récupération config webhook BAP: error: relation "webhook_bap_config" does not exist
|
||||
|
||||
at /app/node_modules/pg-pool/index.js:45:11
|
||||
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
||||
|
||||
at async file:///app/node_modules/drizzle-orm/node-postgres/session.js:83:22
|
||||
|
||||
at async DatabaseStorage.getWebhookBapConfig (file:///app/dist/index.js:2815:26)
|
||||
|
||||
at async file:///app/dist/index.js:12402:22 {
|
||||
|
||||
length: 117,
|
||||
|
||||
severity: 'ERROR',
|
||||
|
||||
code: '42P01',
|
||||
|
||||
detail: undefined,
|
||||
|
||||
hint: undefined,
|
||||
|
||||
position: '97',
|
||||
|
||||
internalPosition: undefined,
|
||||
|
||||
internalQuery: undefined,
|
||||
|
||||
where: undefined,
|
||||
|
||||
schema: undefined,
|
||||
|
||||
table: undefined,
|
||||
|
||||
column: undefined,
|
||||
|
||||
dataType: undefined,
|
||||
|
||||
constraint: undefined,
|
||||
|
||||
file: 'parse_relation.c',
|
||||
|
||||
line: '1392',
|
||||
|
||||
routine: 'parserOpenTable'
|
||||
|
||||
}
|
||||
|
||||
HEAD /api/health 200 in 1ms
|
||||
|
||||
🔍 Test webhook BAP: {
|
||||
|
||||
url: 'https://workflow.ffnancy.fr/webhook-test/a3d03176-b72f-412d-8fb9-f920b9fbab4d'
|
||||
|
||||
}
|
||||
|
||||
🌐 Réponse test webhook: { status: 404, ok: false }
|
||||
|
||||
POST /api/webhook-bap-config/test 500 in 86ms
|
||||
|
||||
❌ Erreur test webhook BAP: Error: HTTP 404: Not Found
|
||||
|
||||
at file:///app/dist/index.js:12481:15
|
||||
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
||||
|
||||
🔍 Test webhook BAP: {
|
||||
|
||||
url: 'https://workflow.ffnancy.fr/webhook-test/a3d03176-b72f-412d-8fb9-f920b9fbab4d'
|
||||
|
||||
}
|
||||
|
||||
🌐 Réponse test webhook: { status: 500, ok: false }
|
||||
|
||||
❌ Erreur test webhook BAP: Error: HTTP 500: Internal Server Error
|
||||
|
||||
at file:///app/dist/index.js:12481:15
|
||||
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
||||
|
||||
POST /api/webhook-bap-config/test 500 in 72ms
|
||||
|
||||
HEAD /api/health 200 in 0ms
|
||||
|
||||
❌ Erreur sauvegarde config webhook BAP: error: relation "webhook_bap_config" does not exist
|
||||
|
||||
at /app/node_modules/pg-pool/index.js:45:11
|
||||
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
||||
|
||||
at async file:///app/node_modules/drizzle-orm/node-postgres/session.js:83:22
|
||||
|
||||
at async DatabaseStorage.getWebhookBapConfig (file:///app/dist/index.js:2815:26)
|
||||
|
||||
at async file:///app/dist/index.js:12431:30 {
|
||||
|
||||
length: 117,
|
||||
|
||||
severity: 'ERROR',
|
||||
|
||||
code: '42P01',
|
||||
|
||||
detail: undefined,
|
||||
|
||||
hint: undefined,
|
||||
|
||||
position: '97',
|
||||
|
||||
internalPosition: undefined,
|
||||
|
||||
internalQuery: undefined,
|
||||
|
||||
where: undefined,
|
||||
|
||||
schema: undefined,
|
||||
|
||||
table: undefined,
|
||||
|
||||
column: undefined,
|
||||
|
||||
dataType: undefined,
|
||||
|
||||
constraint: undefined,
|
||||
|
||||
file: 'parse_relation.c',
|
||||
|
||||
line: '1392',
|
||||
|
||||
routine: 'parserOpenTable'
|
||||
|
||||
}
|
||||
|
||||
POST /api/webhook-bap-config 500 in 6ms
|
||||
|
||||
HEAD /api/health 200 in 1ms
|
||||
|
||||
HEAD /api/health 200 in 0ms
|
||||
|
||||
HEAD /api/health 200 in 0ms
|
||||
|
||||
HEAD /api/health 200 in 1ms
|
||||
@@ -0,0 +1,41 @@
|
||||
-- Script SQL DEFINITIF à exécuter manuellement sur votre base PostgreSQL de production
|
||||
-- Usage: psql -U postgres -d votre_base -f fix-webhook-bap-FINAL.sql
|
||||
|
||||
-- Vérifier si la table existe déjà
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT FROM information_schema.tables WHERE table_schema='public' AND table_name='webhook_bap_config') THEN
|
||||
RAISE NOTICE 'Création de la table webhook_bap_config...';
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
-- Insérer la configuration par défaut
|
||||
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';
|
||||
|
||||
RAISE NOTICE 'Table webhook_bap_config créée avec succès!';
|
||||
ELSE
|
||||
RAISE NOTICE 'Table webhook_bap_config existe déjà.';
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- Vérification finale
|
||||
SELECT 'Vérification: Table webhook_bap_config' AS check_table;
|
||||
SELECT COUNT(*) AS nb_configs FROM webhook_bap_config;
|
||||
SELECT * FROM webhook_bap_config;
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/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!"
|
||||
Reference in new issue
Block a user