Reconcile models with DB schema (fix alembic drift) #89
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/issue-83-alembic-drift"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reconciles the SQLAlchemy models with the actual database schema so
alembic revision --autogenerateno longer emits spurious drift:server_defaultvalues to match the DB (blocked_users.pattern_type,hashtag_streams.active/enable_scheduling/fetch_interval_minutes,posts.*boolean/count columns,queue_stats.*).ix_posts_author_usernameandix_posts_stream_idindexes.uq_post_id,uq_hashtag_stream) and unique indexes to match the DB.app_settings.api_keycolumn +uq_app_settings_api_keyconstraint (the API key is stored as a row withkey="api_key", not a column).Verified: on a fresh DB,
alembic revision --autogeneratenow produces an empty migration.Refs #83
WuMing
Found 1 issue(s). See inline comments below.
@ -11,10 +11,12 @@ from sqlalchemy import Booleanfrom sqlalchemy import DateTimefrom sqlalchemy import Floatfrom sqlalchemy import ForeignKeyfrom sqlalchemy import Indextests [LOW]
Non-trivial schema changes were made to models.py (new indexes, unique constraints, server_default columns) but no test file appears in the diff. Add or update tests that exercise the model schema/constraints, or a migration round-trip test for the new DDL.
packages/fenliu/src/fenliu/models.pyline 14✅ Added a schema-reconciliation metadata test in commit
801124a— it asserts the server defaults, indexes, and named unique constraints on the reconciled columns.