diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-01-08 15:51:06 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-01-08 15:51:06 +0100 |
commit | 724509a9d5322ff502aefa90dd282ba33a281a96 (patch) | |
tree | 24626ff4ef1bbe98775ee08ea9e35ab9941e4e71 /activerecord/test | |
parent | b502e3db958fdfd27453db52f6f455183a449831 (diff) | |
download | rails-724509a9d5322ff502aefa90dd282ba33a281a96.tar.gz rails-724509a9d5322ff502aefa90dd282ba33a281a96.tar.bz2 rails-724509a9d5322ff502aefa90dd282ba33a281a96.zip |
make `change_column_null` reversible. Closes #13576.
Closes #13623.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/migration/change_schema_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/change_schema_test.rb b/activerecord/test/cases/migration/change_schema_test.rb index e43e256d24..294f2eb9fe 100644 --- a/activerecord/test/cases/migration/change_schema_test.rb +++ b/activerecord/test/cases/migration/change_schema_test.rb @@ -308,6 +308,22 @@ module ActiveRecord assert_equal 2000, connection.select_values("SELECT money FROM testings").first.to_i end + def test_change_column_null + testing_table_with_only_foo_attribute do + notnull_migration = Class.new(ActiveRecord::Migration) do + def change + change_column_null :testings, :foo, false + end + end + notnull_migration.new.suppress_messages do + notnull_migration.migrate(:up) + assert_equal false, connection.columns(:testings).find{ |c| c.name == "foo"}.null + notnull_migration.migrate(:down) + assert connection.columns(:testings).find{ |c| c.name == "foo"}.null + end + end + end + def test_column_exists connection.create_table :testings do |t| t.column :foo, :string |