thermograph/deploy
Emi Griffith 1e89bc71c9 Apply accounts-DB migrations on deploy (#219)
The deploy scripts pulled code and restarted but never applied the
hand-written SQL migrations in deploy/migrations/, so column additions to
the long-lived accounts DB had to be run by hand.

Add deploy/migrate-db.py, an idempotent runner that resolves the accounts
DB the same way the app does (THERMOGRAPH_ACCOUNTS_DB or
<repo>/data/accounts.sqlite), applies any files not yet recorded in a
schema_migrations table, and:
  - backs the DB up before touching it;
  - baselines a fresh DB (no file, or no user table) rather than ALTERing
    a table create_all() will build with the current schema on next start;
  - tolerates an already-present column/index (hand-applied or model-built)
    by recording it instead of failing.

Wire it into deploy.sh (prod) and deploy-dev.sh (dev) just before the
service restarts, so new code never queries a column an older DB lacks.
No env or systemd changes: the migration runs as the deploy user, who owns
the data dir.

Claude-Session: https://claude.ai/code/session_01XXxmNFy9cZ6Gh8Y9thZn62
2026-07-20 06:09:15 +00:00
..
Caddyfile Serve the app on thermograph.org at root; redirect emigriffith.dev/thermograph (#91) 2026-07-15 19:58:32 +00:00
deploy.sh Apply accounts-DB migrations on deploy (#219) 2026-07-20 06:09:15 +00:00
provision-mail.sh Rebuild the homepage as a distribution landing; add an SMTP seam (#178) 2026-07-18 07:39:47 +00:00
thermograph-dev.service Add dev CI/CD pipeline deploying to a LAN server (#6) 2026-07-11 02:13:18 +00:00
thermograph.env.example Link a Thermograph account to Discord via OAuth2 (#208) 2026-07-20 02:26:33 +00:00
thermograph.service Gate the subscription notifier to one worker (#161) 2026-07-17 12:54:55 +00:00