fix: ensure data persistence across reinstallations

- Add entrypoint.sh: creates /app/data, stamps legacy DBs, runs alembic upgrade head
- Update Dockerfile to use new entrypoint and pre-create /app/data
- Change default DATABASE_URL to sqlite:///./data/dmarq.db
- Add _ensure_sqlite_dir() to database.py for automatic directory creation
- Update docker-compose.yml with app_data named volume for /app/data
- Add 6 tests for _ensure_sqlite_dir and updated default URL

Agent-Logs-Url: https://github.com/christianlouis/dmarq/sessions/2bac317b-97a2-450b-84f1-3e316f7ef54c

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-29 18:53:00 +00:00
parent 7c471b2800
commit 423c596c28
6 changed files with 139 additions and 5 deletions
+4 -1
View File
@@ -26,7 +26,8 @@ services:
context: ./backend
dockerfile: Dockerfile
volumes:
- ./backend:/app
- ./backend:/app # development: mount source code for live reload
- app_data:/app/data # persist SQLite database and other application data
depends_on:
db:
condition: service_healthy
@@ -50,4 +51,6 @@ networks:
# Define volumes
volumes:
postgres_data:
driver: local
app_data:
driver: local