diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-10-07 04:52:09 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-10-07 04:52:09 +0000 |
commit | 5a276643d163b675dea459071824deae3ebec9f2 (patch) | |
tree | f74ee2aa6d7df3101fdc3a769a315d97218210e2 /activerecord/test/migration_test.rb | |
parent | 907d6ce28587593ec2bc93b4aeb216ca9d583a95 (diff) | |
download | rails-5a276643d163b675dea459071824deae3ebec9f2.tar.gz rails-5a276643d163b675dea459071824deae3ebec9f2.tar.bz2 rails-5a276643d163b675dea459071824deae3ebec9f2.zip |
Allow change_column to set NOT NULL in the PostgreSQL adaptor. Closes #3904 [tarmo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7766 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/migration_test.rb')
-rw-r--r-- | activerecord/test/migration_test.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/activerecord/test/migration_test.rb b/activerecord/test/migration_test.rb index 9ac9bb10fd..a1eda28aa4 100644 --- a/activerecord/test/migration_test.rb +++ b/activerecord/test/migration_test.rb @@ -42,7 +42,7 @@ if ActiveRecord::Base.connection.supports_migrations? Reminder.reset_column_information %w(last_name key bio age height wealth birthday favorite_day - moment_of_truth male administrator).each do |column| + moment_of_truth male administrator funny).each do |column| Person.connection.remove_column('people', column) rescue nil end Person.connection.remove_column("people", "first_name") rescue nil @@ -450,6 +450,20 @@ if ActiveRecord::Base.connection.supports_migrations? ActiveRecord::Base.connection.drop_table :octopi rescue nil end end + + unless current_adapter?(:SQLiteAdapter) + def test_change_column_nullability + Person.connection.add_column "people", "funny", :boolean + Person.reset_column_information + assert Person.columns_hash["funny"].null, "Column 'funny' must initially allow nulls" + Person.connection.change_column "people", "funny", :boolean, :null => false, :default => true + Person.reset_column_information + assert !Person.columns_hash["funny"].null, "Column 'funny' must *not* allow nulls at this point" + Person.connection.change_column "people", "funny", :boolean, :null => true + Person.reset_column_information + assert Person.columns_hash["funny"].null, "Column 'funny' must allow nulls again at this point" + end + end def test_rename_table_with_an_index begin |