aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/migration_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-01-15 01:24:23 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-01-15 01:24:23 +0000
commita491f928608f763cf4fa6067f7cf9529197afcae (patch)
tree0f6b43b37e135b66790109e5deb4b827585ee342 /activerecord/test/migration_test.rb
parente3103441114b1c5e7b67b71efa9c0b44e03645e6 (diff)
downloadrails-a491f928608f763cf4fa6067f7cf9529197afcae.tar.gz
rails-a491f928608f763cf4fa6067f7cf9529197afcae.tar.bz2
rails-a491f928608f763cf4fa6067f7cf9529197afcae.zip
MySQL, PostgreSQL: change_column_default quotes the default value and doesn't lose column type information. References #3987, closes #6664.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5935 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/migration_test.rb')
-rw-r--r--activerecord/test/migration_test.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/activerecord/test/migration_test.rb b/activerecord/test/migration_test.rb
index 355c459818..10cab682df 100644
--- a/activerecord/test/migration_test.rb
+++ b/activerecord/test/migration_test.rb
@@ -425,14 +425,26 @@ if ActiveRecord::Base.connection.supports_migrations?
end
def test_change_column_with_new_default
- Person.connection.add_column "people", "administrator", :boolean, :default => 1
+ Person.connection.add_column "people", "administrator", :boolean, :default => true
Person.reset_column_information
assert Person.new.administrator?
- assert_nothing_raised { Person.connection.change_column "people", "administrator", :boolean, :default => 0 }
+ assert_nothing_raised { Person.connection.change_column "people", "administrator", :boolean, :default => false }
Person.reset_column_information
assert !Person.new.administrator?
end
+
+ def test_change_column_default
+ Person.connection.change_column_default "people", "first_name", "Tester"
+ Person.reset_column_information
+ assert_equal "Tester", Person.new.first_name
+ end
+
+ def test_change_column_default_to_null
+ Person.connection.change_column_default "people", "first_name", nil
+ Person.reset_column_information
+ assert_nil Person.new.first_name
+ end
def test_add_table
assert !Reminder.table_exists?