@@ -657,7 +657,7 @@ def migrate(x)
657
657
ensure
658
658
Person . reset_column_information
659
659
if Person . column_names . include? ( "last_name" )
660
- Person . connection . remove_column ( "people" , "last_name" )
660
+ Person . lease_connection . remove_column ( "people" , "last_name" )
661
661
end
662
662
end
663
663
end
@@ -1334,7 +1334,7 @@ class QueryCacheTest < ActiveRecord::TestCase
1334
1334
coerce_tests! :test_cache_does_not_wrap_results_in_arrays
1335
1335
def test_cache_does_not_wrap_results_in_arrays_coerced
1336
1336
Task . cache do
1337
- assert_equal 2 , Task . connection . select_value ( "SELECT count(*) AS count_all FROM tasks" )
1337
+ assert_equal 2 , Task . lease_connection . select_value ( "SELECT count(*) AS count_all FROM tasks" )
1338
1338
end
1339
1339
end
1340
1340
@@ -1493,7 +1493,7 @@ class RelationTest < ActiveRecord::TestCase
1493
1493
1494
1494
coerce_tests! :test_does_not_duplicate_optimizer_hints_on_merge
1495
1495
def test_does_not_duplicate_optimizer_hints_on_merge_coerced
1496
- escaped_table = Post . connection . quote_table_name ( "posts" )
1496
+ escaped_table = Post . lease_connection . quote_table_name ( "posts" )
1497
1497
expected = "SELECT #{ escaped_table } .* FROM #{ escaped_table } OPTION (OMGHINT)"
1498
1498
query = Post . optimizer_hints ( "OMGHINT" ) . merge ( Post . optimizer_hints ( "OMGHINT" ) ) . to_sql
1499
1499
assert_equal expected , query
@@ -1634,19 +1634,19 @@ class TransactionTest < ActiveRecord::TestCase
1634
1634
coerce_tests! :test_releasing_named_savepoints
1635
1635
def test_releasing_named_savepoints_coerced
1636
1636
Topic . transaction do
1637
- Topic . connection . materialize_transactions
1637
+ Topic . lease_connection . materialize_transactions
1638
1638
1639
- Topic . connection . create_savepoint ( "another" )
1640
- Topic . connection . release_savepoint ( "another" )
1639
+ Topic . lease_connection . create_savepoint ( "another" )
1640
+ Topic . lease_connection . release_savepoint ( "another" )
1641
1641
# We do not have a notion of releasing, so this does nothing vs raise an error.
1642
- Topic . connection . release_savepoint ( "another" )
1642
+ Topic . lease_connection . release_savepoint ( "another" )
1643
1643
end
1644
1644
end
1645
1645
1646
1646
# SQL Server does not have query for release_savepoint.
1647
1647
coerce_tests! :test_nested_transactions_after_disable_lazy_transactions
1648
1648
def test_nested_transactions_after_disable_lazy_transactions_coerced
1649
- Topic . connection . disable_lazy_transactions!
1649
+ Topic . lease_connection . disable_lazy_transactions!
1650
1650
1651
1651
capture_sql do
1652
1652
# RealTransaction (begin..commit)
@@ -1889,12 +1889,12 @@ class StatementCacheTest < ActiveRecord::TestCase
1889
1889
# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
1890
1890
coerce_tests! :test_statement_cache_values_differ
1891
1891
def test_statement_cache_values_differ_coerced
1892
- Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
1892
+ Book . lease_connection . remove_index ( :books , column : [ :author_id , :name ] )
1893
1893
1894
1894
original_test_statement_cache_values_differ
1895
1895
ensure
1896
1896
Book . where ( author_id : nil , name : 'my book' ) . delete_all
1897
- Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
1897
+ Book . lease_connection . add_index ( :books , [ :author_id , :name ] , unique : true )
1898
1898
end
1899
1899
end
1900
1900
end
@@ -2124,7 +2124,7 @@ def test_merge_doesnt_duplicate_same_clauses_coerced
2124
2124
2125
2125
non_mary_and_bob = Author . where . not ( id : [ mary , bob ] )
2126
2126
2127
- author_id = Author . connection . quote_table_name ( "authors.id" )
2127
+ author_id = Author . lease_connection . quote_table_name ( "authors.id" )
2128
2128
assert_queries_match ( /WHERE #{ Regexp . escape ( author_id ) } NOT IN \( (@\d ), \g <1>\) '/ ) do
2129
2129
assert_equal [ david ] , non_mary_and_bob . merge ( non_mary_and_bob )
2130
2130
end
@@ -2151,56 +2151,56 @@ class EnumTest < ActiveRecord::TestCase
2151
2151
# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
2152
2152
coerce_tests! %r{enums are distinct per class}
2153
2153
test "enums are distinct per class coerced" do
2154
- Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
2154
+ Book . lease_connection . remove_index ( :books , column : [ :author_id , :name ] )
2155
2155
2156
2156
send ( :'original_enums are distinct per class' )
2157
2157
ensure
2158
2158
Book . where ( author_id : nil , name : nil ) . delete_all
2159
- Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2159
+ Book . lease_connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2160
2160
end
2161
2161
2162
2162
# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
2163
2163
coerce_tests! %r{creating new objects with enum scopes}
2164
2164
test "creating new objects with enum scopes coerced" do
2165
- Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
2165
+ Book . lease_connection . remove_index ( :books , column : [ :author_id , :name ] )
2166
2166
2167
2167
send ( :'original_creating new objects with enum scopes' )
2168
2168
ensure
2169
2169
Book . where ( author_id : nil , name : nil ) . delete_all
2170
- Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2170
+ Book . lease_connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2171
2171
end
2172
2172
2173
2173
# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
2174
2174
coerce_tests! %r{enums are inheritable}
2175
2175
test "enums are inheritable coerced" do
2176
- Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
2176
+ Book . lease_connection . remove_index ( :books , column : [ :author_id , :name ] )
2177
2177
2178
2178
send ( :'original_enums are inheritable' )
2179
2179
ensure
2180
2180
Book . where ( author_id : nil , name : nil ) . delete_all
2181
- Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2181
+ Book . lease_connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2182
2182
end
2183
2183
2184
2184
# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
2185
2185
coerce_tests! %r{declare multiple enums at a time}
2186
2186
test "declare multiple enums at a time coerced" do
2187
- Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
2187
+ Book . lease_connection . remove_index ( :books , column : [ :author_id , :name ] )
2188
2188
2189
2189
send ( :'original_declare multiple enums at a time' )
2190
2190
ensure
2191
2191
Book . where ( author_id : nil , name : nil ) . delete_all
2192
- Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2192
+ Book . lease_connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2193
2193
end
2194
2194
2195
2195
# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
2196
2196
coerce_tests! %r{serializable\? with large number label}
2197
2197
test "serializable? with large number label coerced" do
2198
- Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
2198
+ Book . lease_connection . remove_index ( :books , column : [ :author_id , :name ] )
2199
2199
2200
2200
send ( :'original_serializable\? with large number label' )
2201
2201
ensure
2202
2202
Book . where ( author_id : nil , name : nil ) . delete_all
2203
- Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2203
+ Book . lease_connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2204
2204
end
2205
2205
end
2206
2206
@@ -2401,45 +2401,45 @@ class FieldOrderedValuesTest < ActiveRecord::TestCase
2401
2401
# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
2402
2402
coerce_tests! :test_in_order_of_with_enums_values
2403
2403
def test_in_order_of_with_enums_values_coerced
2404
- Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
2404
+ Book . lease_connection . remove_index ( :books , column : [ :author_id , :name ] )
2405
2405
2406
2406
original_test_in_order_of_with_enums_values
2407
2407
ensure
2408
2408
Book . where ( author_id : nil , name : nil ) . delete_all
2409
- Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2409
+ Book . lease_connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2410
2410
end
2411
2411
2412
2412
# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
2413
2413
coerce_tests! :test_in_order_of_with_string_column
2414
2414
def test_in_order_of_with_string_column_coerced
2415
- Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
2415
+ Book . lease_connection . remove_index ( :books , column : [ :author_id , :name ] )
2416
2416
2417
2417
original_test_in_order_of_with_string_column
2418
2418
ensure
2419
2419
Book . where ( author_id : nil , name : nil ) . delete_all
2420
- Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2420
+ Book . lease_connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2421
2421
end
2422
2422
2423
2423
# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
2424
2424
coerce_tests! :test_in_order_of_with_enums_keys
2425
2425
def test_in_order_of_with_enums_keys_coerced
2426
- Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
2426
+ Book . lease_connection . remove_index ( :books , column : [ :author_id , :name ] )
2427
2427
2428
2428
original_test_in_order_of_with_enums_keys
2429
2429
ensure
2430
2430
Book . where ( author_id : nil , name : nil ) . delete_all
2431
- Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2431
+ Book . lease_connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2432
2432
end
2433
2433
2434
2434
# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
2435
2435
coerce_tests! :test_in_order_of_with_nil
2436
2436
def test_in_order_of_with_nil_coerced
2437
- Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
2437
+ Book . lease_connection . remove_index ( :books , column : [ :author_id , :name ] )
2438
2438
2439
2439
original_test_in_order_of_with_nil
2440
2440
ensure
2441
2441
Book . where ( author_id : nil , name : nil ) . delete_all
2442
- Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2442
+ Book . lease_connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2443
2443
end
2444
2444
end
2445
2445
0 commit comments