diff options
author | Yoshiyuki Kinjo <yskkin@gmail.com> | 2018-08-15 12:03:40 +0900 |
---|---|---|
committer | Yoshiyuki Kinjo <yskkin@gmail.com> | 2018-08-15 12:32:44 +0900 |
commit | 6577d41266366e4ef116e18ba884358b8190fce7 (patch) | |
tree | e18006dbfbf2b44e7ebfeb3cbf42359c6baeba4c /activerecord/test | |
parent | e715a64732f7b2f82aa809e59cfee83f892795f1 (diff) | |
download | rails-6577d41266366e4ef116e18ba884358b8190fce7.tar.gz rails-6577d41266366e4ef116e18ba884358b8190fce7.tar.bz2 rails-6577d41266366e4ef116e18ba884358b8190fce7.zip |
Fix bulk change table ignores comment option on PostgreSQL.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/migration_test.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index d1292dc53d..868bb40ab2 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -793,12 +793,20 @@ if ActiveRecord::Base.connection.supports_bulk_alter? end def test_adding_multiple_columns - assert_queries(1) do + classname = ActiveRecord::Base.connection.class.name[/[^:]*$/] + expected_query_count = { + "Mysql2Adapter" => 1, + "PostgreSQLAdapter" => 2, # one for bulk change, one for comment + }.fetch(classname) { + raise "need an expected query count for #{classname}" + } + + assert_queries(expected_query_count) do with_bulk_change_table do |t| t.column :name, :string t.string :qualification, :experience t.integer :age, default: 0 - t.date :birthdate + t.date :birthdate, comment: "This is a comment" t.timestamps null: true end end @@ -806,6 +814,7 @@ if ActiveRecord::Base.connection.supports_bulk_alter? assert_equal 8, columns.size [:name, :qualification, :experience].each { |s| assert_equal :string, column(s).type } assert_equal "0", column(:age).default + assert_equal "This is a comment", column(:birthdate).comment end def test_removing_columns |