Permalink
Browse files

Fixed db_schema_import when binary types are present (closes #3101) […

…DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4031 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 1d79a17 commit 5b63c843074dc74b11e821bd286422d80de20c9d @dhh dhh committed Mar 25, 2006
@@ -6,7 +6,7 @@ module Quoting
def quote(value, column = nil)
case value
when String
- if column && column.type == :binary
+ if column && column.type == :binary && column.class.respond_to?(:string_to_binary)
"'#{quote_string(column.class.string_to_binary(value))}'" # ' (for ruby-mode)
elsif column && [:integer, :float].include?(column.type)
value.to_s
@@ -455,6 +455,23 @@ def test_add_drop_table_with_prefix_and_suffix
Reminder.reset_sequence_name
end
+ 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, :default => "", :null => false
+ end
+ }
+
+ columns = Person.connection.columns(:binary_testings)
+ data_column = columns.detect { |c| c.name == "data" }
+
+ assert_equal "", data_column.default
+
+ 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)

0 comments on commit 5b63c84

Please sign in to comment.