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
migration primary key #1032
Comments
What is "unsigned attribute"? What is the problem? |
I suppose @ostapetc means migration should create ‘unsigned integer’ instead of simple ‘integer’ for the primary key with auto increment. Unsigned types have higher maximum value, then normal, so the auto increment less likely will be exhausted. Similar request was already posted at Yii1: |
I see. Does my comment yiisoft/yii#1923 (comment) make sense to you then? |
Comment makes sense, when you need an unsigned integer you can write your own column definition instead of using the abstract types. |
@klimov-paul thanks for help |
@ostapetc, I understand you are upset, but I am afraid there is nothing I can do here. But, OK, I’ll try.
Representing the high integer at 32-bit system could be a problem only, if its actual value will overflow PHP max_int for 32-bit system. In general it should be safe. Also just when you last saw 32-bit server system?
Well, I have checked the MySQL manual once again Do not forget, that using magic ‘pk’ in migration increases its university, so migration written for MySQL can be applied to PostgreSQL as well. While custom PK definition will be stuck for the particular DBMS. @qiangxue, @cebe, if you are still think this feature should not be implemented, just close this issue once more. |
+1 |
PHP on Windows are usually 32bits build since php.net states the x64 builds of PHP for Windows should be considered experimental. Also imagine in practice, if you are defining a PK for a table which is very likely to have billions of rows, do you think you would consider using |
"consider using unsigned int or bigint?" - i will choose bigint unsigned, because i do not plan store negative integers |
Many DBMS actually don't even support unsigned types: mssql, oracle, pgsql, cubrid... |
I do not remember why I reopened it but as @qiangxue said there are many dbms that do not support unsigned integer. if you want your PK to be unsigned you can write explicit column definition. we will not add it to the abstract types for consistency. |
btw: If you want to create portable code, unsigned is not your friend. So not an argument for it. |
Why migration creates primary key without unsigned attribute?
The text was updated successfully, but these errors were encountered: