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

建议:支持工具生成的数据库数据模型中,tinyint(1)的生成为bool类型,或者特定前缀的字段生成为bool(比如is,ex:isSys) #1648

Closed
snowich opened this issue Mar 7, 2022 · 1 comment
Labels
discuss We need discuss to make decision. enhancement inactive wip

Comments

@snowich
Copy link
Contributor

snowich commented Mar 7, 2022

建议:支持工具生成的数据库数据模型中,tinyint(1)的生成为bool类型,或者特定前缀的字段生成为bool(比如is,ex:isSys)

@gqcn gqcn added the discuss We need discuss to make decision. label Mar 9, 2022
@wesleywu
Copy link
Contributor

1、true|false建议用 bit 类型
mysql类型中括号中使用的数字1仅用于宽度显示。INT(1)和TINYINT(1)不会影响存储。
TINYINT占用1字节,这意味着它的范围是-128到+127,所以,并不适合被生成为bool类型。
2、不建议通过字段前缀、后缀来判断生成的类型,这会导致碰巧使用这种前缀、后缀的开发者获得非期待的结果。
比如,gfast原来的生成代码策略是为所有 xxx_status 的字段生成 bool 类型,并且在前端用 element-ui 的 switch 去inline修改这个状态,但我的业务表里恰巧有很多 xxx_status 字段,大部分并非 true|false 类型,所以在最新版的gfast,我把这个处理去掉了。

gqcn added a commit that referenced this issue Jul 27, 2022
gqcn added a commit that referenced this issue Jul 28, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss We need discuss to make decision. enhancement inactive wip
Projects
None yet
Development

No branches or pull requests

3 participants