This commit is contained in:
Andrey Kondratev
2025-08-28 19:13:39 +05:00
parent 6cb8341075
commit 7a7a189ef7
6 changed files with 217 additions and 854 deletions

View File

@@ -0,0 +1,26 @@
# 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