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
Allow limit option for MySQL bigint primary key support. #17631
Conversation
6ca65e3
to
c001b88
Compare
Related #14194 |
a6c3971
to
72271be
Compare
9f11888
to
4a88146
Compare
f418848
to
46158a0
Compare
46158a0
to
defb769
Compare
Could you rebase it? |
7ee5edc
to
7b6c269
Compare
Rebased on master! |
edd0920
to
cb19066
Compare
Example: create_table :foos, id: :primary_key, limit: 8 do |t| end # or create_table :foos, id: false do |t| t.column :id, limit: 8 end
cb19066
to
b8d320c
Compare
Allow limit option for MySQL bigint primary key support.
Only `primary_key` should be extracted by d47357e in rails#19030, but `new_coclumn_definition` was also extracted because rails#17631 is merged previously, then rails#19030 is auto merged without conflicts. This commit is for move back `new_column_definition` into `TableDefinition`.
Is this also fixed for Postgres? |
when :primary_key | ||
column.type = :integer | ||
column.auto_increment = true | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually normalizing primary key as an integer is for respects unsigned
option.
f3772f7#diff-98ce5dc0cd01f8b0435ff6feac10d8a8R33
If you want to create bigserial
or bigint
primary key for Postgres, simply you can specify it.
# bigserial
create_table :foos, id: :bigserial do |t|
end
# bigint (without default sequence)
create_table :foos, id: :bigint do |t|
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I knew about id: :bigint
but not id: :bigserial
Some custom primary key tests (added at rails#17631, rails#17696, rails#18220, rails#18228) were lost at rails#26266. Restore the tests to improve test coverage.
Example: