Repository navigation
Conversation
In 1.18.0, comparators were refactored to use PriorityDispatcher. _user_compare_server_default was registered at DispatchPriority.FIRST under the "server_default" subgroup. When compare_server_default is omitted or False (the default), _user_compare_server_default returns STOP, which aborted all subsequent comparators registered in the "server_default" subgroup before _compare_computed_default and _compare_identity_default could run. In addition, _setup_autoincrement was erroneously registered under the "server_default" subgroup, causing autoincrement settings to be skipped when server default comparison stopped. Fix this by: 1. Registering _compare_computed_default and _compare_identity_default at DispatchPriority.FIRST in the "server_default" subgroup, so they run before _user_compare_server_default (at DispatchPriority.MEDIUM). 2. Ensuring _compare_identity_default always returns STOP when an identity default is present, and populates existing_server_default. 3. Setting existing_server_default in _compare_computed_default. 4. Registering _setup_autoincrement under the "autoincrement" element. Fixes: sqlalchemy#1877
|
Hi, and thanks for the pull request! This project accepts pull requests only for issues that a maintainer has already marked with the open for pull requests label. That way we can settle on an approach before anyone spends time writing code. This pull request references issue #1877, which hasn't been marked open for pull requests, so the change isn't authorized yet and I'm closing it automatically. Once a maintainer adds the label to #1877, reopen this pull request and it will stay open. If #1877 needs more detail before that can happen, a complete runnable example is usually the missing piece, and adding one to the issue is the fastest way to get there. This is automatic and procedural. It isn't a judgment on your change, and nothing you've written here is lost. Thanks for your interest in the project! |
Fixes #1877
Problem
In 1.18.0, column comparators were moved to PriorityDispatcher. _user_compare_server_default was registered at DispatchPriority.FIRST under the "server_default" subgroup. When compare_server_default=False (the default setting in Alembic migration contexts), _user_compare_server_default returns PriorityDispatchResult.STOP. This aborts all subsequent comparators registered in the "server_default" subgroup before _compare_computed_default or _compare_identity_default can run.
Additionally, _setup_autoincrement was registered under the "server_default" subgroup, causing autoincrement metadata on altered columns to be dropped whenever server default comparison was stopped.
Solution