mirror of
https://github.com/R0m1k3/noteflow.git
synced 2026-10-11 17:29:37 +02:00
feat: Add automatic database schema migrations for tracking timestamps, priority, and in-progress fields, executed at startup.
This commit is contained in:
1 parent
00ac17da70
commit
e71d81c05d
2 files changed
+18
No files matched your search
@@ -75,6 +75,10 @@ else
|
||||
echo "✅ PostgreSQL contient déjà des données ($HAS_DATA utilisateurs)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🔄 Vérification des migrations de schéma..."
|
||||
node scripts/auto-migrate.js
|
||||
|
||||
echo ""
|
||||
echo "🔄 Migration des timezones du calendrier..."
|
||||
node scripts/migrate-calendar-timezone.js 2>/dev/null || echo " ℹ️ Migration timezone déjà effectuée ou non nécessaire"
|
||||
|
||||
@@ -167,6 +167,20 @@ async function autoMigrate() {
|
||||
await client.query(`ALTER TABLE note_todos ADD COLUMN priority BOOLEAN DEFAULT FALSE`);
|
||||
}
|
||||
|
||||
// Migration 3: Champ in_progress pour les tâches globales
|
||||
logger.info(' Vérification: champ in_progress pour global_todos...');
|
||||
|
||||
const globalTodosInProgressExists = await client.query(`
|
||||
SELECT column_name
|
||||
FROM information_schema.columns
|
||||
WHERE table_name='global_todos' AND column_name='in_progress'
|
||||
`);
|
||||
|
||||
if (globalTodosInProgressExists.rows.length === 0) {
|
||||
logger.info(' → Ajout du champ in_progress à global_todos');
|
||||
await client.query('ALTER TABLE global_todos ADD COLUMN in_progress INTEGER DEFAULT 0');
|
||||
}
|
||||
|
||||
// Créer les index pour performance
|
||||
await client.query(`CREATE INDEX IF NOT EXISTS idx_global_todos_priority ON global_todos(priority DESC, created_at DESC)`);
|
||||
await client.query(`CREATE INDEX IF NOT EXISTS idx_note_todos_priority ON note_todos(priority DESC, position)`);
|
||||
|
||||
Reference in new issue
Block a user