Fixed
- Migration System Overhaul: Refactored the database migration system for improved reliability and consistency.
- Standardized on
backend/migrations/apply_migrations.py
for applying migrations. - Removed obsolete top-level
migrations/
directory andbackend/run_migrations.py
script. - Simplified
backend/init.sql
to only handle initial role alterations, removing table creation logic. - Corrected
docker-compose.yml
volume mounts and command to use the new migration path (backend/migrations
). - Cleaned up
Dockerfile
by removing redundant migration script calls and ensuring correct migration directory copying. - Resolved conflicting
user_preferences
table creation by removing the SQL version and relying on the Python migration. - Renamed and renumbered all migration files sequentially (000 to 010) in
backend/migrations/
for clear execution order. - Added
000_create_warranties_table.sql
migration to ensure the base table exists before other migrations reference it. - Verified and ensured idempotency (
CREATE/ALTER ... IF NOT EXISTS
) for all migration scripts, preventing errors on re-runs. - Corrected
fix_permissions.py
execution by ensuringfix_permissions.sql
is copied into the Docker image.
- Standardized on
Updated docker-compose file:
services:
warracker:
image: ghcr.io/sassanix/warracker/main:latest
ports:
- "8005:80"
volumes:
- warracker_uploads:/data/uploads
environment:
- DB_HOST=warrackerdb
- DB_NAME=warranty_db
- DB_USER=warranty_user
- DB_PASSWORD=${DB_PASSWORD:-warranty_password}
- SMTP_HOST=smtp.email.com
- SMTP_PORT=465
- SMTP_USERNAME=youremail@email.com
- SMTP_PASSWORD=password
depends_on:
warrackerdb:
condition: service_healthy
restart: unless-stopped
warrackerdb:
image: postgres:15-alpine
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=warranty_db
- POSTGRES_USER=warranty_user
- POSTGRES_PASSWORD=${DB_PASSWORD:-warranty_password}
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 5s
retries: 5
volumes:
postgres_data:
warracker_uploads: