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
Restore the behaviour of the compatibility layer for integer-like PKs #27389
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r? @chancancode (@rails-bot has picked a reviewer for you, use r? to override) |
kamipo
force-pushed
the
fix_mysql_pk_dumping_correctly
branch
from
December 17, 2016 03:25
1462844
to
1a76eb9
Compare
cc @matthewd |
kamipo
force-pushed
the
fix_mysql_pk_dumping_correctly
branch
from
December 30, 2016 17:11
17fd5df
to
67bc8b3
Compare
kamipo
force-pushed
the
fix_mysql_pk_dumping_correctly
branch
2 times, most recently
from
January 19, 2017 17:54
facc301
to
fb9a1b1
Compare
kamipo
changed the title
Fix MySQL PK dumping correctly
Restore the behaviour of the compatibility layer for integer-like PKs
Jan 19, 2017
kamipo
force-pushed
the
fix_mysql_pk_dumping_correctly
branch
4 times, most recently
from
January 22, 2017 22:54
01b9b16
to
38c936c
Compare
The PR rails#27384 changed integer-like primary key to be autoincrement unless an explicit default. This means that integer-like primary key is restored as autoincrement unless dumping the default nil explicitly. We should dump integer-like primary key with default nil correctly.
The PR rails#27384 changed migration compatibility behaviour. ```ruby class CreateMasterData < ActiveRecord::Migration[5.0] def change create_table :master_data, id: :integer do |t| t.string :name end end end ``` Previously this migration created non-autoincremental primary key expected. But after the PR, the primary key changed to autoincremental, it is unexpected. This change restores the behaviour of the compatibility layer.
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.
kamipo
force-pushed
the
fix_mysql_pk_dumping_correctly
branch
from
February 4, 2017 12:05
38c936c
to
29c70ab
Compare
tgxworld
pushed a commit
to tgxworld/rails
that referenced
this pull request
Feb 7, 2017
…ctly Restore the behaviour of the compatibility layer for integer-like PKs * kamipo/fix_mysql_pk_dumping_correctly: Restore custom primary key tests lost at rails#26266 Restore the behaviour of the compatibility layer for integer-like PKs Correctly dump integer-like primary key with default nil
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow up to #26266.
Currently master branch was lost 1fa6c9e (#22090) and #18220 due
to #26266 and #26266 has another regression #27374.
1fa6c9e (#22090) and #18220 are to ease to create an auto incremental
(or not) bigint primary key and to dump the primary key correctly.
Since #26266, changed default primary key, and 1fa6c9e (#22090)
and #18220 were lost. And so currently an auto incremental int primary
key cannot dump (lose auto increment).
To fix the issue,
integer
andbigint
primary key has auto incrementas implicit default, and legacy migration still keep its previous
behavior as before #26266.
The PR #27384 changed migration compatibility behaviour.
Previously this migration created non-autoincremental primary key
expected. But after the PR, the primary key changed to autoincremental,
it is unexpected.
This change restores the behaviour of the compatibility layer.