langgenius / langgenius/dify

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

Open
#29,314 6 comments 1 reaction 2 assignees Claimed by @QianJinGuo View on GitHub
good first issue refactor
Dominant language
TypeScript
Stars
156k
Forks
24.6k
Avg merge
22h 9m
Merged PRs (30d)
610

Description

### Self Checks

- [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542).
- [x] This is only for refactoring, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general).
- [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- [x] 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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.