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

Breaking Change:unsigned integer type incompatible with previous versions #4448

Open
wuqinqiang opened this issue Nov 6, 2024 · 2 comments

Comments

@wuqinqiang
Copy link
Contributor

wuqinqiang commented Nov 6, 2024

Describe the bug

this pr:#4062 add a strict mod.

Before goctl/v1.6.6, whether signed or unsigned in database tables, they were all converted to signed types in the end.

bigint case

  `xx` bigint unsigned NOT NULL,

Regardless of whether there was unsigned before, they all ended up generating go int64.

But starting from goctl/v1.6.6 upgrade, the above fields will default to go -> uint64, even if you haven't configured strict = true. According to the documentation, when strict = false and no custom type is specified, it should still maintain bigint -> int64.
The current behavior is not compatible with previously generated versions, which is breaking.

The reason seems to be that the following two places did not check strict.
https://github.com/zeromicro/go-zero/blob/master/tools/goctl/model/sql/converter/types.go#L308
https://github.com/zeromicro/go-zero/blob/master/tools/goctl/model/sql/converter/types.go#L275

But in DefaultNull condiction, use strict
And in some DefaultNulll, the strict checking is included.
https://github.com/zeromicro/go-zero/blob/master/tools/goctl/model/sql/converter/types.go#L285

Expected behavior

Compatible with previous versions

Screenshots

Environments (please complete the following information):

  • goctl version:v1.7.3
@wuqinqiang
Copy link
Contributor Author

@kevwan

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@kevwan

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

2 participants