Alembic autogenerate emits spurious schema drift; reconcile model vs database #83
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
alembic revision --autogeneratein packages/fenliu produces large spurious diffs unrelated to the actual model change: it wants to dropapp_settings.api_key(present in the DB but absent from the SQLAlchemy model), drop/rename severalpostsindexes (ix_posts_author_username,ix_posts_stream_id,uq_post_id), and stripserver_defaultvalues.The database schema and the SQLAlchemy models have drifted apart (likely from hand-applied schema changes never reflected in the models, or vice versa). This makes autogenerate untrustworthy — every generated migration must be hand-reviewed and trimmed down to the intended change, which is error-prone.
Observed while adding the AI-classification columns (PR #81): the generated migration had to be hand-trimmed to the 8
add_column+ 1create_indexoperations.