fix: remove dead migration SQL that references nonexistent tables (issue #1877) - #1911
Merged
komalharshita merged 1 commit intoAug 16, 2026
Conversation
|
@ionfwsrijan is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
migrations/directory is disconnected from the application's real schema. Its SQL files reference tables (paths,certificates,discussion_threads,thread_comments,bookmarks,user_topic_progress,user_activity) that no SQLAlchemy model defines, and001/002declareFOREIGN KEY ... REFERENCES paths(id)against apathstable that does not exist anywhere — learning paths are stored in-memory. There is also no migration runner (no Alembic/Flask-Migrate config, no code reads the.sqlfiles), so none of the files can be applied in any supported workflow. The app creates its schema withdb.create_all()fromsrc/models.py(src/app.py,src/seed_db.py).Fix
migrations/.migrations/README.md: the schema is defined exclusively bysrc/models.py(projects,users,project_progress,user_game_progress) and created viadb.create_all(); nopathstable exists.tests/test_db_schema_consistency.py— a pure-file CI check that (1) everydb.ForeignKey(...)insrc/models.pytargets a defined table, and (2) any SQL migration inmigrations/may only reference model tables or tables created by an earlier migration in the set, so a dangling FK likeREFERENCES paths(id)can never be reintroduced.Files changed
migrations/001_create_certificates_table.sql— deletedmigrations/002_create_discussion_tables.sql— deletedmigrations/003_create_bookmarks_table.sql— deletedmigrations/004_create_progress_tables.sql— deletedmigrations/005_create_user_game_progress.sql— deletedmigrations/README.md— documents the model-driven schematests/test_db_schema_consistency.py— new consistency/regression checkTesting
tests/test_db_schema_consistency.py— 2 passed (run with--noconftestsince the app can't boot locally due to the pre-existing App fails to boot: NameError: name 're' is not defined in portfolio_analyzer.py #1810).Closes #1877