diff options
author | Dinah Shi <dinahshi28@gmail.com> | 2017-12-02 14:30:10 +0800 |
---|---|---|
committer | Dinah Shi <dinahshi28@gmail.com> | 2017-12-02 14:30:10 +0800 |
commit | dd6338a0699f2301d4b2fc8653688b4c4183cee5 (patch) | |
tree | 18d2dfa8292fd57367ce0360407c9883ad787dfa /activerecord/test/cases/migration | |
parent | 11720c23476a49c6c75239182f096847172b1683 (diff) | |
download | rails-dd6338a0699f2301d4b2fc8653688b4c4183cee5.tar.gz rails-dd6338a0699f2301d4b2fc8653688b4c4183cee5.tar.bz2 rails-dd6338a0699f2301d4b2fc8653688b4c4183cee5.zip |
Extract sql fragment generators for alter table from PostgreSQL adapter
Diffstat (limited to 'activerecord/test/cases/migration')
-rw-r--r-- | activerecord/test/cases/migration/compatibility_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/compatibility_test.rb b/activerecord/test/cases/migration/compatibility_test.rb index 2fef2f796e..0fd55e6ae4 100644 --- a/activerecord/test/cases/migration/compatibility_test.rb +++ b/activerecord/test/cases/migration/compatibility_test.rb @@ -126,6 +126,23 @@ module ActiveRecord end assert_match(/LegacyMigration < ActiveRecord::Migration\[4\.2\]/, e.message) end + + if current_adapter?(:PostgreSQLAdapter) + class Testing < ActiveRecord::Base + end + + def test_legacy_change_column_with_null_executes_update + migration = Class.new(ActiveRecord::Migration[5.1]) { + def migrate(x) + change_column :testings, :foo, :string, null: false, default: "foobar" + end + }.new + + t = Testing.create! + ActiveRecord::Migrator.new(:up, [migration]).migrate + assert_equal ["foobar"], Testing.all.map(&:foo) + end + end end end end |