Skip to content

Commit f3a1758

Browse files
committed
Include cast type in column
Fix following rails/rails#54333
1 parent 5e3eb26 commit f3a1758

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/active_record/connection_adapters/sqlserver/schema_statements.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ def columns(table_name)
7070
column_definitions(table_name).map do |ci|
7171
sqlserver_options = ci.slice :ordinal_position, :is_primary, :is_identity, :table_name
7272
sql_type_metadata = fetch_type_metadata ci[:type], sqlserver_options
73+
7374
new_column(
7475
ci[:name],
76+
lookup_cast_type(ci[:type]),
7577
ci[:default_value],
7678
sql_type_metadata,
7779
ci[:null],
@@ -83,9 +85,10 @@ def columns(table_name)
8385
end
8486
end
8587

86-
def new_column(name, default, sql_type_metadata, null, default_function = nil, collation = nil, comment = nil, sqlserver_options = {})
88+
def new_column(name, cast_type, default, sql_type_metadata, null, default_function = nil, collation = nil, comment = nil, sqlserver_options = {})
8789
SQLServer::Column.new(
8890
name,
91+
cast_type,
8992
default,
9093
sql_type_metadata,
9194
null,

0 commit comments

Comments
 (0)