chore: remove duplicated server_default from agent and credential permission models - #39886
Open
HandSonic wants to merge 1 commit into
Open
chore: remove duplicated server_default from agent and credential permission models#39886HandSonic wants to merge 1 commit into
HandSonic wants to merge 1 commit into
Conversation
…mission models For langgenius#29314. Remove server_default from columns in api/models/agent.py and api/models/credential_permission.py that already declare an equivalent application-level default= (11 columns). server_default only affects migration autogeneration, not runtime behavior, and the duplication confuses new model definitions which copy these files as examples. Intentionally left untouched: the two created_at columns that rely solely on server_default=func.current_timestamp() (no app-level default); removing those would change insert behavior and deserves its own decision.
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.
Summary
For #29314 — a safe slice of the
server_defaultcleanup.server_defaultfrom 11 columns inapi/models/agent.pyandapi/models/credential_permission.pythat already declare an equivalent application-leveldefault=(active_config_has_model,active_config_is_published, threestatuscolumns,draft_type,created_atwithdefault=naive_utc_now,active_guard,value_owned_by_drive,is_skill,has_permission).server_defaultonly affects migration autogeneration, not runtime behavior, and the duplication confuses new model definitions which copy these files as examples.Intentionally left untouched: the two
created_atcolumns (agent.py,credential_permission.py) that rely solely onserver_default=func.current_timestamp()with no app-level default — removing those would change insert behavior and deserves its own decision (add an app-level default first, or keep the server default).Testing
uv run --project api pytest api/tests/unit_tests/models -q→ 371 passed (2 failures intest_end_user_type.pyare pre-existing on main and unrelated — verified on a clean tree)ruff check/ruff format --checkon touched files → passpyrefly checkon touched files → 0 errorsFrom CodeBuddy Code