提交 4361f09f 编写于 作者: R Ryuta Kamizono

Merge pull request #36373 from guigs/fix-table-comment-also-being-applied-to-the-primary-key-column

Fix table comment also being applied to the primary key column
上级 f355f920
* Fix table comment also being applied to the primary key column.
*Guilherme Goettems Schneider*
* Fix merging left_joins to maintain its own `join_type` context. * Fix merging left_joins to maintain its own `join_type` context.
Fixes #36103. Fixes #36103.
......
...@@ -302,7 +302,7 @@ def create_table(table_name, **options) ...@@ -302,7 +302,7 @@ def create_table(table_name, **options)
if pk.is_a?(Array) if pk.is_a?(Array)
td.primary_keys pk td.primary_keys pk
else else
td.primary_key pk, options.fetch(:id, :primary_key), options td.primary_key pk, options.fetch(:id, :primary_key), options.except(:comment)
end end
end end
......
...@@ -44,6 +44,11 @@ class BlankComment < ActiveRecord::Base ...@@ -44,6 +44,11 @@ class BlankComment < ActiveRecord::Base
@connection.drop_table "blank_comments", if_exists: true @connection.drop_table "blank_comments", if_exists: true
end end
def test_primary_key_comment
column = Commented.columns_hash["id"]
assert_nil column.comment
end
def test_column_created_in_block def test_column_created_in_block
column = Commented.columns_hash["name"] column = Commented.columns_hash["name"]
assert_equal :string, column.type assert_equal :string, column.type
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册