Provide instructions to create missing database table for announcements

Add a new SQL script and documentation to guide users in creating the `announcements` table in their production environment to resolve the "relation does not exist" error.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce/biGr9ER
This commit is contained in:
michaelschal committed 2025-08-16 11:22:40 +00:00
1 parent 506b7681d0
commit e8007d52b1
3 files changed
+352

No files matched your search

+68
View File
@@ -0,0 +1,68 @@
# 🚨 SOLUTION IMMÉDIATE POUR LA PRODUCTION
## Problème
La table `announcements` n'existe pas dans votre base de données de production, ce qui cause l'erreur:
```
Error: relation "announcements" does not exist
```
## Solution en 3 étapes simples
### 1. Connectez-vous à votre serveur de production
```bash
# SSH vers votre serveur
ssh votre-serveur-production
```
### 2. Accédez au conteneur Docker
```bash
# Entrer dans le conteneur
docker exec -it logiflow-logiflow-1 bash
```
### 3. Créer la table directement
```bash
# Dans le conteneur, exécuter cette commande :
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
);
CREATE INDEX IF NOT EXISTS idx_announcements_priority ON announcements(priority);
CREATE INDEX IF NOT EXISTS idx_announcements_created_at ON announcements(created_at DESC);
CREATE INDEX IF NOT EXISTS idx_announcements_author_id ON announcements(author_id);
CREATE INDEX IF NOT EXISTS idx_announcements_group_id ON announcements(group_id);
"
```
### 4. Vérifier que ça fonctionne
```bash
# Vérifier que la table existe
psql $DATABASE_URL -c "SELECT 'SUCCESS: Table announcements créée!' as status;"
```
### 5. Sortir du conteneur
```bash
exit
```
## Résultat attendu
Après ces étapes, le système d'annonces fonctionnera immédiatement sur votre production.
## Alternative plus simple (une seule commande)
Si vous préférez, vous pouvez exécuter directement depuis votre serveur :
```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);"
```
La correction du problème `Select.Item` value est déjà faite dans le code source.
@@ -0,0 +1,242 @@
Host
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
GET /api/customer-orders 200 in 830ms
GET /api/publicities 200 in 825ms
GET /api/tasks 200 in 814ms
🌤️ [RESPONSE] Weather data prepared: {
hasCurrentYear: true,
hasPreviousYear: true,
location: 'Frouard, France'
}
GET /api/weather/current 200 in 883ms
GET /api/dlc-products/stats 200 in 843ms
Orders API called with: {
startDate: undefined,
endDate: undefined,
storeId: '1',
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
GET /api/groups 200 in 464ms
Customer Orders API called with: { groupIds: [ 1 ], userRole: 'admin' }
📊 Statistiques calculées: {
ordersCount: 20,
deliveriesCount: 42,
pendingOrdersCount: 8,
averageDeliveryTime: 0.3611111111111111,
totalPalettes: 120,
totalPackages: 36
}
GET /api/stats/monthly 200 in 937ms
🔗 PRODUCTION: getDeliveries() récupéré 86 livraisons avec relations
Deliveries returned: 86 items
GET /api/deliveries 200 in 1014ms
🔗 PRODUCTION: getOrders() récupéré 33 commandes avec relations
Orders returned: 33 items
GET /api/orders 200 in 557ms
Customer Orders returned: 10 items
GET /api/customer-orders 200 in 197ms
🔗 PRODUCTION: getDeliveries() récupéré 48 livraisons avec relations
Deliveries returned: 48 items
GET /api/deliveries 200 in 237ms
GET /api/publicities 200 in 206ms
Error fetching announcements: error: relation "announcements" 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.getAnnouncements (file:///app/dist/index.js:2074:25)
at async file:///app/dist/index.js:7420:30 {
length: 113,
severity: 'ERROR',
code: '42P01',
detail: undefined,
hint: undefined,
position: '829',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'parse_relation.c',
line: '1392',
routine: 'parserOpenTable'
}
GET /api/announcements 500 in 7ms
Error fetching announcements: error: relation "announcements" 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.getAnnouncements (file:///app/dist/index.js:2074:25)
at async file:///app/dist/index.js:7420:30 {
length: 113,
severity: 'ERROR',
code: '42P01',
detail: undefined,
hint: undefined,
position: '829',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'parse_relation.c',
line: '1392',
routine: 'parserOpenTable'
}
GET /api/announcements 500 in 20ms
+42
View File
@@ -0,0 +1,42 @@
-- Commandes à exécuter DIRECTEMENT dans votre conteneur Docker
-- Copiez et collez ces commandes une par une dans votre terminal
-- 1. Entrer dans le conteneur
-- docker exec -it logiflow-logiflow-1 /bin/bash
-- 2. Une fois dans le conteneur, exécuter cette commande SQL :
-- psql $DATABASE_URL
-- 3. Coller ce SQL dans psql :
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()
);
ALTER TABLE announcements ADD CONSTRAINT announcements_priority_check
CHECK (priority IN ('normal', 'important', 'urgent'));
ALTER TABLE announcements ADD CONSTRAINT announcements_author_id_fkey
FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE;
ALTER TABLE announcements ADD CONSTRAINT announcements_group_id_fkey
FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE CASCADE;
CREATE INDEX IF NOT EXISTS idx_announcements_priority ON announcements(priority);
CREATE INDEX IF NOT EXISTS idx_announcements_created_at ON announcements(created_at DESC);
CREATE INDEX IF NOT EXISTS idx_announcements_author_id ON announcements(author_id);
CREATE INDEX IF NOT EXISTS idx_announcements_group_id ON announcements(group_id);
-- Vérification
SELECT 'SUCCESS: Table announcements créée avec succès!' as result;
SELECT COUNT(*) as nb_colonnes FROM information_schema.columns WHERE table_name = 'announcements';
-- 4. Taper \q pour quitter psql
-- 5. Taper exit pour quitter le conteneur