Skip to content

flask: Safety against db deletion in prod2sqlite migration script (3/3 split of #73) - #76

Open
RudraBJoshi wants to merge 3 commits into
Open-Coding-Society:mainfrom
CSA-Admin-OCS:split/flask/f3-migration-script-safety
Open

flask: Safety against db deletion in prod2sqlite migration script (3/3 split of #73)#76
RudraBJoshi wants to merge 3 commits into
Open-Coding-Society:mainfrom
CSA-Admin-OCS:split/flask/f3-migration-script-safety

Conversation

@RudraBJoshi

Copy link
Copy Markdown

Splitting #73 into smaller, independently-reviewable PRs across spring/flask/pages. This one is the migration script safety fix — unrelated to the password reset feature itself, just bundled into the original PR.

scripts/db_migrate-prod2sqlite.py calls db.drop_all() on whatever database the app is bound to, and __init__.py picks MySQL whenever the DB env vars are set — so a production .env sitting in the working directory turned "pull prod down into sqlite" into "wipe prod". Adds a check that refuses to run unless the target is a local SQLite file, verified timestamped backups before any drop, and a FORCE_YES flag for scripted runs.

Original PR: #73

RudraBJoshi and others added 2 commits August 26, 2026 12:54
Ensures any Claude Code session working in this repo automatically sees
that .clauderc (one directory up, at the prodsys root) has the project
structure, ongoing work, deploy requirements, and known gaps -- CLAUDE.md
is auto-loaded into context at session start, .clauderc on its own is not.
An automated reviewer flagged this as a path mismatch against the
sqlite:///volumes/... URI in __init__.py. Verified before touching
anything: Flask-SQLAlchemy resolves a relative sqlite:/// URI relative
to app.instance_path, not the repo root, matching where the real
on-disk db file actually lives (instance/volumes/user_management.db).
No behavior change -- just documenting why this isn't a bug so it
doesn't get "fixed" into something broken on a future pass.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants