mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Add stock depletion tracking to DLC products for better inventory management
Apply database migration to add `stock_epuise`, `stock_epuise_by`, and `stock_epuise_at` columns to the `dlc_products` table. Includes a new urgent production fix script to apply the migration and restart the application. Replit-Commit-Author: Agent Replit-Commit-Session-Id: f9197b9b-a5b3-4469-a27d-930a9e9ee736 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/f9197b9b-a5b3-4469-a27d-930a9e9ee736/i2gFnxm
This commit is contained in:
1 parent
f279774f04
commit
3645922bdb
3 files changed
+341
-39
No files matched your search
+41
-27
@@ -1,37 +1,51 @@
|
||||
# 🚨 CORRECTION URGENTE - ERREUR DOCKER ENTRYPOINT
|
||||
# SOLUTION URGENTE - Production DLC
|
||||
|
||||
## Problème actuel
|
||||
Le conteneur Docker ne peut pas démarrer à cause de l'erreur :
|
||||
```
|
||||
exec /app/docker-entrypoint.sh: no such file or directory
|
||||
```
|
||||
## Commande immédiate à exécuter sur votre serveur
|
||||
|
||||
## 🔧 Solution immédiate (1 commande)
|
||||
|
||||
**Créer directement la table announcements :**
|
||||
### Étape 1: Appliquer la migration
|
||||
```bash
|
||||
docker exec logiflow-logiflow-1 psql $DATABASE_URL -c "CREATE TABLE IF NOT EXISTS announcements (id SERIAL PRIMARY KEY, title VARCHAR(255) NOT NULL, content TEXT NOT NULL, priority VARCHAR(20) NOT NULL DEFAULT 'normal', author_id VARCHAR(255) NOT NULL, group_id INTEGER, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), CONSTRAINT announcements_priority_check CHECK (priority IN ('normal', 'important', 'urgent')), CONSTRAINT announcements_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE, CONSTRAINT announcements_group_id_fkey FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE CASCADE);"
|
||||
docker-compose exec logiflow-db psql -U logiflow_admin -d logiflow_db << 'EOF'
|
||||
ALTER TABLE dlc_products
|
||||
ADD COLUMN IF NOT EXISTS stock_epuise boolean DEFAULT false NOT NULL,
|
||||
ADD COLUMN IF NOT EXISTS stock_epuise_by varchar(255),
|
||||
ADD COLUMN IF NOT EXISTS stock_epuise_at timestamp;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_dlc_products_stock_epuise ON dlc_products(stock_epuise);
|
||||
|
||||
SELECT 'Migration DLC terminée' as status;
|
||||
EOF
|
||||
```
|
||||
|
||||
## 🛠️ Correction du Docker (pour arrêter les erreurs)
|
||||
|
||||
**Reconstruire le conteneur avec le Dockerfile corrigé :**
|
||||
### Étape 2: Redémarrer l'application
|
||||
```bash
|
||||
# Arrêter le conteneur actuel
|
||||
docker-compose down
|
||||
|
||||
# Reconstruire sans entrypoint
|
||||
docker-compose up --build -d
|
||||
docker-compose restart logiflow
|
||||
```
|
||||
|
||||
## ✅ Résultat
|
||||
- Table announcements créée
|
||||
- Conteneur Docker fonctionnel
|
||||
- Plus d'erreurs d'entrypoint
|
||||
- Système d'annonces opérationnel
|
||||
## Si la première commande ne fonctionne pas
|
||||
|
||||
## 📋 Vérification
|
||||
### Alternative avec connexion directe:
|
||||
```bash
|
||||
# Vérifier que la table existe
|
||||
docker exec logiflow-logiflow-1 psql $DATABASE_URL -c "SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_name='announcements');"
|
||||
```
|
||||
# Identifier le nom du conteneur PostgreSQL
|
||||
docker ps | grep postgres
|
||||
|
||||
# Se connecter directement
|
||||
docker exec -it [NOM_CONTENEUR_POSTGRES] psql -U logiflow_admin -d logiflow_db
|
||||
|
||||
# Puis dans psql, exécuter:
|
||||
ALTER TABLE dlc_products
|
||||
ADD COLUMN IF NOT EXISTS stock_epuise boolean DEFAULT false NOT NULL,
|
||||
ADD COLUMN IF NOT EXISTS stock_epuise_by varchar(255),
|
||||
ADD COLUMN IF NOT EXISTS stock_epuise_at timestamp;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_dlc_products_stock_epuise ON dlc_products(stock_epuise);
|
||||
|
||||
\q
|
||||
```
|
||||
|
||||
## Vérification
|
||||
Après l'application, vérifiez que les colonnes existent :
|
||||
```bash
|
||||
docker-compose exec logiflow-db psql -U logiflow_admin -d logiflow_db -c "\d dlc_products"
|
||||
```
|
||||
|
||||
L'erreur "column does not exist" disparaîtra immédiatement.
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
Administration
|
||||
|
||||
User-related
|
||||
|
||||
|
||||
Environment-related
|
||||
|
||||
Registries
|
||||
|
||||
Logs
|
||||
|
||||
Notifications
|
||||
|
||||
Settings
|
||||
|
||||
New version available 2.27.9
|
||||
DismissSee what's new
|
||||
Community Edition
|
||||
2.27.6 LTS
|
||||
Containers>logiflow-logiflow-1>Logs
|
||||
Container logs
|
||||
|
||||
|
||||
admin
|
||||
Log viewer settings
|
||||
Auto-refresh logs
|
||||
Wrap lines
|
||||
Display timestamps
|
||||
Fetch
|
||||
All logs
|
||||
Search
|
||||
Filter...
|
||||
Lines
|
||||
100
|
||||
Actions
|
||||
|
||||
|
||||
|
||||
|
||||
userRole: 'admin'
|
||||
|
||||
}
|
||||
|
||||
Admin filtering with groupIds: [ 1 ]
|
||||
|
||||
Fetching all orders
|
||||
|
||||
Deliveries API called with: {
|
||||
|
||||
startDate: undefined,
|
||||
|
||||
endDate: undefined,
|
||||
|
||||
storeId: '1',
|
||||
|
||||
withBL: undefined,
|
||||
|
||||
userRole: 'admin'
|
||||
|
||||
}
|
||||
|
||||
Admin filtering deliveries with groupIds: [ 1 ]
|
||||
|
||||
Fetching all deliveries
|
||||
|
||||
Customer Orders API called with: { groupIds: [ 1 ], userRole: 'admin' }
|
||||
|
||||
Customer Orders returned: 10 items
|
||||
|
||||
GET /api/customer-orders 304 in 63ms
|
||||
|
||||
🔗 PRODUCTION: getOrders() récupéré 33 commandes avec relations
|
||||
|
||||
Orders returned: 33 items
|
||||
|
||||
GET /api/orders 304 in 128ms
|
||||
|
||||
🔗 PRODUCTION: getDeliveries() récupéré 49 livraisons avec relations
|
||||
|
||||
Deliveries returned: 49 items
|
||||
|
||||
GET /api/deliveries 304 in 154ms
|
||||
|
||||
GET /api/groups 304 in 57ms
|
||||
|
||||
GET /api/user 304 in 7ms
|
||||
|
||||
GET /api/suppliers 304 in 9ms
|
||||
|
||||
Error fetching DLC products: error: column dlc_products.stock_epuise 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.getDlcProducts (file:///app/dist/index.js:2187:25)
|
||||
|
||||
at async file:///app/dist/index.js:6178:28 {
|
||||
|
||||
length: 124,
|
||||
|
||||
severity: 'ERROR',
|
||||
|
||||
code: '42703',
|
||||
|
||||
detail: undefined,
|
||||
|
||||
hint: undefined,
|
||||
|
||||
position: '337',
|
||||
|
||||
internalPosition: undefined,
|
||||
|
||||
internalQuery: undefined,
|
||||
|
||||
where: undefined,
|
||||
|
||||
schema: undefined,
|
||||
|
||||
table: undefined,
|
||||
|
||||
column: undefined,
|
||||
|
||||
dataType: undefined,
|
||||
|
||||
constraint: undefined,
|
||||
|
||||
file: 'parse_relation.c',
|
||||
|
||||
line: '3665',
|
||||
|
||||
routine: 'errorMissingColumn'
|
||||
|
||||
}
|
||||
|
||||
GET /api/dlc-products 500 in 19ms
|
||||
|
||||
Error fetching DLC products: error: column dlc_products.stock_epuise 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.getDlcProducts (file:///app/dist/index.js:2187:25)
|
||||
|
||||
at async file:///app/dist/index.js:6178:28 {
|
||||
|
||||
length: 124,
|
||||
|
||||
severity: 'ERROR',
|
||||
|
||||
code: '42703',
|
||||
|
||||
detail: undefined,
|
||||
|
||||
hint: undefined,
|
||||
|
||||
position: '337',
|
||||
|
||||
internalPosition: undefined,
|
||||
|
||||
internalQuery: undefined,
|
||||
|
||||
where: undefined,
|
||||
|
||||
schema: undefined,
|
||||
|
||||
table: undefined,
|
||||
|
||||
column: undefined,
|
||||
|
||||
dataType: undefined,
|
||||
|
||||
constraint: undefined,
|
||||
|
||||
file: 'parse_relation.c',
|
||||
|
||||
line: '3665',
|
||||
|
||||
routine: 'errorMissingColumn'
|
||||
|
||||
}
|
||||
|
||||
GET /api/dlc-products 500 in 27ms
|
||||
|
||||
Error fetching DLC products: error: column dlc_products.stock_epuise 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.getDlcProducts (file:///app/dist/index.js:2187:25)
|
||||
|
||||
at async file:///app/dist/index.js:6178:28 {
|
||||
|
||||
length: 124,
|
||||
|
||||
severity: 'ERROR',
|
||||
|
||||
code: '42703',
|
||||
|
||||
detail: undefined,
|
||||
|
||||
hint: undefined,
|
||||
|
||||
position: '337',
|
||||
|
||||
internalPosition: undefined,
|
||||
|
||||
internalQuery: undefined,
|
||||
|
||||
where: undefined,
|
||||
|
||||
schema: undefined,
|
||||
|
||||
table: undefined,
|
||||
|
||||
column: undefined,
|
||||
|
||||
dataType: undefined,
|
||||
|
||||
constraint: undefined,
|
||||
|
||||
file: 'parse_relation.c',
|
||||
|
||||
line: '3665',
|
||||
|
||||
routine: 'errorMissingColumn'
|
||||
+66
-12
@@ -1,19 +1,73 @@
|
||||
#!/bin/bash
|
||||
# Script d'urgence pour corriger la production immédiatement
|
||||
|
||||
echo "🚨 CORRECTION URGENTE - Création de la table announcements"
|
||||
# Script de correction urgente pour la production
|
||||
# Applique la migration DLC immédiatement
|
||||
|
||||
# Option 1: Copier le fichier SQL dans le conteneur et l'exécuter
|
||||
echo "📋 Copie du script SQL dans le conteneur..."
|
||||
docker cp create_announcements_production.sql logiflow-logiflow-1:/tmp/
|
||||
set -e
|
||||
|
||||
echo "🔧 Exécution du script SQL..."
|
||||
docker exec logiflow-logiflow-1 psql $DATABASE_URL -f /tmp/create_announcements_production.sql
|
||||
echo "🚨 CORRECTION URGENTE - Migration DLC Production"
|
||||
echo "================================================"
|
||||
|
||||
echo "✅ Script exécuté. Vérification..."
|
||||
docker exec logiflow-logiflow-1 psql $DATABASE_URL -c "SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_name='announcements') as table_exists;"
|
||||
# Vérifier que Docker Compose est disponible
|
||||
if ! command -v docker-compose &> /dev/null; then
|
||||
echo "❌ docker-compose non trouvé"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🎯 Redémarrage de l'application..."
|
||||
docker restart logiflow-logiflow-1
|
||||
# Vérifier que le conteneur PostgreSQL est en cours d'exécution
|
||||
if ! docker-compose ps | grep -q logiflow-db; then
|
||||
echo "❌ Conteneur logiflow-db non trouvé"
|
||||
echo "Containers disponibles:"
|
||||
docker-compose ps
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ CORRECTION TERMINÉE"
|
||||
echo "✅ Conteneur PostgreSQL trouvé"
|
||||
|
||||
# Appliquer la migration DLC
|
||||
echo "🔄 Application de la migration DLC..."
|
||||
|
||||
docker-compose exec -T logiflow-db psql -U logiflow_admin -d logiflow_db << 'EOF'
|
||||
-- Migration DLC Stock Épuisé
|
||||
ALTER TABLE dlc_products
|
||||
ADD COLUMN IF NOT EXISTS stock_epuise boolean DEFAULT false NOT NULL,
|
||||
ADD COLUMN IF NOT EXISTS stock_epuise_by varchar(255),
|
||||
ADD COLUMN IF NOT EXISTS stock_epuise_at timestamp;
|
||||
|
||||
-- Index pour performance
|
||||
CREATE INDEX IF NOT EXISTS idx_dlc_products_stock_epuise ON dlc_products(stock_epuise);
|
||||
|
||||
-- Vérification
|
||||
SELECT 'Migration DLC appliquée avec succès' as status;
|
||||
|
||||
-- Afficher les colonnes ajoutées
|
||||
SELECT column_name, data_type
|
||||
FROM information_schema.columns
|
||||
WHERE table_name = 'dlc_products'
|
||||
AND column_name LIKE '%stock_epuise%'
|
||||
ORDER BY column_name;
|
||||
EOF
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Migration DLC appliquée avec succès"
|
||||
else
|
||||
echo "❌ Erreur lors de la migration"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Redémarrer l'application
|
||||
echo "🔄 Redémarrage de l'application..."
|
||||
docker-compose restart logiflow
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Application redémarrée"
|
||||
else
|
||||
echo "❌ Erreur lors du redémarrage"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🎉 CORRECTION TERMINÉE"
|
||||
echo "L'erreur 'column does not exist' devrait maintenant être résolue"
|
||||
echo ""
|
||||
echo "Vérifiez dans les logs que l'API /api/dlc-products fonctionne maintenant"
|
||||
Reference in new issue
Block a user