langgenius/dify

[Chore/Refactor] Remove `server_default` in model definitions

Open

#29314 opened on Dec 9, 2025

View on GitHub
 (4 comments) (1 reaction) (1 assignee)TypeScript (141,412 stars) (22,210 forks)batch import
good first issuerefactor

Description

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for refactoring, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Description

Summary

PR #28188 introduced MySQL support and adjusted migration accordingly. However, the model definition is not adjusted, and most models still contains the server_default=sa.text('uuid_generate_v4()') option. While the server_default argument is only used to generate migration and not applied while running application, it still causes confusion, especially for new model definitions, as implementors of new models (both real humans and AIs) generally references existing model definitions as examples.

Solution

Remove the server_default parameter from UUID column definitions in model files, allowing the application layer to handle database-specific UUID generation by setting the default=uuid.uuid4 option for those models.

Motivation

No response

Additional Context

No response

Contributor guide