mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-24 15:38:18 +02:00
8 files changed
+632
-6
No files matched your search
@@ -37,4 +37,4 @@ args = "npm run dev"
|
|||||||
waitForPort = 5000
|
waitForPort = 5000
|
||||||
|
|
||||||
[agent]
|
[agent]
|
||||||
integrations = ["javascript_object_storage==1.0.0", "javascript_database==1.0.0", "javascript_log_in_with_replit==1.0.0"]
|
integrations = ["javascript_database==1.0.0", "javascript_object_storage==1.0.0", "javascript_log_in_with_replit==1.0.0"]
|
||||||
+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
|
||||||
+201
@@ -0,0 +1,201 @@
|
|||||||
|
|
||||||
|
|
||||||
|
storeId: null,
|
||||||
|
|
||||||
|
createdBy: 'admin',
|
||||||
|
|
||||||
|
createdAt: 2025-08-18T10:45:08.585Z
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
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
|
||||||
@@ -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;
|
||||||
Executable → Regular
+67
-3
@@ -54,16 +54,47 @@ if [ -f "/app/scripts/auto-migrate-production.sh" ]; then
|
|||||||
log "📂 Script de migration trouvé, exécution..."
|
log "📂 Script de migration trouvé, exécution..."
|
||||||
chmod +x /app/scripts/auto-migrate-production.sh
|
chmod +x /app/scripts/auto-migrate-production.sh
|
||||||
|
|
||||||
if /app/scripts/auto-migrate-production.sh; then
|
# Forcer l'affichage des logs du script de migration
|
||||||
|
log "🔄 Démarrage des migrations avec logs détaillés..."
|
||||||
|
if /app/scripts/auto-migrate-production.sh 2>&1; then
|
||||||
log "✅ Migrations exécutées avec succès"
|
log "✅ Migrations exécutées avec succès"
|
||||||
else
|
else
|
||||||
log "❌ Erreur lors des migrations"
|
log "❌ Erreur lors des migrations, mais continuation..."
|
||||||
exit 1
|
# Ne pas exit pour éviter de bloquer le démarrage
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log "⚠️ Script de migration non trouvé à /app/scripts/auto-migrate-production.sh"
|
log "⚠️ Script de migration non trouvé à /app/scripts/auto-migrate-production.sh"
|
||||||
log "🔍 Contenu du répertoire scripts:"
|
log "🔍 Contenu du répertoire scripts:"
|
||||||
ls -la /app/scripts/ || echo "Répertoire scripts non trouvé"
|
ls -la /app/scripts/ || echo "Répertoire scripts non trouvé"
|
||||||
|
|
||||||
|
# Créer la table webhook_bap_config directement si le script manque
|
||||||
|
log "🛠️ Tentative de création directe de la table webhook_bap_config..."
|
||||||
|
if [ -n "$DATABASE_URL" ]; then
|
||||||
|
psql "$DATABASE_URL" << 'EOF'
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
COMMENT ON TABLE webhook_bap_config IS 'Configuration pour webhook BAP n8n';
|
||||||
|
EOF
|
||||||
|
log "✅ Table webhook_bap_config créée directement"
|
||||||
|
else
|
||||||
|
log "❌ DATABASE_URL manquante pour création directe"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Vérification post-migration
|
# Vérification post-migration
|
||||||
@@ -81,6 +112,39 @@ ADD COLUMN IF NOT EXISTS stock_epuise_by varchar(255),
|
|||||||
ADD COLUMN IF NOT EXISTS stock_epuise_at timestamp;
|
ADD COLUMN IF NOT EXISTS stock_epuise_at timestamp;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_dlc_products_stock_epuise ON dlc_products(stock_epuise);
|
CREATE INDEX IF NOT EXISTS idx_dlc_products_stock_epuise ON dlc_products(stock_epuise);
|
||||||
|
EOF
|
||||||
|
|
||||||
|
log "✅ Migration directe DLC terminée"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Vérification de la table webhook_bap_config
|
||||||
|
log "🔍 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 "t"; then
|
||||||
|
log "✅ Table webhook_bap_config présente"
|
||||||
|
else
|
||||||
|
log "❌ Table webhook_bap_config manquante"
|
||||||
|
log "🛠️ Création directe 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
|
||||||
|
);
|
||||||
|
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
|
COMMENT ON TABLE webhook_bap_config IS 'Configuration pour webhook BAP n8n';
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
|||||||
@@ -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!"
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
import { sql } from 'drizzle-orm';
|
||||||
|
import { db } from './db.js';
|
||||||
|
|
||||||
|
export async function ensureWebhookBapConfigTable() {
|
||||||
|
console.log('🔧 [STARTUP] Vérification table webhook_bap_config...');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Vérifier si la table existe
|
||||||
|
const tableExists = await db.execute(sql`
|
||||||
|
SELECT EXISTS (
|
||||||
|
SELECT FROM information_schema.tables
|
||||||
|
WHERE table_schema='public' AND table_name='webhook_bap_config'
|
||||||
|
);
|
||||||
|
`);
|
||||||
|
|
||||||
|
const exists = tableExists.rows[0]?.exists;
|
||||||
|
|
||||||
|
if (exists) {
|
||||||
|
console.log('✅ [STARTUP] Table webhook_bap_config existe déjà');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('🔧 [STARTUP] Création de la table webhook_bap_config...');
|
||||||
|
|
||||||
|
// Créer la table
|
||||||
|
await db.execute(sql`
|
||||||
|
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
|
||||||
|
await db.execute(sql`
|
||||||
|
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
|
||||||
|
);
|
||||||
|
`);
|
||||||
|
|
||||||
|
// Ajouter un commentaire
|
||||||
|
await db.execute(sql`
|
||||||
|
COMMENT ON TABLE webhook_bap_config IS 'Configuration pour webhook BAP n8n';
|
||||||
|
`);
|
||||||
|
|
||||||
|
console.log('✅ [STARTUP] Table webhook_bap_config créée avec succès!');
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ [STARTUP] Erreur lors de la création de la table webhook_bap_config:', error);
|
||||||
|
// Ne pas arrêter l'application si la création échoue
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-2
@@ -2,8 +2,11 @@ import express, { type Request, Response, NextFunction } from "express";
|
|||||||
import { registerRoutes } from "./routes.js";
|
import { registerRoutes } from "./routes.js";
|
||||||
import { setupVite, serveStatic } from "./vite.js";
|
import { setupVite, serveStatic } from "./vite.js";
|
||||||
|
|
||||||
// Les migrations sont gérées par docker-entrypoint.sh -> auto-migrate-production.sh
|
// Forcer la création de la table webhook_bap_config au démarrage de l'application
|
||||||
console.log('ℹ️ [STARTUP] Migrations gérées par le script Docker au démarrage du conteneur');
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
const { ensureWebhookBapConfigTable } = await import('./createWebhookTable.js');
|
||||||
|
await ensureWebhookBapConfigTable();
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize weather system
|
// Initialize weather system
|
||||||
console.log('🌤️ [STARTUP] Initializing weather system...');
|
console.log('🌤️ [STARTUP] Initializing weather system...');
|
||||||
|
|||||||
Reference in new issue
Block a user