langgenius/dify

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

Open

#29,314 建立於 2025年12月9日

在 GitHub 查看
 (4 留言) (1 反應) (1 負責人)TypeScript (141,412 star) (22,210 fork)batch import
good first issuerefactor

描述

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

貢獻者指南