Skip to content

chore: remove duplicated server_default from agent and credential permission models - #39886

Open
HandSonic wants to merge 1 commit into
langgenius:mainfrom
HandSonic:chore/remove-server-default-agent-models
Open

chore: remove duplicated server_default from agent and credential permission models#39886
HandSonic wants to merge 1 commit into
langgenius:mainfrom
HandSonic:chore/remove-server-default-agent-models

Conversation

@HandSonic

Copy link
Copy Markdown

Summary

For #29314 — a safe slice of the server_default cleanup.

  • Remove duplicated server_default from 11 columns in api/models/agent.py and api/models/credential_permission.py that already declare an equivalent application-level default= (active_config_has_model, active_config_is_published, three status columns, draft_type, created_at with default=naive_utc_now, active_guard, value_owned_by_drive, is_skill, has_permission).
  • server_default only affects migration autogeneration, not runtime behavior, and the duplication confuses new model definitions which copy these files as examples.
  • No behavior change; no migration needed (existing database schemas are untouched by a model-definition-only change).

Intentionally left untouched: the two created_at columns (agent.py, credential_permission.py) that rely solely on server_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 in test_end_user_type.py are pre-existing on main and unrelated — verified on a clean tree)
  • ruff check / ruff format --check on touched files → pass
  • pyrefly check on touched files → 0 errors

From CodeBuddy Code

…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.
@HandSonic
HandSonic requested a review from QuantumGhost as a code owner August 2, 2026 09:40
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. refactor labels Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant