Commit Graph
5 Commits
Author SHA1 Message Date
Claude b661f7f2f6 fix: auto-correct PostgreSQL boolean types at Docker startup
Automatically fixes INTEGER->BOOLEAN type mismatches when Docker starts.
This resolves the 500 error on /api/notes without manual intervention.

Changes:
- scripts/fix-postgres-boolean-types.sql: Idempotent SQL script that
  detects INTEGER columns that should be BOOLEAN and converts them
  (0→FALSE, 1→TRUE) for all affected tables

- docker-entrypoint.sh: Executes the boolean correction script
  automatically after migrations and before starting the server

The script corrects these columns:
  • users.is_admin
  • notes.archived
  • note_todos.completed, note_todos.priority
  • global_todos.completed, global_todos.priority
  • rss_feeds.enabled
  • calendar_events.all_day

The correction is idempotent and runs on every container restart,
ensuring data integrity even after database migrations.

Fixes: Notes not displaying due to boolean type mismatch
2025-11-28 16:42:31 +00:00
Michael e71d81c05d feat: Add automatic database schema migrations for tracking timestamps, priority, and in-progress fields, executed at startup. 2025-11-23 17:13:20 +01:00
Claude 70bc3e0a5a Fix: Décalage horaire Google Calendar (+1h corrigé)
Correction du décalage de timezone de 1h dans Google Calendar

PROBLÈME:
- Les événements s'affichaient avec 1h de décalage
- Événement à 10h → affiché à 11h (ou 09h selon cas)

CAUSE:
- TIMESTAMP (sans timezone) dans PostgreSQL
- Google envoie dates avec timezone info
- PostgreSQL stockait sans timezone
- JavaScript réinterprétait avec timezone local
- = Double application du décalage

SOLUTION:
1. calendar_events: TIMESTAMP → TIMESTAMPTZ
   - start_time: TIMESTAMPTZ (conserve timezone)
   - end_time: TIMESTAMPTZ (conserve timezone)

2. Migration automatique:
   - scripts/migrate-calendar-timezone.js
   - Exécuté automatiquement au démarrage Docker
   - Convertit les données existantes
   - USING start_time AT TIME ZONE 'UTC'

3. Correction booléens all_day:
   - Ligne 433: isAllDay ? 1 : 0 → isAllDay
   - Ligne 451: isAllDay ? 1 : 0 → isAllDay

FICHIERS MODIFIÉS:
- config/database.js: TIMESTAMPTZ pour calendar_events
- routes/calendar.routes.js: Booléens corrigés
- docker-entrypoint.sh: Migration auto timezone
- migrations/002_calendar_timestamptz.sql: SQL manuel
- scripts/migrate-calendar-timezone.js: Script migration

DÉPLOIEMENT:
Au prochain rebuild Docker:
1. La table sera recréée avec TIMESTAMPTZ
2. Les événements existants seront migrés
3. Les nouvelles synchros utiliseront le bon format
4. Plus de décalage horaire!

Resynchronisez Google Calendar après déploiement
pour appliquer le nouveau format.
2025-11-14 10:52:41 +00:00
Claude 6b5f4081b2 BREAKING: Migration complète vers PostgreSQL uniquement
🐘 NoteFlow utilise maintenant EXCLUSIVEMENT PostgreSQL

CHANGEMENTS MAJEURS:
==================

1. Base de données (config/database.js)
   ✅ Remplacé par PostgreSQL (backup SQLite créé)
   ✅ Toutes les routes et services mis à jour
   ✅ database-loader.js supprimé (plus nécessaire)

2. Migration automatique (docker-entrypoint.sh)
   ✅ Attend que PostgreSQL soit prêt
   ✅ Détecte si PostgreSQL est vide
   ✅ Migre automatiquement SQLite si présent
   ✅ Lance le serveur après migration

3. Package.json
   ✅ Description mise à jour (PostgreSQL)
   ✅ Keywords: postgresql au lieu de sqlite
   ✅ sqlite3 gardé uniquement pour migration

4. Documentation
   ✅ POSTGRESQL-ONLY.md: Guide complet PostgreSQL
   ✅ Commandes, dépannage, sécurité
   ✅ Instructions de migration

MIGRATION UTILISATEUR:
=====================

Au prochain démarrage Docker:
1. Le container détecte PostgreSQL vide
2. Cherche ./data/notes.db (si existe)
3. Migre AUTOMATIQUEMENT toutes les données
4. Démarre avec PostgreSQL

COMMANDES:
=========

docker-compose build
docker-compose up -d

→ Tout se fait automatiquement!

Les données SQLite sont conservées comme backup dans ./data/
mais l'application n'utilise plus que PostgreSQL.

FICHIERS MODIFIÉS:
=================
- config/database.js (PostgreSQL uniquement)
- docker-entrypoint.sh (migration automatique)
- server.js + 11 routes + 2 services
- package.json (description + keywords)
- Documentation complète: POSTGRESQL-ONLY.md

Cette migration garantit:
- Performance optimale
- Meilleure gestion de la concurrence
- Support production à grande échelle
- Pas de perte de données (migration auto)
2025-11-14 09:58:13 +00:00
Michael 8122880caa [dyad] wrote 2 file(s) 2025-11-06 13:53:22 +01:00