activerecord-spanner-adapter 1.5.1 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/acceptance-tests-on-emulator.yaml +1 -1
  3. data/.github/workflows/acceptance-tests-on-production.yaml +5 -3
  4. data/.github/workflows/ci.yaml +1 -1
  5. data/.github/workflows/nightly-acceptance-tests-on-emulator.yaml +1 -1
  6. data/.github/workflows/nightly-acceptance-tests-on-production.yaml +5 -3
  7. data/.github/workflows/nightly-unit-tests.yaml +1 -1
  8. data/.github/workflows/release-please-label.yml +1 -1
  9. data/.github/workflows/rubocop.yaml +1 -1
  10. data/.release-please-manifest.json +1 -1
  11. data/.rubocop.yml +1 -1
  12. data/CHANGELOG.md +14 -0
  13. data/Gemfile +7 -2
  14. data/README.md +10 -10
  15. data/acceptance/cases/interleaved_associations/has_many_associations_using_interleaved_test.rb +6 -0
  16. data/acceptance/cases/migration/change_schema_test.rb +19 -3
  17. data/acceptance/cases/migration/schema_dumper_test.rb +10 -1
  18. data/acceptance/cases/models/interleave_test.rb +6 -0
  19. data/acceptance/cases/tasks/database_tasks_test.rb +340 -2
  20. data/acceptance/cases/transactions/optimistic_locking_test.rb +6 -0
  21. data/acceptance/cases/transactions/read_write_transactions_test.rb +24 -0
  22. data/acceptance/models/table_with_sequence.rb +10 -0
  23. data/acceptance/schema/schema.rb +65 -19
  24. data/acceptance/test_helper.rb +1 -1
  25. data/activerecord-spanner-adapter.gemspec +1 -1
  26. data/benchmarks/application.rb +1 -1
  27. data/examples/snippets/bit-reversed-sequence/README.md +103 -0
  28. data/examples/snippets/bit-reversed-sequence/Rakefile +13 -0
  29. data/examples/snippets/bit-reversed-sequence/application.rb +68 -0
  30. data/examples/snippets/bit-reversed-sequence/config/database.yml +8 -0
  31. data/examples/snippets/bit-reversed-sequence/db/migrate/01_create_tables.rb +33 -0
  32. data/examples/snippets/bit-reversed-sequence/db/schema.rb +31 -0
  33. data/examples/snippets/bit-reversed-sequence/db/seeds.rb +31 -0
  34. data/examples/snippets/bit-reversed-sequence/models/album.rb +11 -0
  35. data/examples/snippets/bit-reversed-sequence/models/singer.rb +15 -0
  36. data/examples/snippets/interleaved-tables/README.md +44 -53
  37. data/examples/snippets/interleaved-tables/Rakefile +2 -2
  38. data/examples/snippets/interleaved-tables/application.rb +2 -2
  39. data/examples/snippets/interleaved-tables/db/migrate/01_create_tables.rb +12 -18
  40. data/examples/snippets/interleaved-tables/db/schema.rb +9 -7
  41. data/examples/snippets/interleaved-tables/db/seeds.rb +1 -1
  42. data/examples/snippets/interleaved-tables/models/album.rb +3 -7
  43. data/examples/snippets/interleaved-tables/models/singer.rb +1 -1
  44. data/examples/snippets/interleaved-tables/models/track.rb +6 -7
  45. data/examples/snippets/interleaved-tables-before-7.1/README.md +167 -0
  46. data/examples/snippets/interleaved-tables-before-7.1/Rakefile +13 -0
  47. data/examples/snippets/interleaved-tables-before-7.1/application.rb +126 -0
  48. data/examples/snippets/interleaved-tables-before-7.1/config/database.yml +8 -0
  49. data/examples/snippets/interleaved-tables-before-7.1/db/migrate/01_create_tables.rb +44 -0
  50. data/examples/snippets/interleaved-tables-before-7.1/db/schema.rb +37 -0
  51. data/examples/snippets/interleaved-tables-before-7.1/db/seeds.rb +40 -0
  52. data/examples/snippets/interleaved-tables-before-7.1/models/album.rb +20 -0
  53. data/examples/snippets/interleaved-tables-before-7.1/models/singer.rb +18 -0
  54. data/examples/snippets/interleaved-tables-before-7.1/models/track.rb +28 -0
  55. data/examples/snippets/query-logs/README.md +43 -0
  56. data/examples/snippets/query-logs/Rakefile +13 -0
  57. data/examples/snippets/query-logs/application.rb +63 -0
  58. data/examples/snippets/query-logs/config/database.yml +8 -0
  59. data/examples/snippets/query-logs/db/migrate/01_create_tables.rb +21 -0
  60. data/examples/snippets/query-logs/db/schema.rb +31 -0
  61. data/examples/snippets/query-logs/db/seeds.rb +24 -0
  62. data/examples/snippets/query-logs/models/album.rb +9 -0
  63. data/examples/snippets/query-logs/models/singer.rb +9 -0
  64. data/examples/snippets/read-only-transactions/application.rb +1 -1
  65. data/lib/active_record/connection_adapters/spanner/column.rb +13 -0
  66. data/lib/active_record/connection_adapters/spanner/database_statements.rb +144 -35
  67. data/lib/active_record/connection_adapters/spanner/schema_cache.rb +3 -21
  68. data/lib/active_record/connection_adapters/spanner/schema_creation.rb +11 -2
  69. data/lib/active_record/connection_adapters/spanner/schema_definitions.rb +4 -0
  70. data/lib/active_record/connection_adapters/spanner/schema_statements.rb +12 -2
  71. data/lib/active_record/connection_adapters/spanner_adapter.rb +28 -9
  72. data/lib/activerecord_spanner_adapter/base.rb +64 -20
  73. data/lib/activerecord_spanner_adapter/foreign_key.rb +6 -2
  74. data/lib/activerecord_spanner_adapter/index/column.rb +3 -1
  75. data/lib/activerecord_spanner_adapter/index.rb +4 -2
  76. data/lib/activerecord_spanner_adapter/information_schema.rb +124 -72
  77. data/lib/activerecord_spanner_adapter/primary_key.rb +1 -1
  78. data/lib/activerecord_spanner_adapter/table/column.rb +7 -10
  79. data/lib/activerecord_spanner_adapter/version.rb +1 -1
  80. data/lib/arel/visitors/spanner.rb +3 -1
  81. data/lib/spanner_client_ext.rb +6 -1
  82. metadata +34 -5
@@ -139,7 +139,9 @@ module Arel # :nodoc: all
139
139
  # Do not generate a query parameter if the value should be set to the PENDING_COMMIT_TIMESTAMP(), as that is
140
140
  # not supported as a parameter value by Cloud Spanner.
141
141
  return collector << "PENDING_COMMIT_TIMESTAMP()" \
142
- if o.value.type.is_a?(ActiveRecord::Type::Spanner::Time) && o.value.value == :commit_timestamp
142
+ if o.value.respond_to?(:type) \
143
+ && o.value.type.is_a?(ActiveRecord::Type::Spanner::Time) \
144
+ && o.value.value == :commit_timestamp
143
145
  collector.add_bind(o.value, &bind_block)
144
146
  end
145
147
  # rubocop:enable Naming/MethodName
@@ -68,7 +68,12 @@ module Google
68
68
  snp_grpc = service.create_snapshot \
69
69
  path, timestamp: (timestamp || read_timestamp),
70
70
  staleness: (staleness || exact_staleness)
71
- Snapshot.from_grpc snp_grpc, self
71
+ num_args = Snapshot.method(:from_grpc).arity
72
+ if num_args == 3
73
+ Snapshot.from_grpc snp_grpc, self, nil
74
+ else
75
+ Snapshot.from_grpc snp_grpc, self
76
+ end
72
77
  end
73
78
 
74
79
  def create_pdml
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-spanner-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-13 00:00:00.000000000 Z
11
+ date: 2024-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-spanner
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: 6.0.0
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '7.1'
36
+ version: '7.2'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 6.0.0
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '7.1'
46
+ version: '7.2'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: autotest-suffix
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -312,6 +312,7 @@ files:
312
312
  - acceptance/models/organization.rb
313
313
  - acceptance/models/post.rb
314
314
  - acceptance/models/singer.rb
315
+ - acceptance/models/table_with_sequence.rb
315
316
  - acceptance/models/track.rb
316
317
  - acceptance/models/transaction.rb
317
318
  - acceptance/schema/schema.rb
@@ -342,6 +343,15 @@ files:
342
343
  - examples/snippets/array-data-type/db/seeds.rb
343
344
  - examples/snippets/array-data-type/models/entity_with_array_types.rb
344
345
  - examples/snippets/bin/create_emulator_instance.rb
346
+ - examples/snippets/bit-reversed-sequence/README.md
347
+ - examples/snippets/bit-reversed-sequence/Rakefile
348
+ - examples/snippets/bit-reversed-sequence/application.rb
349
+ - examples/snippets/bit-reversed-sequence/config/database.yml
350
+ - examples/snippets/bit-reversed-sequence/db/migrate/01_create_tables.rb
351
+ - examples/snippets/bit-reversed-sequence/db/schema.rb
352
+ - examples/snippets/bit-reversed-sequence/db/seeds.rb
353
+ - examples/snippets/bit-reversed-sequence/models/album.rb
354
+ - examples/snippets/bit-reversed-sequence/models/singer.rb
345
355
  - examples/snippets/bulk-insert/README.md
346
356
  - examples/snippets/bulk-insert/Rakefile
347
357
  - examples/snippets/bulk-insert/application.rb
@@ -395,6 +405,16 @@ files:
395
405
  - examples/snippets/hints/db/seeds.rb
396
406
  - examples/snippets/hints/models/album.rb
397
407
  - examples/snippets/hints/models/singer.rb
408
+ - examples/snippets/interleaved-tables-before-7.1/README.md
409
+ - examples/snippets/interleaved-tables-before-7.1/Rakefile
410
+ - examples/snippets/interleaved-tables-before-7.1/application.rb
411
+ - examples/snippets/interleaved-tables-before-7.1/config/database.yml
412
+ - examples/snippets/interleaved-tables-before-7.1/db/migrate/01_create_tables.rb
413
+ - examples/snippets/interleaved-tables-before-7.1/db/schema.rb
414
+ - examples/snippets/interleaved-tables-before-7.1/db/seeds.rb
415
+ - examples/snippets/interleaved-tables-before-7.1/models/album.rb
416
+ - examples/snippets/interleaved-tables-before-7.1/models/singer.rb
417
+ - examples/snippets/interleaved-tables-before-7.1/models/track.rb
398
418
  - examples/snippets/interleaved-tables/README.md
399
419
  - examples/snippets/interleaved-tables/Rakefile
400
420
  - examples/snippets/interleaved-tables/application.rb
@@ -442,6 +462,15 @@ files:
442
462
  - examples/snippets/partitioned-dml/db/seeds.rb
443
463
  - examples/snippets/partitioned-dml/models/album.rb
444
464
  - examples/snippets/partitioned-dml/models/singer.rb
465
+ - examples/snippets/query-logs/README.md
466
+ - examples/snippets/query-logs/Rakefile
467
+ - examples/snippets/query-logs/application.rb
468
+ - examples/snippets/query-logs/config/database.yml
469
+ - examples/snippets/query-logs/db/migrate/01_create_tables.rb
470
+ - examples/snippets/query-logs/db/schema.rb
471
+ - examples/snippets/query-logs/db/seeds.rb
472
+ - examples/snippets/query-logs/models/album.rb
473
+ - examples/snippets/query-logs/models/singer.rb
445
474
  - examples/snippets/quickstart/README.md
446
475
  - examples/snippets/quickstart/Rakefile
447
476
  - examples/snippets/quickstart/application.rb
@@ -548,7 +577,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
548
577
  - !ruby/object:Gem::Version
549
578
  version: '0'
550
579
  requirements: []
551
- rubygems_version: 3.4.19
580
+ rubygems_version: 3.5.3
552
581
  signing_key:
553
582
  specification_version: 4
554
583
  summary: Rails ActiveRecord connector for Google Spanner Database