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