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要用varchar,而不是int? #15

Open
pengest opened this issue Mar 4, 2018 · 1 comment
Open

请问为何数据库中的id要用varchar,而不是int? #15

pengest opened this issue Mar 4, 2018 · 1 comment

Comments

@pengest
Copy link

pengest commented Mar 4, 2018

而且我在添加用户的时候,添加后的用户id会是一大串英文

@codingXiaxw
Copy link
Owner

首先你要知道,保证ID不重复有两种方式:1.设置ID为int类型,然后让它自增长即可。2.设置ID为varchar,然后用UUID给它赋值(我的项目中采用的就是这种方式)。知道了我项目中的ID是采用UUID设置后,你该明白为什么你添加完用户后用户id会是一大串英文了吗?

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