Skip to content

Commit 5f04134

Browse files
committed
Smaller fix
1 parent 1a63942 commit 5f04134

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/active_record/connection_adapters/sqlserver/schema_statements.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,21 +323,19 @@ def check_constraints(table_name)
323323
end
324324

325325
def type_to_sql(type, limit: nil, precision: nil, scale: nil, **)
326-
type = type.to_sym
327-
328-
type_limitable = [:string, :integer, :float, :char, :nchar, :varchar, :nvarchar, :binary_basic].include?(type)
326+
type_limitable = %w[string integer float char nchar varchar nvarchar binary_basic].include?(type.to_s)
329327
limit = nil unless type_limitable
330328

331-
case type
332-
when :integer
329+
case type.to_s
330+
when "integer"
333331
case limit
334332
when 1 then "tinyint"
335333
when 2 then "smallint"
336334
when 3..4, nil then "integer"
337335
when 5..8 then "bigint"
338336
else raise(ActiveRecordError, "No integer type has byte size #{limit}. Use a numeric with precision 0 instead.")
339337
end
340-
when :time # https://learn.microsoft.com/en-us/sql/t-sql/data-types/time-transact-sql
338+
when "time" # https://learn.microsoft.com/en-us/sql/t-sql/data-types/time-transact-sql
341339
column_type_sql = type.to_s.dup
342340
if precision
343341
if (0..7) === precision
@@ -347,7 +345,7 @@ def type_to_sql(type, limit: nil, precision: nil, scale: nil, **)
347345
end
348346
end
349347
column_type_sql
350-
when :datetime2
348+
when "datetime2"
351349
column_type_sql = super
352350
if precision
353351
if (0..7) === precision
@@ -357,7 +355,7 @@ def type_to_sql(type, limit: nil, precision: nil, scale: nil, **)
357355
end
358356
end
359357
column_type_sql
360-
when :datetimeoffset
358+
when "datetimeoffset"
361359
column_type_sql = super
362360
if precision
363361
if (0..7) === precision

0 commit comments

Comments
 (0)