feat: portable Windows data layout and launcher package
Separate persistent user data from application code (data/work_tracker.db, data/uploads, data/storage) with idempotent legacy migration and SQLite integrity checks. Add offline packaging scripts for a Windows x11 x64 portable ZIP (embeddable Python, Start/Stop/Backup.bat). Fix launcher: no multiline python -c in BAT and no os.dup2 — uvicorn runs detached with wvt.log; health wait and busy-port diagnostics included.
This commit is contained in:
@@ -3,8 +3,15 @@ from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from pathlib import Path
|
||||
|
||||
# Keep SQLite anchored to the project, independent of the process working directory.
|
||||
DATABASE_PATH = Path(__file__).resolve().with_name("work_tracker.db")
|
||||
from app.config import database_path, ensure_data_layout, migrate_legacy_data
|
||||
|
||||
# Persistent user database lives under data/ (see app.config). Resolve paths
|
||||
# and migrate any legacy app/database/work_tracker.db before opening SQLite.
|
||||
ensure_data_layout()
|
||||
migrate_legacy_data()
|
||||
|
||||
# Keep SQLite anchored to the configured data root, independent of CWD.
|
||||
DATABASE_PATH: Path = database_path()
|
||||
DATABASE_PATH.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# SQLAlchemy accepts an absolute SQLite URL in this form on Windows and Unix.
|
||||
|
||||
Reference in New Issue
Block a user