diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-29 22:06:08 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-29 22:06:08 +0000 |
commit | d5e122002a806324f1613b3213b3038770e4328f (patch) | |
tree | 728c78168fec49915d7469c4f10db150232b3981 /activerecord/test | |
parent | 6b5238aadeb778a7067f93376a6a57a8eeda8379 (diff) | |
download | rails-d5e122002a806324f1613b3213b3038770e4328f.tar.gz rails-d5e122002a806324f1613b3213b3038770e4328f.tar.bz2 rails-d5e122002a806324f1613b3213b3038770e4328f.zip |
Oracle: fix lob and text default handling. Closes #7344.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6090 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/migration_test.rb | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/activerecord/test/migration_test.rb b/activerecord/test/migration_test.rb index 0757c6a0c9..3cc8c18988 100644 --- a/activerecord/test/migration_test.rb +++ b/activerecord/test/migration_test.rb @@ -113,6 +113,7 @@ if ActiveRecord::Base.connection.supports_migrations? t.column :two, :boolean, :default => true t.column :three, :boolean, :default => false t.column :four, :integer, :default => 1 + t.column :five, :text, :default => "hello" end columns = Person.connection.columns(:testings) @@ -120,11 +121,13 @@ if ActiveRecord::Base.connection.supports_migrations? two = columns.detect { |c| c.name == "two" } three = columns.detect { |c| c.name == "three" } four = columns.detect { |c| c.name == "four" } + five = columns.detect { |c| c.name == "five" } assert_equal "hello", one.default assert_equal true, two.default assert_equal false, three.default assert_equal 1, four.default + assert_equal "hello", five.default ensure Person.connection.drop_table :testings rescue nil @@ -435,6 +438,8 @@ if ActiveRecord::Base.connection.supports_migrations? Person.reset_column_information assert !Person.new.contributor? assert_nil Person.new.contributor + ensure + Person.connection.remove_column("people", "contributor") rescue nil end def test_change_column_with_new_default @@ -445,6 +450,8 @@ if ActiveRecord::Base.connection.supports_migrations? assert_nothing_raised { Person.connection.change_column "people", "administrator", :boolean, :default => false } Person.reset_column_information assert !Person.new.administrator? + ensure + Person.connection.remove_column("people", "administrator") rescue nil end def test_change_column_default @@ -685,29 +692,23 @@ if ActiveRecord::Base.connection.supports_migrations? Reminder.reset_sequence_name end -# FrontBase does not support default values on BLOB/CLOB columns - unless current_adapter?(:FrontBaseAdapter) - def test_create_table_with_binary_column - Person.connection.drop_table :binary_testings rescue nil + def test_create_table_with_binary_column + Person.connection.drop_table :binary_testings rescue nil - assert_nothing_raised { - Person.connection.create_table :binary_testings do |t| - t.column "data", :binary, :null => false - end - } + assert_nothing_raised { + Person.connection.create_table :binary_testings do |t| + t.column "data", :binary, :null => false + end + } - columns = Person.connection.columns(:binary_testings) - data_column = columns.detect { |c| c.name == "data" } + columns = Person.connection.columns(:binary_testings) + data_column = columns.detect { |c| c.name == "data" } - if current_adapter?(:OracleAdapter) - assert_equal "empty_blob()", data_column.default - else - assert_nil data_column.default - end + assert_nil data_column.default - Person.connection.drop_table :binary_testings rescue nil - end + Person.connection.drop_table :binary_testings rescue nil end + def test_migrator_with_duplicates assert_raises(ActiveRecord::DuplicateMigrationVersionError) do ActiveRecord::Migrator.migrate(File.dirname(__FILE__) + '/fixtures/migrations_with_duplicate/', nil) |