File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 7
7
require "support/core_ext/query_cache"
8
8
require "support/minitest_sqlserver"
9
9
require "support/test_in_memory_oltp"
10
+ require "support/table_definition_sqlserver"
10
11
require "cases/helper"
11
12
require "support/load_schema_sqlserver"
12
13
require "support/coerceable_test_sqlserver"
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveRecord
4
+ module ConnectionAdapters
5
+ module SQLServer
6
+ class TableDefinition < ::ActiveRecord ::ConnectionAdapters ::TableDefinition
7
+ # SQL Server supports precision of 38 for decimal columns. In Rails the test schema includes a column
8
+ # with a precision of 55. This is a problem for SQL Server 2008. This method will override the default
9
+ # decimal method to limit the precision to 38 for the :atoms_in_universe column.
10
+ # See https://github.com/rails/rails/pull/51826/files#diff-2a57b61bbf9ee2c23938fc571d403799f68b4b530d65e2cde219a429bbf10af5L876
11
+ def decimal ( *names , **options )
12
+ throw "This 'decimal' method should only be used in a test environment." unless defined? ( ActiveSupport ::TestCase )
13
+
14
+ names . each do |name |
15
+ options_for_name = options . dup
16
+ options_for_name [ :precision ] = 38 if name == :atoms_in_universe && options_for_name [ :precision ] . to_i == 55
17
+
18
+ column ( name , :decimal , **options_for_name )
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
You can’t perform that action at this time.
0 commit comments