activerecord-spanner-adapter 0.7.0 → 1.1.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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/blunderbuss.yml +2 -0
  3. data/.github/sync-repo-settings.yaml +1 -1
  4. data/.github/workflows/acceptance-tests-on-emulator.yaml +8 -6
  5. data/.github/workflows/acceptance-tests-on-production.yaml +3 -3
  6. data/.github/workflows/ci.yaml +8 -6
  7. data/.github/workflows/nightly-acceptance-tests-on-emulator.yaml +9 -5
  8. data/.github/workflows/nightly-acceptance-tests-on-production.yaml +2 -2
  9. data/.github/workflows/nightly-unit-tests.yaml +9 -5
  10. data/.github/workflows/release-please-label.yml +4 -4
  11. data/.github/workflows/release-please.yml +12 -11
  12. data/.github/workflows/rubocop.yaml +4 -4
  13. data/.release-please-manifest.json +3 -0
  14. data/CHANGELOG.md +48 -26
  15. data/CONTRIBUTING.md +1 -1
  16. data/Gemfile +2 -1
  17. data/README.md +3 -3
  18. data/acceptance/cases/models/insert_all_test.rb +150 -0
  19. data/acceptance/cases/type/all_types_test.rb +24 -25
  20. data/acceptance/cases/type/json_test.rb +0 -2
  21. data/acceptance/schema/schema.rb +2 -4
  22. data/acceptance/test_helper.rb +1 -1
  23. data/activerecord-spanner-adapter.gemspec +1 -1
  24. data/examples/rails/README.md +8 -8
  25. data/lib/active_record/connection_adapters/spanner/schema_creation.rb +10 -4
  26. data/lib/active_record/connection_adapters/spanner_adapter.rb +64 -31
  27. data/lib/active_record/type/spanner/array.rb +19 -5
  28. data/lib/activerecord_spanner_adapter/base.rb +72 -5
  29. data/lib/activerecord_spanner_adapter/connection.rb +46 -20
  30. data/lib/activerecord_spanner_adapter/information_schema.rb +2 -1
  31. data/lib/activerecord_spanner_adapter/transaction.rb +52 -21
  32. data/lib/activerecord_spanner_adapter/version.rb +1 -1
  33. data/lib/arel/visitors/spanner.rb +10 -0
  34. data/lib/spanner_client_ext.rb +4 -0
  35. data/release-please-config.json +19 -0
  36. metadata +17 -17
  37. data/examples/snippets/interleaved-tables/README.md +0 -152
  38. data/examples/snippets/interleaved-tables/Rakefile +0 -13
  39. data/examples/snippets/interleaved-tables/application.rb +0 -109
  40. data/examples/snippets/interleaved-tables/config/database.yml +0 -8
  41. data/examples/snippets/interleaved-tables/db/migrate/01_create_tables.rb +0 -44
  42. data/examples/snippets/interleaved-tables/db/schema.rb +0 -32
  43. data/examples/snippets/interleaved-tables/db/seeds.rb +0 -40
  44. data/examples/snippets/interleaved-tables/models/album.rb +0 -15
  45. data/examples/snippets/interleaved-tables/models/singer.rb +0 -20
  46. data/examples/snippets/interleaved-tables/models/track.rb +0 -25
@@ -1,15 +0,0 @@
1
- # Copyright 2021 Google LLC
2
- #
3
- # Use of this source code is governed by an MIT-style
4
- # license that can be found in the LICENSE file or at
5
- # https://opensource.org/licenses/MIT.
6
-
7
- class Album < ActiveRecord::Base
8
- # `albums` is defined as INTERLEAVE IN PARENT `singers`. The primary key of `singers` is `singerid`.
9
- belongs_to :singer, foreign_key: "singerid"
10
-
11
- # `tracks` is defined as INTERLEAVE IN PARENT `albums`. The primary key of `albums` is (`singerid`, `albumid`), but
12
- # only `albumid` is used by ActiveRecord as the primary key. The `singerid` column is defined as a `parent_key` of
13
- # `albums` (see also the `db/migrate/01_create_tables.rb` file).
14
- has_many :tracks, foreign_key: "albumid"
15
- end
@@ -1,20 +0,0 @@
1
- # Copyright 2021 Google LLC
2
- #
3
- # Use of this source code is governed by an MIT-style
4
- # license that can be found in the LICENSE file or at
5
- # https://opensource.org/licenses/MIT.
6
-
7
- class Singer < ActiveRecord::Base
8
- # `albums` is defined as INTERLEAVE IN PARENT `singers`. The primary key of `albums` is (`singerid`, `albumid`), but
9
- # only `albumid` is used by ActiveRecord as the primary key. The `singerid` column is defined as a `parent_key` of
10
- # `albums` (see also the `db/migrate/01_create_tables.rb` file).
11
- has_many :albums, foreign_key: "singerid"
12
-
13
- # `tracks` is defined as INTERLEAVE IN PARENT `albums`. The primary key of `tracks` is
14
- # (`singerid`, `albumid`, `trackid`), but only `trackid` is used by ActiveRecord as the primary key. The `singerid`
15
- # and `albumid` columns are defined as `parent_key` of `tracks` (see also the `db/migrate/01_create_tables.rb` file).
16
- # The `singerid` column can therefore be used to associate tracks with a singer without the need to go through albums.
17
- # Note also that the inclusion of `singerid` as a column in `tracks` is required in order to make `tracks` a child
18
- # table of `albums` which has primary key (`singerid`, `albumid`).
19
- has_many :tracks, foreign_key: "singerid"
20
- end
@@ -1,25 +0,0 @@
1
- # Copyright 2021 Google LLC
2
- #
3
- # Use of this source code is governed by an MIT-style
4
- # license that can be found in the LICENSE file or at
5
- # https://opensource.org/licenses/MIT.
6
-
7
- class Track < ActiveRecord::Base
8
- # `tracks` is defined as INTERLEAVE IN PARENT `albums`. The primary key of `albums` is ()`singerid`, `albumid`).
9
- belongs_to :album, foreign_key: "albumid"
10
-
11
- # `tracks` also has a `singerid` column should be used to associate a Track with a Singer.
12
- belongs_to :singer, foreign_key: "singerid"
13
-
14
- # Override the default initialize method to automatically set the singer attribute when an album is given.
15
- def initialize attributes = nil
16
- super
17
- self.singer ||= album&.singer
18
- end
19
-
20
- def album=value
21
- super
22
- # Ensure the singer of this track is equal to the singer of the album that is set.
23
- self.singer = value&.singer
24
- end
25
- end