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

Fix table comment also being applied to the primary key column #36373

Conversation

guigs
Copy link
Contributor

@guigs guigs commented May 31, 2019

Summary

While investigating #29966 I found this related bug that a table created with a comment in a create_table call like this

create_table :foo, comment: 'A table comment'

Will also add the same comment to the primary key column in the database.

Detailed analysis

I traced back the origin of this bug. In the initial PR that added the database comments support, the comment option on the create table was not being passed to the primary key options, as can be seen here.

But then, after these 2 subsequent refactors 485e7f2 and b04c633, the comment option was not being excluded from primary key options anymore and thus the bug.

@kamipo kamipo merged commit d3e87ef into rails:master May 31, 2019
kamipo added a commit that referenced this pull request Jun 2, 2019
…lied-to-the-primary-key-column

Fix table comment also being applied to the primary key column
kamipo added a commit that referenced this pull request Jun 2, 2019
`create_table` and `t.column` have the same named options (e.g.
`:comment`, `:primary_key`), so it should be separated table options
from column options.

Related #36373.
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

2 participants