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

Allow limit option for MySQL bigint primary key support. #17631

Merged
merged 1 commit into from Feb 23, 2015

Conversation

kamipo
Copy link
Member

@kamipo kamipo commented Nov 15, 2014

Example:

create_table :foos, id: :primary_key, limit: 8 do |t|
end

# or 

create_table :foos, id: false do |t|
  t.primary_key :id, limit: 8
end

@kamipo kamipo changed the title Add bigint pk support Add bigint pk support for MySQL Nov 16, 2014
@kamipo
Copy link
Member Author

kamipo commented Nov 19, 2014

Related #14194

@kamipo kamipo force-pushed the bigint_pk_support branch 2 times, most recently from a6c3971 to 72271be Compare November 27, 2014 23:04
@kamipo kamipo force-pushed the bigint_pk_support branch 4 times, most recently from 9f11888 to 4a88146 Compare December 4, 2014 01:59
@kamipo kamipo force-pushed the bigint_pk_support branch 2 times, most recently from f418848 to 46158a0 Compare December 12, 2014 02:15
@kamipo kamipo changed the title Add bigint pk support for MySQL Allow limit option for MySQL bigint primary key support. Dec 28, 2014
@rafaelfranca
Copy link
Member

Could you rebase it?

@kamipo kamipo force-pushed the bigint_pk_support branch 3 times, most recently from 7ee5edc to 7b6c269 Compare February 21, 2015 06:47
@kamipo
Copy link
Member Author

kamipo commented Feb 21, 2015

Rebased on master!

@kamipo kamipo force-pushed the bigint_pk_support branch 2 times, most recently from edd0920 to cb19066 Compare February 23, 2015 15:56
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
rafaelfranca added a commit that referenced this pull request Feb 23, 2015
Allow limit option for MySQL bigint primary key support.
@rafaelfranca rafaelfranca merged commit acb12d3 into rails:master Feb 23, 2015
@kamipo kamipo deleted the bigint_pk_support branch February 23, 2015 21:20
kamipo added a commit to kamipo/rails that referenced this pull request Feb 24, 2015
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`.
@jcoleman
Copy link
Contributor

jcoleman commented Aug 6, 2016

Is this also fixed for Postgres?

when :primary_key
column.type = :integer
column.auto_increment = true
end
Copy link
Member Author

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

Copy link
Contributor

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

kamipo added a commit to kamipo/rails that referenced this pull request Feb 4, 2017
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants