mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Created a checkpoint
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:
1 parent
0dc7ef49c0
commit
d45d3562ba
3 files changed
+17
-40
No files matched your search
@@ -91,11 +91,11 @@ docker exec logiflow-logiflow-1 ls -la /app/scripts/
|
||||
docker-compose up -d --env DEBUG_MIGRATIONS=true
|
||||
```
|
||||
|
||||
## 📋 Tables créées automatiquement
|
||||
## 📋 Table créée automatiquement
|
||||
|
||||
✅ **announcements** - Système d'informations (prioritaire)
|
||||
✅ **announcements** - Système d'informations
|
||||
|
||||
Le script vérifie et crée uniquement les tables manquantes nécessaires au fonctionnement de l'application.
|
||||
Le script vérifie et crée **UNIQUEMENT** la table `announcements` si elle n'existe pas. Toutes les autres tables existent déjà en production et ne sont pas touchées.
|
||||
|
||||
## 🔄 Futures mises à jour
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# 🚨 SOLUTION IMMÉDIATE POUR LA PRODUCTION
|
||||
|
||||
## 🎯 Objectif
|
||||
Créer **UNIQUEMENT** la table `announcements` manquante. Toutes les autres tables existent déjà en production et ne doivent pas être touchées.
|
||||
|
||||
## Problème
|
||||
La table `announcements` n'existe pas dans votre base de données de production, ce qui cause l'erreur:
|
||||
```
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/bin/bash
|
||||
# Script de migration automatique pour les mises à jour Docker
|
||||
# Crée uniquement les tables manquantes nécessaires au fonctionnement
|
||||
# Script de migration automatique - Crée UNIQUEMENT la table announcements
|
||||
# Toutes les autres tables existent déjà en production
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔄 [AUTO-MIGRATE] Vérification des tables manquantes..."
|
||||
echo "🔄 [AUTO-MIGRATE] Vérification de la table announcements..."
|
||||
|
||||
# Vérifier si la base de données est accessible
|
||||
if ! psql "$DATABASE_URL" -c "SELECT 1;" > /dev/null 2>&1; then
|
||||
@@ -14,14 +14,8 @@ fi
|
||||
|
||||
echo "✅ [AUTO-MIGRATE] Connexion à la base de données réussie"
|
||||
|
||||
# Fonction pour vérifier si une table existe
|
||||
table_exists() {
|
||||
local table_name=$1
|
||||
psql "$DATABASE_URL" -tAc "SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_schema='public' AND table_name='$table_name');"
|
||||
}
|
||||
|
||||
# Migration prioritaire: Table announcements (système d'informations)
|
||||
if [ "$(table_exists 'announcements')" = "f" ]; then
|
||||
# Vérifier si la table announcements existe
|
||||
if psql "$DATABASE_URL" -tAc "SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_schema='public' AND table_name='announcements');" | grep -q "f"; then
|
||||
echo "🔧 [AUTO-MIGRATE] Création de la table announcements..."
|
||||
psql "$DATABASE_URL" << 'EOF'
|
||||
CREATE TABLE announcements (
|
||||
@@ -38,34 +32,14 @@ CREATE TABLE announcements (
|
||||
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);
|
||||
|
||||
COMMENT ON TABLE announcements IS 'Système d informations - annonces administrateur';
|
||||
CREATE INDEX idx_announcements_priority ON announcements(priority);
|
||||
CREATE INDEX idx_announcements_created_at ON announcements(created_at DESC);
|
||||
CREATE INDEX idx_announcements_author_id ON announcements(author_id);
|
||||
CREATE INDEX idx_announcements_group_id ON announcements(group_id);
|
||||
EOF
|
||||
echo "✅ [AUTO-MIGRATE] Table announcements créée avec succès"
|
||||
else
|
||||
echo "ℹ️ [AUTO-MIGRATE] Table announcements existe déjà"
|
||||
echo "ℹ️ [AUTO-MIGRATE] Table announcements existe déjà - aucune action nécessaire"
|
||||
fi
|
||||
|
||||
# Vérification finale
|
||||
echo "📊 [AUTO-MIGRATE] Vérification des tables essentielles:"
|
||||
psql "$DATABASE_URL" -c "
|
||||
SELECT
|
||||
CASE
|
||||
WHEN EXISTS (SELECT FROM information_schema.tables WHERE table_name = 'announcements') THEN '✅ announcements'
|
||||
ELSE '❌ announcements manquante'
|
||||
END as status_announcements,
|
||||
CASE
|
||||
WHEN EXISTS (SELECT FROM information_schema.tables WHERE table_name = 'users') THEN '✅ users'
|
||||
ELSE '❌ users manquante'
|
||||
END as status_users,
|
||||
CASE
|
||||
WHEN EXISTS (SELECT FROM information_schema.tables WHERE table_name = 'groups') THEN '✅ groups'
|
||||
ELSE '❌ groups manquante'
|
||||
END as status_groups;
|
||||
"
|
||||
|
||||
echo "✅ [AUTO-MIGRATE] Vérification terminée!"
|
||||
echo "✅ [AUTO-MIGRATE] Migration terminée!"
|
||||
Reference in new issue
Block a user