From 650395642ec07e8e43981cab2f65cda70296220f Mon Sep 17 00:00:00 2001 From: Lavika Date: Fri, 3 Nov 2023 17:44:42 +0530 Subject: [PATCH] Dont put precision as 6 by default --- .../connection_adapters/sqlserver/table_definition.rb | 6 +++--- .../sqlserver/type/time_value_fractional.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/active_record/connection_adapters/sqlserver/table_definition.rb b/lib/active_record/connection_adapters/sqlserver/table_definition.rb index b4292d4f9..93fa9c240 100644 --- a/lib/active_record/connection_adapters/sqlserver/table_definition.rb +++ b/lib/active_record/connection_adapters/sqlserver/table_definition.rb @@ -32,7 +32,7 @@ def smalldatetime(*names, **options) def datetime(*names, **options) names.each do |name| if options[:precision] - column(name, :datetime, **options) + datetime2(name, **options) else column(name, :datetime, **options) end @@ -103,10 +103,10 @@ def new_column_definition(name, type, **options) case type when :datetime, :timestamp # If no precision then default it to 6. - options[:precision] = 6 unless options.key?(:precision) + # options[:precision] = 6 unless options.key?(:precision) # If there is precision then column must be of type 'datetime2'. - type = :datetime2 unless options[:precision].nil? + type = :datetime2 if options[:precision] when :primary_key options[:is_identity] = true end diff --git a/lib/active_record/connection_adapters/sqlserver/type/time_value_fractional.rb b/lib/active_record/connection_adapters/sqlserver/type/time_value_fractional.rb index 3cb831d6f..f5c8744ea 100644 --- a/lib/active_record/connection_adapters/sqlserver/type/time_value_fractional.rb +++ b/lib/active_record/connection_adapters/sqlserver/type/time_value_fractional.rb @@ -42,7 +42,7 @@ def fractional_operator end def fractional_precision - 0.003333 + 0.00333 end def fractional_scale