Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql表结构通过gentool工具生成表model,默认值是空字符串的话会丢失? #1188

Open
pihc opened this issue Aug 13, 2024 · 2 comments

Comments

@pihc
Copy link

pihc commented Aug 13, 2024

image
image
上面这两张图看起来回比较直观些,verify_type 的默认值为空字符串时在生成model的时候丢失了。
正式环境发布的时候,我会执行 AutoMigrate,将model反向生成数据库脚本,导致原本有默认值(EMPTY STRING)的字段全部丢失。

@zhang-jianqiang
Copy link

我猜测gentool生成代码的逻辑可能是默认值和类型的零值一致时就会省略default,这样用migrate确实会有问题

@mimicode
Copy link

空,null 都会丢弃,这个逻辑不合理,导致原始表的定义缺失

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants