Skip to content

Commit b16d436

Browse files
committed
Fixes
1 parent f3a1758 commit b16d436

File tree

3 files changed

+53
-48
lines changed

3 files changed

+53
-48
lines changed

lib/active_record/connection_adapters/sqlserver/schema_creation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def visit_CreateIndexDefinition(o)
5050
end
5151

5252
def add_column_options!(sql, options)
53-
sql << " DEFAULT #{quote_default_expression(options[:default], options[:column])}" if options_include_default?(options)
53+
sql << " DEFAULT #{quote_default_expression_for_column_definition(options[:default], options[:column])}" if options_include_default?(options)
5454
if options[:collation].present?
5555
sql << " COLLATE #{options[:collation]}"
5656
end

test/cases/coerced_tests.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ def test_create_table_with_defaults_coerce
570570
five = columns.detect { |c| c.name == "five" }
571571

572572
assert_equal "hello", one.default
573-
assert_equal true, connection.lookup_cast_type_from_column(two).deserialize(two.default)
574-
assert_equal false, connection.lookup_cast_type_from_column(three).deserialize(three.default)
573+
assert_equal true, two.fetch_cast_type(connection).deserialize(two.default)
574+
assert_equal false, three.fetch_cast_type(connection).deserialize(three.default)
575575
assert_equal 1, four.default
576576
assert_equal "hello", five.default
577577
end
@@ -1971,12 +1971,17 @@ def with_marshable_time_defaults
19711971
# Revert changes
19721972
@connection.change_column_default(:sst_datatypes, :datetime, current_default) if current_default.present?
19731973
end
1974-
1975-
# We need to give the full path for this to work.
1976-
undef_method :schema_dump_path
1977-
def schema_dump_path
1974+
1975+
# We need to give the full paths for this to work.
1976+
undef_method :schema_dump_5_1_path
1977+
def schema_dump_5_1_path
19781978
File.join(ARTest::SQLServer.root_activerecord, "test/assets/schema_dump_5_1.yml")
19791979
end
1980+
1981+
undef_method :schema_dump_8_0_path
1982+
def schema_dump_8_0_path
1983+
File.join(ARTest::SQLServer.root_activerecord, "test/assets/schema_dump_8_0.yml")
1984+
end
19801985
end
19811986
end
19821987
end

0 commit comments

Comments
 (0)