activerecord-sqlserver-adapter 6.1.2.0 → 7.0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +4 -1
- data/CHANGELOG.md +16 -41
- data/Gemfile +1 -0
- data/MIT-LICENSE +1 -1
- data/README.md +18 -9
- data/VERSION +1 -1
- data/activerecord-sqlserver-adapter.gemspec +2 -2
- data/appveyor.yml +4 -6
- data/lib/active_record/connection_adapters/sqlserver/core_ext/preloader.rb +7 -15
- data/lib/active_record/connection_adapters/sqlserver/database_statements.rb +15 -6
- data/lib/active_record/connection_adapters/sqlserver/quoting.rb +2 -4
- data/lib/active_record/connection_adapters/sqlserver/schema_creation.rb +11 -9
- data/lib/active_record/connection_adapters/sqlserver/schema_statements.rb +27 -8
- data/lib/active_record/connection_adapters/sqlserver/type/data.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/date.rb +1 -1
- data/lib/active_record/connection_adapters/sqlserver/type/datetime.rb +1 -1
- data/lib/active_record/connection_adapters/sqlserver/type/time.rb +1 -1
- data/lib/active_record/connection_adapters/sqlserver/utils.rb +16 -1
- data/lib/active_record/connection_adapters/sqlserver_adapter.rb +84 -74
- data/lib/arel/visitors/sqlserver.rb +2 -0
- data/test/cases/active_schema_test_sqlserver.rb +55 -0
- data/test/cases/coerced_tests.rb +301 -85
- data/test/cases/column_test_sqlserver.rb +58 -58
- data/test/cases/eager_load_too_many_ids_test_sqlserver.rb +18 -0
- data/test/cases/rake_test_sqlserver.rb +2 -1
- data/test/cases/schema_dumper_test_sqlserver.rb +1 -1
- data/test/migrations/transaction_table/1_table_will_never_be_created.rb +1 -1
- data/test/support/coerceable_test_sqlserver.rb +4 -4
- data/test/support/marshal_compatibility_fixtures/SQLServer/rails_6_1_topic.dump +0 -0
- data/test/support/marshal_compatibility_fixtures/SQLServer/rails_6_1_topic_associations.dump +0 -0
- data/test/support/rake_helpers.rb +3 -1
- metadata +15 -11
- data/test/support/marshal_compatibility_fixtures/SQLServer/rails_6_0_topic.dump +0 -0
- data/test/support/marshal_compatibility_fixtures/SQLServer/rails_6_0_topic_associations.dump +0 -0
|
@@ -277,8 +277,8 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
277
277
|
_(col.sql_type).must_equal "date"
|
|
278
278
|
_(col.type).must_equal :date
|
|
279
279
|
_(col.null).must_equal true
|
|
280
|
-
_(col.default).must_equal connection_dblib_73? ? Date.civil(
|
|
281
|
-
_(obj.date).must_equal Date.civil(
|
|
280
|
+
_(col.default).must_equal connection_dblib_73? ? Date.civil(1, 1, 1) : "0001-01-01"
|
|
281
|
+
_(obj.date).must_equal Date.civil(1, 1, 1)
|
|
282
282
|
_(col.default_function).must_be_nil
|
|
283
283
|
type = connection.lookup_cast_type_from_column(col)
|
|
284
284
|
_(type).must_be_instance_of Type::Date
|
|
@@ -287,22 +287,22 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
287
287
|
_(type.scale).must_be_nil
|
|
288
288
|
# Can cast strings. SQL Server format.
|
|
289
289
|
obj.date = "04-01-0001"
|
|
290
|
-
_(obj.date).must_equal Date.civil(
|
|
290
|
+
_(obj.date).must_equal Date.civil(1, 4, 1)
|
|
291
291
|
obj.save!
|
|
292
|
-
_(obj.date).must_equal Date.civil(
|
|
292
|
+
_(obj.date).must_equal Date.civil(1, 4, 1)
|
|
293
293
|
obj.reload
|
|
294
|
-
_(obj.date).must_equal Date.civil(
|
|
294
|
+
_(obj.date).must_equal Date.civil(1, 4, 1)
|
|
295
295
|
# Can cast strings. ISO format.
|
|
296
296
|
obj.date = "0001-04-01"
|
|
297
|
-
_(obj.date).must_equal Date.civil(
|
|
297
|
+
_(obj.date).must_equal Date.civil(1, 4, 1)
|
|
298
298
|
obj.save!
|
|
299
|
-
_(obj.date).must_equal Date.civil(
|
|
299
|
+
_(obj.date).must_equal Date.civil(1, 4, 1)
|
|
300
300
|
obj.reload
|
|
301
|
-
_(obj.date).must_equal Date.civil(
|
|
301
|
+
_(obj.date).must_equal Date.civil(1, 4, 1)
|
|
302
302
|
# Can filter by date range
|
|
303
303
|
_(obj).must_equal obj.class.where(date: obj.date..Date::Infinity.new).first
|
|
304
304
|
# Can keep and return assigned date.
|
|
305
|
-
assert_obj_set_and_save :date, Date.civil(1972,
|
|
305
|
+
assert_obj_set_and_save :date, Date.civil(1972, 4, 14)
|
|
306
306
|
# Can accept and cast time objects.
|
|
307
307
|
obj.date = Time.utc(2010, 4, 14, 12, 34, 56, 3000)
|
|
308
308
|
_(obj.date).must_equal Date.civil(2010, 4, 14)
|
|
@@ -315,7 +315,7 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
315
315
|
_(col.sql_type).must_equal "datetime"
|
|
316
316
|
_(col.type).must_equal :datetime
|
|
317
317
|
_(col.null).must_equal true
|
|
318
|
-
time = Time.utc 1753,
|
|
318
|
+
time = Time.utc 1753, 1, 1, 0, 0, 0, 123000
|
|
319
319
|
_(col.default).must_equal time, "Microseconds were <#{col.default.usec}> vs <123000>"
|
|
320
320
|
_(obj.datetime).must_equal time, "Microseconds were <#{obj.datetime.usec}> vs <123000>"
|
|
321
321
|
_(col.default_function).must_be_nil
|
|
@@ -327,7 +327,7 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
327
327
|
obj.save!
|
|
328
328
|
_(obj).must_equal obj.class.where(datetime: time).first
|
|
329
329
|
# Can save to proper accuracy and return again.
|
|
330
|
-
time = Time.utc 2010,
|
|
330
|
+
time = Time.utc 2010, 4, 1, 12, 34, 56, 3000
|
|
331
331
|
obj.datetime = time
|
|
332
332
|
_(obj.datetime).must_equal time, "Microseconds were <#{obj.datetime.usec}> vs <3000>"
|
|
333
333
|
obj.save!
|
|
@@ -338,8 +338,8 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
338
338
|
# Can filter by datetime range
|
|
339
339
|
_(obj).must_equal obj.class.where(datetime: time..DateTime::Infinity.new).first
|
|
340
340
|
# Will cast to true DB value on attribute write, save and return again.
|
|
341
|
-
time = Time.utc 2010,
|
|
342
|
-
time2 = Time.utc 2010,
|
|
341
|
+
time = Time.utc 2010, 4, 1, 12, 34, 56, 234567
|
|
342
|
+
time2 = Time.utc 2010, 4, 1, 12, 34, 56, 233000
|
|
343
343
|
obj.datetime = time
|
|
344
344
|
_(obj.datetime).must_equal time2, "Microseconds were <#{obj.datetime.usec}> vs <233000>"
|
|
345
345
|
obj.save!
|
|
@@ -427,8 +427,8 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
427
427
|
_(col.sql_type).must_equal "datetimeoffset(7)"
|
|
428
428
|
_(col.type).must_equal :datetimeoffset
|
|
429
429
|
_(col.null).must_equal true
|
|
430
|
-
_(col.default).must_equal Time.new(1984,
|
|
431
|
-
_(obj.datetimeoffset_7).must_equal Time.new(1984,
|
|
430
|
+
_(col.default).must_equal Time.new(1984, 1, 24, 4, 20, 0, -28800).change(nsec: 123456700), "Nanoseconds <#{col.default.nsec}> vs <123456700>"
|
|
431
|
+
_(obj.datetimeoffset_7).must_equal Time.new(1984, 1, 24, 4, 20, 0, -28800).change(nsec: 123456700), "Nanoseconds were <#{obj.datetimeoffset_7.nsec}> vs <999999900>"
|
|
432
432
|
_(col.default_function).must_be_nil
|
|
433
433
|
type = connection.lookup_cast_type_from_column(col)
|
|
434
434
|
_(type).must_be_instance_of Type::DateTimeOffset
|
|
@@ -436,12 +436,12 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
436
436
|
_(type.precision).must_equal 7
|
|
437
437
|
_(type.scale).must_be_nil
|
|
438
438
|
# Can save 100 nanosecond precisoins and return again.
|
|
439
|
-
obj.datetimeoffset_7 = Time.new(2010,
|
|
440
|
-
_(obj.datetimeoffset_7).must_equal Time.new(2010,
|
|
439
|
+
obj.datetimeoffset_7 = Time.new(2010, 4, 1, 12, 34, 56, +18000).change(nsec: 123456755)
|
|
440
|
+
_(obj.datetimeoffset_7).must_equal Time.new(2010, 4, 1, 12, 34, 56, +18000).change(nsec: 123456800), "Nanoseconds were <#{obj.datetimeoffset_7.nsec}> vs <123456800>"
|
|
441
441
|
obj.save!
|
|
442
|
-
_(obj.datetimeoffset_7).must_equal Time.new(2010,
|
|
442
|
+
_(obj.datetimeoffset_7).must_equal Time.new(2010, 4, 1, 12, 34, 56, +18000).change(nsec: 123456800), "Nanoseconds were <#{obj.datetimeoffset_7.nsec}> vs <123456800>"
|
|
443
443
|
obj.reload
|
|
444
|
-
_(obj.datetimeoffset_7).must_equal Time.new(2010,
|
|
444
|
+
_(obj.datetimeoffset_7).must_equal Time.new(2010, 4, 1, 12, 34, 56, +18000).change(nsec: 123456800), "Nanoseconds were <#{obj.datetimeoffset_7.nsec}> vs <123456800>"
|
|
445
445
|
# Maintains the timezone
|
|
446
446
|
time = ActiveSupport::TimeZone["America/Los_Angeles"].local 2010, 12, 31, 23, 59, 59, Rational(123456800, 1000)
|
|
447
447
|
obj.datetimeoffset_7 = time
|
|
@@ -470,8 +470,8 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
470
470
|
_(col.sql_type).must_equal "smalldatetime"
|
|
471
471
|
_(col.type).must_equal :smalldatetime
|
|
472
472
|
_(col.null).must_equal true
|
|
473
|
-
_(col.default).must_equal Time.utc(1901,
|
|
474
|
-
_(obj.smalldatetime).must_equal Time.utc(1901,
|
|
473
|
+
_(col.default).must_equal Time.utc(1901, 1, 1, 15, 45, 0, 0)
|
|
474
|
+
_(obj.smalldatetime).must_equal Time.utc(1901, 1, 1, 15, 45, 0, 0)
|
|
475
475
|
_(col.default_function).must_be_nil
|
|
476
476
|
type = connection.lookup_cast_type_from_column(col)
|
|
477
477
|
_(type).must_be_instance_of Type::SmallDateTime
|
|
@@ -479,12 +479,12 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
479
479
|
_(type.precision).must_be_nil
|
|
480
480
|
_(type.scale).must_be_nil
|
|
481
481
|
# Will remove fractional seconds and return again.
|
|
482
|
-
obj.smalldatetime = Time.utc(2078,
|
|
483
|
-
_(obj.smalldatetime).must_equal Time.utc(2078,
|
|
482
|
+
obj.smalldatetime = Time.utc(2078, 6, 5, 4, 20, 0, 3000)
|
|
483
|
+
_(obj.smalldatetime).must_equal Time.utc(2078, 6, 5, 4, 20, 0, 0), "Microseconds were <#{obj.smalldatetime.usec}> vs <0>"
|
|
484
484
|
obj.save!
|
|
485
|
-
_(obj.smalldatetime).must_equal Time.utc(2078,
|
|
485
|
+
_(obj.smalldatetime).must_equal Time.utc(2078, 6, 5, 4, 20, 0, 0), "Microseconds were <#{obj.reload.smalldatetime.usec}> vs <0>"
|
|
486
486
|
obj.reload
|
|
487
|
-
_(obj.smalldatetime).must_equal Time.utc(2078,
|
|
487
|
+
_(obj.smalldatetime).must_equal Time.utc(2078, 6, 5, 4, 20, 0, 0), "Microseconds were <#{obj.reload.smalldatetime.usec}> vs <0>"
|
|
488
488
|
end
|
|
489
489
|
|
|
490
490
|
it "time(7)" do
|
|
@@ -493,7 +493,7 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
493
493
|
_(col.sql_type).must_equal "time(7)"
|
|
494
494
|
_(col.type).must_equal :time
|
|
495
495
|
_(col.null).must_equal true
|
|
496
|
-
_(col.default).must_equal Time.utc(1900,
|
|
496
|
+
_(col.default).must_equal Time.utc(1900, 1, 1, 4, 20, 0, Rational(288321500, 1000)), "Nanoseconds were <#{col.default.nsec}> vs <288321500>"
|
|
497
497
|
_(col.default_function).must_be_nil
|
|
498
498
|
type = connection.lookup_cast_type_from_column(col)
|
|
499
499
|
_(type).must_be_instance_of Type::Time
|
|
@@ -501,22 +501,22 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
501
501
|
_(type.precision).must_equal 7
|
|
502
502
|
_(type.scale).must_be_nil
|
|
503
503
|
# Time's #usec precision (low micro)
|
|
504
|
-
obj.time_7 = Time.utc(2000,
|
|
505
|
-
_(obj.time_7).must_equal Time.utc(2000,
|
|
506
|
-
_(obj.time_7).must_equal Time.utc(2000,
|
|
504
|
+
obj.time_7 = Time.utc(2000, 1, 1, 15, 45, 0, 300)
|
|
505
|
+
_(obj.time_7).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 300), "Microseconds were <#{obj.time_7.usec}> vs <0>"
|
|
506
|
+
_(obj.time_7).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 300), "Nanoseconds were <#{obj.time_7.nsec}> vs <300>"
|
|
507
507
|
obj.save!; obj.reload
|
|
508
|
-
_(obj.time_7).must_equal Time.utc(2000,
|
|
509
|
-
_(obj.time_7).must_equal Time.utc(2000,
|
|
508
|
+
_(obj.time_7).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 300), "Microseconds were <#{obj.time_7.usec}> vs <0>"
|
|
509
|
+
_(obj.time_7).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 300), "Nanoseconds were <#{obj.time_7.nsec}> vs <300>"
|
|
510
510
|
# Time's #usec precision (high micro)
|
|
511
|
-
obj.time_7 = Time.utc(2000,
|
|
512
|
-
_(obj.time_7).must_equal Time.utc(2000,
|
|
511
|
+
obj.time_7 = Time.utc(2000, 1, 1, 15, 45, 0, 234567)
|
|
512
|
+
_(obj.time_7).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 234567), "Microseconds were <#{obj.time_7.usec}> vs <234567>"
|
|
513
513
|
obj.save!; obj.reload
|
|
514
|
-
_(obj.time_7).must_equal Time.utc(2000,
|
|
514
|
+
_(obj.time_7).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 234567), "Microseconds were <#{obj.time_7.usec}> vs <234567>"
|
|
515
515
|
# Time's #usec precision (high nano rounded)
|
|
516
|
-
obj.time_7 = Time.utc(2000,
|
|
517
|
-
_(obj.time_7).must_equal Time.utc(2000,
|
|
516
|
+
obj.time_7 = Time.utc(2000, 1, 1, 15, 45, 0, Rational(288321545, 1000))
|
|
517
|
+
_(obj.time_7).must_equal Time.utc(2000, 1, 1, 15, 45, 0, Rational(288321500, 1000)), "Nanoseconds were <#{obj.time_7.nsec}> vs <288321500>"
|
|
518
518
|
obj.save!; obj.reload
|
|
519
|
-
_(obj.time_7).must_equal Time.utc(2000,
|
|
519
|
+
_(obj.time_7).must_equal Time.utc(2000, 1, 1, 15, 45, 0, Rational(288321500, 1000)), "Nanoseconds were <#{obj.time_7.nsec}> vs <288321500>"
|
|
520
520
|
end
|
|
521
521
|
|
|
522
522
|
it "time(2)" do
|
|
@@ -533,20 +533,20 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
533
533
|
_(type.precision).must_equal 2
|
|
534
534
|
_(type.scale).must_be_nil
|
|
535
535
|
# Always uses TinyTDS/Windows 2000-01-01 convention too.
|
|
536
|
-
obj.time_2 = Time.utc(2015,
|
|
537
|
-
_(obj.time_2).must_equal Time.utc(2000,
|
|
536
|
+
obj.time_2 = Time.utc(2015, 1, 10, 15, 45, 0, 0)
|
|
537
|
+
_(obj.time_2).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 0)
|
|
538
538
|
obj.save!; obj.reload
|
|
539
|
-
_(obj.time_2).must_equal Time.utc(2000,
|
|
539
|
+
_(obj.time_2).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 0)
|
|
540
540
|
# Time's #usec precision (barely in 2 precision equal to 0.03 seconds)
|
|
541
|
-
obj.time_2 = Time.utc(2000,
|
|
542
|
-
_(obj.time_2).must_equal Time.utc(2000,
|
|
541
|
+
obj.time_2 = Time.utc(2000, 1, 1, 15, 45, 0, 30000)
|
|
542
|
+
_(obj.time_2).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 30000), "Microseconds were <#{obj.time_2.usec}> vs <30000>"
|
|
543
543
|
obj.save!; obj.reload
|
|
544
|
-
_(obj.time_2).must_equal Time.utc(2000,
|
|
544
|
+
_(obj.time_2).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 30000), "Microseconds were <#{obj.time_2.usec}> vs <30000>"
|
|
545
545
|
# Time's #usec precision (below 2 precision)
|
|
546
|
-
obj.time_2 = Time.utc(2000,
|
|
547
|
-
_(obj.time_2).must_equal Time.utc(2000,
|
|
546
|
+
obj.time_2 = Time.utc(2000, 1, 1, 15, 45, 0, 4000)
|
|
547
|
+
_(obj.time_2).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 0), "Microseconds were <#{obj.time_2.usec}> vs <0>"
|
|
548
548
|
obj.save!; obj.reload
|
|
549
|
-
_(obj.time_2).must_equal Time.utc(2000,
|
|
549
|
+
_(obj.time_2).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 0), "Microseconds were <#{obj.time_2.usec}> vs <0>"
|
|
550
550
|
end
|
|
551
551
|
|
|
552
552
|
it "time using default precision" do
|
|
@@ -555,7 +555,7 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
555
555
|
_(col.sql_type).must_equal "time(7)"
|
|
556
556
|
_(col.type).must_equal :time
|
|
557
557
|
_(col.null).must_equal true
|
|
558
|
-
_(col.default).must_equal Time.utc(1900,
|
|
558
|
+
_(col.default).must_equal Time.utc(1900, 1, 1, 15, 3, 42, Rational(62197800, 1000)), "Nanoseconds were <#{col.default.nsec}> vs <62197800>"
|
|
559
559
|
_(col.default_function).must_be_nil
|
|
560
560
|
type = connection.lookup_cast_type_from_column(col)
|
|
561
561
|
_(type).must_be_instance_of Type::Time
|
|
@@ -563,22 +563,22 @@ class ColumnTestSQLServer < ActiveRecord::TestCase
|
|
|
563
563
|
_(type.precision).must_equal 7
|
|
564
564
|
_(type.scale).must_be_nil
|
|
565
565
|
# Time's #usec precision (low micro)
|
|
566
|
-
obj.time_default = Time.utc(2000,
|
|
567
|
-
_(obj.time_default).must_equal Time.utc(2000,
|
|
568
|
-
_(obj.time_default).must_equal Time.utc(2000,
|
|
566
|
+
obj.time_default = Time.utc(2000, 1, 1, 15, 45, 0, 300)
|
|
567
|
+
_(obj.time_default).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 300), "Microseconds were <#{obj.time_default.usec}> vs <0>"
|
|
568
|
+
_(obj.time_default).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 300), "Nanoseconds were <#{obj.time_default.nsec}> vs <300>"
|
|
569
569
|
obj.save!; obj.reload
|
|
570
|
-
_(obj.time_default).must_equal Time.utc(2000,
|
|
571
|
-
_(obj.time_default).must_equal Time.utc(2000,
|
|
570
|
+
_(obj.time_default).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 300), "Microseconds were <#{obj.time_default.usec}> vs <0>"
|
|
571
|
+
_(obj.time_default).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 300), "Nanoseconds were <#{obj.time_default.nsec}> vs <300>"
|
|
572
572
|
# Time's #usec precision (high micro)
|
|
573
|
-
obj.time_default = Time.utc(2000,
|
|
574
|
-
_(obj.time_default).must_equal Time.utc(2000,
|
|
573
|
+
obj.time_default = Time.utc(2000, 1, 1, 15, 45, 0, 234567)
|
|
574
|
+
_(obj.time_default).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 234567), "Microseconds were <#{obj.time_default.usec}> vs <234567>"
|
|
575
575
|
obj.save!; obj.reload
|
|
576
|
-
_(obj.time_default).must_equal Time.utc(2000,
|
|
576
|
+
_(obj.time_default).must_equal Time.utc(2000, 1, 1, 15, 45, 0, 234567), "Microseconds were <#{obj.time_default.usec}> vs <234567>"
|
|
577
577
|
# Time's #usec precision (high nano rounded)
|
|
578
|
-
obj.time_default = Time.utc(2000,
|
|
579
|
-
_(obj.time_default).must_equal Time.utc(2000,
|
|
578
|
+
obj.time_default = Time.utc(2000, 1, 1, 15, 45, 0, Rational(288321545, 1000))
|
|
579
|
+
_(obj.time_default).must_equal Time.utc(2000, 1, 1, 15, 45, 0, Rational(288321500, 1000)), "Nanoseconds were <#{obj.time_default.nsec}> vs <288321500>"
|
|
580
580
|
obj.save!; obj.reload
|
|
581
|
-
_(obj.time_default).must_equal Time.utc(2000,
|
|
581
|
+
_(obj.time_default).must_equal Time.utc(2000, 1, 1, 15, 45, 0, Rational(288321500, 1000)), "Nanoseconds were <#{obj.time_default.nsec}> vs <288321500>"
|
|
582
582
|
end
|
|
583
583
|
|
|
584
584
|
# Character Strings
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require "cases/helper_sqlserver"
|
|
2
|
+
require "models/citation"
|
|
3
|
+
require "models/book"
|
|
4
|
+
|
|
5
|
+
class EagerLoadingTooManyIdsTest < ActiveRecord::TestCase
|
|
6
|
+
fixtures :citations
|
|
7
|
+
|
|
8
|
+
def test_batch_preloading_too_many_ids
|
|
9
|
+
in_clause_length = 10_000
|
|
10
|
+
|
|
11
|
+
# We Monkey patch Preloader to work with batches of 10_000 records.
|
|
12
|
+
# Expect: N Books queries + Citation query
|
|
13
|
+
expected_query_count = (Citation.count / in_clause_length.to_f).ceil + 1
|
|
14
|
+
assert_queries(expected_query_count) do
|
|
15
|
+
Citation.preload(:reference_of).to_a.size
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -176,7 +176,8 @@ class SQLServerRakeSchemaCacheDumpLoadTest < SQLServerRakeTest
|
|
|
176
176
|
it "dumps schema cache with SQL Server metadata" do
|
|
177
177
|
quietly { db_tasks.dump_schema_cache connection, filename }
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
filedata = File.read(filename)
|
|
180
|
+
schema_cache = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(filedata) : YAML.load(filedata)
|
|
180
181
|
|
|
181
182
|
col_id, col_name = connection.schema_cache.columns("users")
|
|
182
183
|
|
|
@@ -67,7 +67,7 @@ class SchemaDumperTestSQLServer < ActiveRecord::TestCase
|
|
|
67
67
|
_(columns["float_col"].sql_type).must_equal "float"
|
|
68
68
|
_(columns["string_col"].sql_type).must_equal "nvarchar(4000)"
|
|
69
69
|
_(columns["text_col"].sql_type).must_equal "nvarchar(max)"
|
|
70
|
-
_(columns["datetime_col"].sql_type).must_equal "
|
|
70
|
+
_(columns["datetime_col"].sql_type).must_equal "datetime2(6)"
|
|
71
71
|
_(columns["timestamp_col"].sql_type).must_equal "datetime"
|
|
72
72
|
_(columns["time_col"].sql_type).must_equal "time(7)"
|
|
73
73
|
_(columns["date_col"].sql_type).must_equal "date"
|
|
@@ -13,7 +13,7 @@ module ARTest
|
|
|
13
13
|
module ClassMethods
|
|
14
14
|
def coerce_tests!(*methods)
|
|
15
15
|
methods.each do |method|
|
|
16
|
-
|
|
16
|
+
coerced_tests.push(method)
|
|
17
17
|
coerced_test_warning(method)
|
|
18
18
|
end
|
|
19
19
|
end
|
|
@@ -24,7 +24,7 @@ module ARTest
|
|
|
24
24
|
|
|
25
25
|
undef_method(method)
|
|
26
26
|
end
|
|
27
|
-
STDOUT.puts "🙉 🙈 🙊 Undefined all tests: #{
|
|
27
|
+
STDOUT.puts "🙉 🙈 🙊 Undefined all tests: #{name}"
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
private
|
|
@@ -43,9 +43,9 @@ module ARTest
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
if result.blank?
|
|
46
|
-
STDOUT.puts "🐳 Unfound coerced test: #{
|
|
46
|
+
STDOUT.puts "🐳 Unfound coerced test: #{name}##{m}"
|
|
47
47
|
else
|
|
48
|
-
STDOUT.puts "🐵 Undefined coerced test: #{
|
|
48
|
+
STDOUT.puts "🐵 Undefined coerced test: #{name}##{m}"
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
end
|
|
Binary file
|
|
@@ -25,7 +25,9 @@ end
|
|
|
25
25
|
|
|
26
26
|
def ar_cases
|
|
27
27
|
@ar_cases ||= begin
|
|
28
|
-
Dir.glob("#{ARTest::SQLServer.root_activerecord}/test/cases/**/*_test.rb").reject {
|
|
28
|
+
Dir.glob("#{ARTest::SQLServer.root_activerecord}/test/cases/**/*_test.rb").reject {
|
|
29
|
+
|x| x.include?("/adapters/") || x.include?("/encryption/performance")
|
|
30
|
+
}.sort
|
|
29
31
|
end
|
|
30
32
|
end
|
|
31
33
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activerecord-sqlserver-adapter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 7.0.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ken Collins
|
|
@@ -14,7 +14,7 @@ authors:
|
|
|
14
14
|
autorequire:
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
|
-
date:
|
|
17
|
+
date: 2022-02-22 00:00:00.000000000 Z
|
|
18
18
|
dependencies:
|
|
19
19
|
- !ruby/object:Gem::Dependency
|
|
20
20
|
name: activerecord
|
|
@@ -22,14 +22,14 @@ dependencies:
|
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: 7.0.0
|
|
26
26
|
type: :runtime
|
|
27
27
|
prerelease: false
|
|
28
28
|
version_requirements: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: 7.0.0
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: tiny_tds
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -142,6 +142,7 @@ files:
|
|
|
142
142
|
- test/bin/install-freetds.sh
|
|
143
143
|
- test/bin/install-openssl.sh
|
|
144
144
|
- test/bin/setup.sh
|
|
145
|
+
- test/cases/active_schema_test_sqlserver.rb
|
|
145
146
|
- test/cases/adapter_test_sqlserver.rb
|
|
146
147
|
- test/cases/change_column_collation_test_sqlserver.rb
|
|
147
148
|
- test/cases/change_column_null_test_sqlserver.rb
|
|
@@ -149,6 +150,7 @@ files:
|
|
|
149
150
|
- test/cases/column_test_sqlserver.rb
|
|
150
151
|
- test/cases/connection_test_sqlserver.rb
|
|
151
152
|
- test/cases/disconnected_test_sqlserver.rb
|
|
153
|
+
- test/cases/eager_load_too_many_ids_test_sqlserver.rb
|
|
152
154
|
- test/cases/execute_procedure_test_sqlserver.rb
|
|
153
155
|
- test/cases/fetch_test_sqlserver.rb
|
|
154
156
|
- test/cases/fully_qualified_identifier_test_sqlserver.rb
|
|
@@ -212,8 +214,8 @@ files:
|
|
|
212
214
|
- test/support/connection_reflection.rb
|
|
213
215
|
- test/support/core_ext/query_cache.rb
|
|
214
216
|
- test/support/load_schema_sqlserver.rb
|
|
215
|
-
- test/support/marshal_compatibility_fixtures/SQLServer/
|
|
216
|
-
- test/support/marshal_compatibility_fixtures/SQLServer/
|
|
217
|
+
- test/support/marshal_compatibility_fixtures/SQLServer/rails_6_1_topic.dump
|
|
218
|
+
- test/support/marshal_compatibility_fixtures/SQLServer/rails_6_1_topic_associations.dump
|
|
217
219
|
- test/support/minitest_sqlserver.rb
|
|
218
220
|
- test/support/paths_sqlserver.rb
|
|
219
221
|
- test/support/rake_helpers.rb
|
|
@@ -224,8 +226,8 @@ licenses:
|
|
|
224
226
|
- MIT
|
|
225
227
|
metadata:
|
|
226
228
|
bug_tracker_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues
|
|
227
|
-
changelog_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/
|
|
228
|
-
source_code_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/
|
|
229
|
+
changelog_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/v7.0.0.0/CHANGELOG.md
|
|
230
|
+
source_code_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/v7.0.0.0
|
|
229
231
|
post_install_message:
|
|
230
232
|
rdoc_options: []
|
|
231
233
|
require_paths:
|
|
@@ -234,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
234
236
|
requirements:
|
|
235
237
|
- - ">="
|
|
236
238
|
- !ruby/object:Gem::Version
|
|
237
|
-
version: 2.
|
|
239
|
+
version: 2.7.0
|
|
238
240
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
241
|
requirements:
|
|
240
242
|
- - ">="
|
|
@@ -251,6 +253,7 @@ test_files:
|
|
|
251
253
|
- test/bin/install-freetds.sh
|
|
252
254
|
- test/bin/install-openssl.sh
|
|
253
255
|
- test/bin/setup.sh
|
|
256
|
+
- test/cases/active_schema_test_sqlserver.rb
|
|
254
257
|
- test/cases/adapter_test_sqlserver.rb
|
|
255
258
|
- test/cases/change_column_collation_test_sqlserver.rb
|
|
256
259
|
- test/cases/change_column_null_test_sqlserver.rb
|
|
@@ -258,6 +261,7 @@ test_files:
|
|
|
258
261
|
- test/cases/column_test_sqlserver.rb
|
|
259
262
|
- test/cases/connection_test_sqlserver.rb
|
|
260
263
|
- test/cases/disconnected_test_sqlserver.rb
|
|
264
|
+
- test/cases/eager_load_too_many_ids_test_sqlserver.rb
|
|
261
265
|
- test/cases/execute_procedure_test_sqlserver.rb
|
|
262
266
|
- test/cases/fetch_test_sqlserver.rb
|
|
263
267
|
- test/cases/fully_qualified_identifier_test_sqlserver.rb
|
|
@@ -321,8 +325,8 @@ test_files:
|
|
|
321
325
|
- test/support/connection_reflection.rb
|
|
322
326
|
- test/support/core_ext/query_cache.rb
|
|
323
327
|
- test/support/load_schema_sqlserver.rb
|
|
324
|
-
- test/support/marshal_compatibility_fixtures/SQLServer/
|
|
325
|
-
- test/support/marshal_compatibility_fixtures/SQLServer/
|
|
328
|
+
- test/support/marshal_compatibility_fixtures/SQLServer/rails_6_1_topic.dump
|
|
329
|
+
- test/support/marshal_compatibility_fixtures/SQLServer/rails_6_1_topic_associations.dump
|
|
326
330
|
- test/support/minitest_sqlserver.rb
|
|
327
331
|
- test/support/paths_sqlserver.rb
|
|
328
332
|
- test/support/rake_helpers.rb
|
|
Binary file
|