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

想问下自增主键的Id类型可以改为BigInt吗 #5344

Open
SirCFC opened this issue Feb 24, 2025 · 2 comments
Open

想问下自增主键的Id类型可以改为BigInt吗 #5344

SirCFC opened this issue Feb 24, 2025 · 2 comments

Comments

@SirCFC
Copy link

SirCFC commented Feb 24, 2025

问题在于,我修订了代码,处理了ID跳变的问题,但是ID跳变久了可能会超过ID的11位限制,所以想咨询下,如果数据库改为Bigint,代码需要调整吗

Copy link

dosubot bot commented Feb 24, 2025

Hey @SirCFC! 👋 I'm here to help you with any questions or issues you have. I'm a bot designed to help you solve bugs, answer questions, and become a contributor. Let me know how I can assist you!

当前数据库模式中,自增主键 ID 的数据类型在某些表中是 int(10) unsigned,而在其他表中是 int(11) unsigned [1][2][3][4][5]。如果将其更改为 BigInt,可能需要检查以下几个方面:

  1. 应用代码:需要查看应用代码中是否有对 ID 字段的显式类型检查或转换,这些可能需要更新以支持 BigInt。

  2. 序列化/反序列化逻辑:检查代码库中是否有依赖于 ID 特定类型或大小的序列化或反序列化逻辑。

  3. 第三方库或依赖项:确认是否有与 ID 字段交互的第三方库或依赖项可能会受到 BigInt 更改的影响。

  4. 数据库迁移脚本:查看是否有数据库迁移脚本或文档,概述了将 ID 列类型从 int 更改为 BigInt 的过程。

  5. 单元或集成测试:检查是否有专门测试 ID 字段的单元或集成测试,如果有,可能需要更新以支持 BigInt。

  6. 配置文件或设置:确认应用是否有任何配置文件或设置指定了 ID 字段的数据类型。

  7. 数据库触发器或存储过程:检查是否有与 ID 字段交互的数据库触发器或存储过程可能会受到 BigInt 更改的影响。

这些方面都需要仔细检查和测试,以确保更改不会引入新的问题。

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@TerryLam2010
Copy link
Contributor

id 使用的都是long类型。支持bigint

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