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

Projects
None yet
3 participants
@kamipo
Member

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 force-pushed the kamipo:bigint_pk_support branch Nov 15, 2014

@kamipo kamipo changed the title from Add bigint pk support to Add bigint pk support for MySQL Nov 16, 2014

@kamipo

This comment has been minimized.

Member

kamipo commented Nov 19, 2014

Related #14194

@kamipo kamipo force-pushed the kamipo:bigint_pk_support branch 2 times, most recently Nov 27, 2014

@kamipo kamipo force-pushed the kamipo:bigint_pk_support branch 4 times, most recently Nov 28, 2014

@kamipo kamipo force-pushed the kamipo:bigint_pk_support branch 2 times, most recently Dec 10, 2014

@kamipo kamipo force-pushed the kamipo:bigint_pk_support branch Dec 28, 2014

@kamipo kamipo changed the title from Add bigint pk support for MySQL to Allow limit option for MySQL bigint primary key support. Dec 28, 2014

@rafaelfranca

This comment has been minimized.

Member

rafaelfranca commented Feb 20, 2015

Could you rebase it?

@kamipo kamipo force-pushed the kamipo:bigint_pk_support branch 3 times, most recently Feb 21, 2015

@kamipo

This comment has been minimized.

Member

kamipo commented Feb 21, 2015

Rebased on master!

@kamipo kamipo force-pushed the kamipo:bigint_pk_support branch 2 times, most recently to cb19066 Feb 21, 2015

Allow `:limit` option for MySQL bigint primary key support
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

@kamipo kamipo force-pushed the kamipo:bigint_pk_support branch from cb19066 to b8d320c Feb 23, 2015

rafaelfranca added a commit that referenced this pull request Feb 23, 2015

Merge pull request #17631 from kamipo/bigint_pk_support
Allow limit option for MySQL bigint primary key support.

@rafaelfranca rafaelfranca merged commit acb12d3 into rails:master Feb 23, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@kamipo kamipo deleted the kamipo:bigint_pk_support branch Feb 23, 2015

kamipo added a commit to kamipo/rails that referenced this pull request Feb 24, 2015

Move back `new_column_definition` into `TableDefinition`
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

This comment has been minimized.

Contributor

jcoleman commented Aug 6, 2016

Is this also fixed for Postgres?

when :primary_key
column.type = :integer
column.auto_increment = true
end

This comment has been minimized.

@kamipo

kamipo Aug 6, 2016

Member

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

This comment has been minimized.

@jcoleman

jcoleman Aug 6, 2016

Contributor

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

Restore custom primary key tests lost at rails#26266
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