Files
quixotic/.serena/memories/postgresql_migration_complete.md
Andrey Kondratev 7a7a189ef7 psql
2025-08-28 19:13:39 +05:00

1.1 KiB

PostgreSQL Migration Completed

Changes Made

  • Docker Compose: Added PostgreSQL 15 service with persistent data volume
  • Database Configuration: Migrated from SQLite3 to PostgreSQL using pg library
  • Package Dependencies: Updated package.json (removed sqlite3, added pg and @types/pg)
  • Database Class: Converted all methods to use PostgreSQL syntax and async/await pattern

Key Configuration

  • Database URL: postgresql://quixotic:quixotic123@postgres:5432/quixotic
  • Container: quixotic-postgres with health checks
  • Volume: postgres-data for data persistence
  • Environment variables: POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD

Database Schema Changes

  • INTEGER PRIMARY KEY → SERIAL PRIMARY KEY
  • BIGINT for telegram_id (better for large Telegram IDs)
  • TIMESTAMP instead of DATETIME
  • PostgreSQL-style REFERENCES syntax for foreign keys
  • ON CONFLICT DO UPDATE for upsert operations

Status

Migration completed successfully Application starts without database errors All dependencies installed Docker containers running properly