26 lines
1.1 KiB
Markdown
26 lines
1.1 KiB
Markdown
# 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 |