activerecord-spanner-adapter 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -1
  3. data/.github/blunderbuss.yml +2 -0
  4. data/.github/sync-repo-settings.yaml +1 -1
  5. data/.github/workflows/acceptance-tests-on-emulator.yaml +8 -6
  6. data/.github/workflows/acceptance-tests-on-production.yaml +3 -3
  7. data/.github/workflows/ci.yaml +8 -6
  8. data/.github/workflows/nightly-acceptance-tests-on-emulator.yaml +9 -5
  9. data/.github/workflows/nightly-acceptance-tests-on-production.yaml +2 -2
  10. data/.github/workflows/nightly-unit-tests.yaml +9 -5
  11. data/.github/workflows/release-please-label.yml +4 -4
  12. data/.github/workflows/release-please.yml +12 -11
  13. data/.github/workflows/rubocop.yaml +4 -4
  14. data/.release-please-manifest.json +3 -0
  15. data/CHANGELOG.md +46 -31
  16. data/CONTRIBUTING.md +1 -1
  17. data/Gemfile +6 -2
  18. data/README.md +2 -1
  19. data/acceptance/cases/interleaved_associations/has_many_associations_using_interleaved_test.rb +12 -8
  20. data/acceptance/cases/models/insert_all_test.rb +150 -0
  21. data/acceptance/cases/transactions/optimistic_locking_test.rb +5 -0
  22. data/acceptance/cases/type/all_types_test.rb +24 -25
  23. data/acceptance/cases/type/json_test.rb +0 -2
  24. data/acceptance/models/album.rb +7 -2
  25. data/acceptance/models/singer.rb +2 -2
  26. data/acceptance/models/track.rb +5 -2
  27. data/acceptance/schema/schema.rb +2 -4
  28. data/acceptance/test_helper.rb +1 -1
  29. data/activerecord-spanner-adapter.gemspec +1 -1
  30. data/examples/rails/README.md +8 -8
  31. data/examples/snippets/interleaved-tables/README.md +164 -0
  32. data/examples/snippets/interleaved-tables/Rakefile +13 -0
  33. data/examples/snippets/interleaved-tables/application.rb +126 -0
  34. data/examples/snippets/interleaved-tables/config/database.yml +8 -0
  35. data/examples/snippets/interleaved-tables/db/migrate/01_create_tables.rb +44 -0
  36. data/examples/snippets/interleaved-tables/db/schema.rb +32 -0
  37. data/examples/snippets/interleaved-tables/db/seeds.rb +40 -0
  38. data/examples/snippets/interleaved-tables/models/album.rb +20 -0
  39. data/examples/snippets/interleaved-tables/models/singer.rb +18 -0
  40. data/examples/snippets/interleaved-tables/models/track.rb +28 -0
  41. data/lib/active_record/connection_adapters/spanner/schema_creation.rb +10 -4
  42. data/lib/active_record/connection_adapters/spanner_adapter.rb +64 -31
  43. data/lib/active_record/type/spanner/array.rb +19 -5
  44. data/lib/activerecord_spanner_adapter/base.rb +150 -17
  45. data/lib/activerecord_spanner_adapter/relation.rb +21 -0
  46. data/lib/activerecord_spanner_adapter/version.rb +1 -1
  47. data/lib/arel/visitors/spanner.rb +10 -0
  48. data/release-please-config.json +19 -0
  49. metadata +28 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e91546c93ad037bfaa453c4e80f0f9bd3ce5f6ced1e98cfd74ea92a8495996ec
4
- data.tar.gz: 1180932c1f3644a0338b856f1b170ed5a4aa2735ac8410071981db28697c7bf4
3
+ metadata.gz: 9b467bf41466950098792dc720fd39065b59cefa8c8bdd211e6f4cd4a3a4e816
4
+ data.tar.gz: ad927b97190f98d4aa9f6af41b0b32684ae3c1477266a30254a0133586370c31
5
5
  SHA512:
6
- metadata.gz: cbb029027fc34279f095294df20756d1bcfa2a077b45919d4447d4be8a29f7fb5bbb911896b8a5a3441766af735a0ec3ad38b4dfae2527ef401c1d4e9a39132e
7
- data.tar.gz: 33a6509c950572f3880dc9d48c34dc35784909b46fc1d1226f2e20c57c77e734c53149f6620be17a8d3e85b4e086624bf545dae5bcc91a671cd1089cad885b36
6
+ metadata.gz: 6a954866b8f423ad0f4784026c9564cd2f3b551a03c3eff215b77d824fb066df987bf65e53d9e030a0347110ff94f3e7e2e8b754398a577573cd9a573cece8ff
7
+ data.tar.gz: 808eb7c9f202667c01fe0870ee09714b9d1ca04f75eb260940ae75766958b99137c29d72ff86e519d01d4cc0f52c0d92084aa19bb2ddb5e02e688caecc8bbfda
data/.github/CODEOWNERS CHANGED
@@ -4,4 +4,4 @@
4
4
  # For syntax help see:
5
5
  # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
6
6
 
7
- * @jiren @skuruppu @dazuma @hengfengli @olavloite @xiangshen-dk
7
+ * @googleapis/yoshi-ruby @skuruppu @hengfengli @olavloite @xiangshen-dk
@@ -0,0 +1,2 @@
1
+ assign_issues:
2
+ - hengfengli
@@ -2,7 +2,7 @@ rebaseMergeAllowed: true
2
2
  squashMergeAllowed: true
3
3
  mergeCommitAllowed: false
4
4
  branchProtectionRules:
5
- - pattern: master
5
+ - pattern: main
6
6
  isAdminEnforced: true
7
7
  requiredStatusCheckContexts:
8
8
  - 'cla/google'
@@ -1,7 +1,7 @@
1
1
  on:
2
2
  push:
3
3
  branches:
4
- - master
4
+ - main
5
5
  pull_request:
6
6
  name: acceptance tests on emulator
7
7
  jobs:
@@ -19,13 +19,17 @@ jobs:
19
19
  max-parallel: 4
20
20
  matrix:
21
21
  ruby: [2.6, 2.7, 3.0]
22
- ar: [6.0.4, 6.1.4]
23
- # Exclude Ruby 3.0 and ActiveRecord 6.0.x as that combination is not supported.
22
+ ar: [6.0.4, 6.1.4, 7.0.2.4]
23
+ # Exclude combinations that are not supported.
24
24
  exclude:
25
25
  - ruby: 3.0
26
26
  ar: 6.0.4
27
+ - ruby: 2.6
28
+ ar: 7.0.2.4
29
+ env:
30
+ AR_VERSION: ${{ matrix.ar }}
27
31
  steps:
28
- - uses: actions/checkout@v2
32
+ - uses: actions/checkout@v3
29
33
  - name: Set up Ruby
30
34
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby
31
35
  # (see https://github.com/ruby/setup-ruby#versioning):
@@ -33,8 +37,6 @@ jobs:
33
37
  with:
34
38
  bundler-cache: false
35
39
  ruby-version: ${{ matrix.ruby }}
36
- - name: Set ActiveRecord version
37
- run: sed -i "s/\"activerecord\", \"~> 6.1.4\"/\"activerecord\", \"${{ matrix.ar }}\"/" activerecord-spanner-adapter.gemspec
38
40
  - name: Install dependencies
39
41
  run: bundle install
40
42
  - name: Run acceptance tests on emulator
@@ -1,7 +1,7 @@
1
1
  on:
2
2
  push:
3
3
  branches:
4
- - master
4
+ - main
5
5
  pull_request:
6
6
  name: acceptance tests on production
7
7
  jobs:
@@ -26,7 +26,7 @@ jobs:
26
26
  matrix:
27
27
  ruby: [3.0]
28
28
  steps:
29
- - uses: actions/checkout@v2
29
+ - uses: actions/checkout@v3
30
30
  - name: Set up Ruby
31
31
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby
32
32
  # (see https://github.com/ruby/setup-ruby#versioning):
@@ -35,7 +35,7 @@ jobs:
35
35
  bundler-cache: true
36
36
  ruby-version: ${{ matrix.ruby }}
37
37
  - name: Setup GCloud
38
- uses: google-github-actions/setup-gcloud@master
38
+ uses: google-github-actions/setup-gcloud@v0
39
39
  with:
40
40
  project_id: ${{ secrets.GCP_PROJECT_ID }}
41
41
  service_account_key: ${{ secrets.GCP_SA_KEY }}
@@ -1,7 +1,7 @@
1
1
  on:
2
2
  push:
3
3
  branches:
4
- - master
4
+ - main
5
5
  pull_request:
6
6
  name: ci
7
7
  jobs:
@@ -11,13 +11,17 @@ jobs:
11
11
  max-parallel: 4
12
12
  matrix:
13
13
  ruby: [2.6, 2.7, 3.0]
14
- ar: [6.0.4, 6.1.4]
15
- # Exclude Ruby 3.0 and ActiveRecord 6.0.x as that combination is not supported.
14
+ ar: [6.0.4, 6.1.4, 7.0.2.4]
15
+ # Exclude combinations that are not supported.
16
16
  exclude:
17
17
  - ruby: 3.0
18
18
  ar: 6.0.4
19
+ - ruby: 2.6
20
+ ar: 7.0.2.4
21
+ env:
22
+ AR_VERSION: ${{ matrix.ar }}
19
23
  steps:
20
- - uses: actions/checkout@v2
24
+ - uses: actions/checkout@v3
21
25
  - name: Set up Ruby
22
26
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby
23
27
  # (see https://github.com/ruby/setup-ruby#versioning):
@@ -25,8 +29,6 @@ jobs:
25
29
  with:
26
30
  bundler-cache: false
27
31
  ruby-version: ${{ matrix.ruby }}
28
- - name: Set ActiveRecord version
29
- run: sed -i "s/\"activerecord\", \"~> 6.1.4\"/\"activerecord\", \"${{ matrix.ar }}\"/" activerecord-spanner-adapter.gemspec
30
32
  - name: Install dependencies
31
33
  run: bundle install
32
34
  - name: Run tests
@@ -19,8 +19,8 @@ jobs:
19
19
  matrix:
20
20
  # Run acceptance tests all supported combinations of Ruby and ActiveRecord.
21
21
  ruby: [2.5, 2.6, 2.7, 3.0]
22
- ar: [6.0.0, 6.0.1, 6.0.2.2, 6.0.3.7, 6.0.4, 6.1.0, 6.1.1, 6.1.2.1, 6.1.3.2, 6.1.4]
23
- # Exclude Ruby 3.0 and ActiveRecord 6.0.x as that combination is not supported.
22
+ ar: [6.0.0, 6.0.1, 6.0.2.2, 6.0.3.7, 6.0.4, 6.1.0, 6.1.1, 6.1.2.1, 6.1.3.2, 6.1.4, 7.0.2.4]
23
+ # Exclude combinations that are not supported.
24
24
  exclude:
25
25
  - ruby: 3.0
26
26
  ar: 6.0.0
@@ -32,16 +32,20 @@ jobs:
32
32
  ar: 6.0.3.7
33
33
  - ruby: 3.0
34
34
  ar: 6.0.4
35
+ - ruby: 2.5
36
+ ar: 7.0.2.4
37
+ - ruby: 2.6
38
+ ar: 7.0.2.4
39
+ env:
40
+ AR_VERSION: ${{ matrix.ar }}
35
41
  steps:
36
- - uses: actions/checkout@v2
42
+ - uses: actions/checkout@v3
37
43
  - name: Set up Ruby
38
44
  uses: ruby/setup-ruby@v1
39
45
  with:
40
46
  # Disable caching as we are overriding the ActiveRecord below.
41
47
  bundler-cache: false
42
48
  ruby-version: ${{ matrix.ruby }}
43
- - name: Set ActiveRecord version
44
- run: sed -i "s/\"activerecord\", \"~> 6.1.4\"/\"activerecord\", \"${{ matrix.ar }}\"/" activerecord-spanner-adapter.gemspec
45
49
  - name: Install dependencies
46
50
  run: bundle install
47
51
  - name: Run acceptance tests on emulator
@@ -12,7 +12,7 @@ jobs:
12
12
  matrix:
13
13
  ruby: [3.0]
14
14
  steps:
15
- - uses: actions/checkout@v2
15
+ - uses: actions/checkout@v3
16
16
  - name: Set up Ruby
17
17
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby
18
18
  # (see https://github.com/ruby/setup-ruby#versioning):
@@ -21,7 +21,7 @@ jobs:
21
21
  bundler-cache: true
22
22
  ruby-version: ${{ matrix.ruby }}
23
23
  - name: Setup GCloud
24
- uses: google-github-actions/setup-gcloud@master
24
+ uses: google-github-actions/setup-gcloud@v0
25
25
  with:
26
26
  project_id: ${{ secrets.GCP_PROJECT_ID }}
27
27
  service_account_key: ${{ secrets.GCP_SA_KEY }}
@@ -11,8 +11,8 @@ jobs:
11
11
  matrix:
12
12
  # Run unit tests all supported combinations of Ruby and ActiveRecord.
13
13
  ruby: [2.5, 2.6, 2.7, 3.0]
14
- ar: [6.0.0, 6.0.1, 6.0.2.2, 6.0.3.7, 6.0.4, 6.1.0, 6.1.1, 6.1.2.1, 6.1.3.2, 6.1.4]
15
- # Exclude Ruby 3.0 and ActiveRecord 6.0.x as that combination is not supported.
14
+ ar: [6.0.0, 6.0.1, 6.0.2.2, 6.0.3.7, 6.0.4, 6.1.0, 6.1.1, 6.1.2.1, 6.1.3.2, 6.1.4, 7.0.2.4]
15
+ # Exclude combinations that are not supported.
16
16
  exclude:
17
17
  - ruby: 3.0
18
18
  ar: 6.0.0
@@ -24,16 +24,20 @@ jobs:
24
24
  ar: 6.0.3.7
25
25
  - ruby: 3.0
26
26
  ar: 6.0.4
27
+ - ruby: 2.5
28
+ ar: 7.0.2.4
29
+ - ruby: 2.6
30
+ ar: 7.0.2.4
31
+ env:
32
+ AR_VERSION: ${{ matrix.ar }}
27
33
  steps:
28
- - uses: actions/checkout@v2
34
+ - uses: actions/checkout@v3
29
35
  - name: Set up Ruby
30
36
  uses: ruby/setup-ruby@v1
31
37
  with:
32
38
  # Disable caching as we are overriding the ActiveRecord below.
33
39
  bundler-cache: false
34
40
  ruby-version: ${{ matrix.ruby }}
35
- - name: Set ActiveRecord version
36
- run: sed -i "s/\"activerecord\", \"~> 6.1.4\"/\"activerecord\", \"${{ matrix.ar }}\"/" activerecord-spanner-adapter.gemspec
37
41
  - name: Install dependencies
38
42
  run: bundle install
39
43
  - name: Run tests
@@ -2,21 +2,21 @@ name: release-please-label
2
2
  on:
3
3
  pull_request_target:
4
4
  branches:
5
- - master
5
+ - main
6
6
  types:
7
7
  - opened
8
8
  jobs:
9
9
  release-please-label:
10
- if: "${{ github.event.sender.login == 'yoshi-code-bot' && startsWith(github.event.pull_request.title, 'chore: release ') }}"
10
+ if: "${{ github.event.sender.login == 'yoshi-code-bot' && startsWith(github.event.pull_request.title, 'chore(main): release ') }}"
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
13
  - name: ReleaseLabel
14
- uses: actions/github-script@v4
14
+ uses: actions/github-script@v6
15
15
  with:
16
16
  github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
17
17
  script: |
18
18
  core.info('Labeling release');
19
- await github.issues.addLabels({
19
+ await github.rest.issues.addLabels({
20
20
  owner: context.repo.owner,
21
21
  repo: context.repo.repo,
22
22
  issue_number: context.payload.pull_request.number,
@@ -1,7 +1,7 @@
1
1
  name: Release-Please
2
2
  on:
3
3
  schedule:
4
- - cron: '27 8 * * *'
4
+ - cron: '57 10 * * *'
5
5
  workflow_dispatch:
6
6
  inputs:
7
7
  gem:
@@ -20,20 +20,21 @@ jobs:
20
20
  RELEASE_PLEASE_DISABLE: ${{ secrets.RELEASE_PLEASE_DISABLE }}
21
21
  steps:
22
22
  - name: Checkout repo
23
- uses: actions/checkout@v2
24
- - name: Install Ruby 2.7
23
+ uses: actions/checkout@v3
24
+ - name: Install Ruby 3.0
25
25
  uses: ruby/setup-ruby@v1
26
26
  with:
27
- ruby-version: "2.7"
28
- - name: Install NodeJS 12.x
29
- uses: actions/setup-node@v2
27
+ ruby-version: "3.0"
28
+ - name: Install NodeJS 16.x
29
+ uses: actions/setup-node@v3
30
30
  with:
31
- node-version: "12.x"
31
+ node-version: "16.x"
32
32
  - name: Install tools
33
- run: "gem install --no-document toys && npm install release-please"
33
+ run: "gem install --no-document toys"
34
34
  - name: execute
35
35
  run: |
36
- toys release please -v --fork \
36
+ toys release manifest -v \
37
+ --fork --skip-labeling \
37
38
  --github-event-name=${{ github.event_name }} \
38
- --version-file=lib/activerecord_spanner_adapter/version.rb \
39
- ${{ github.event.inputs.args }} -- ${{ github.event.inputs.gem }}
39
+ ${{ github.event.inputs.args }} \
40
+ -- ${{ github.event.inputs.gem }}
@@ -4,7 +4,7 @@ on:
4
4
  pull_request:
5
5
  types: [opened, synchronize]
6
6
  push:
7
- branches: [ master ]
7
+ branches: [ main ]
8
8
 
9
9
  jobs:
10
10
  build:
@@ -12,13 +12,13 @@ jobs:
12
12
  timeout-minutes: 10
13
13
 
14
14
  steps:
15
- - uses: actions/checkout@v2
15
+ - uses: actions/checkout@v3
16
16
  - name: setup ruby
17
17
  uses: ruby/setup-ruby@v1
18
18
  with:
19
- ruby-version: '2.5'
19
+ ruby-version: '2.7'
20
20
  - name: cache gems
21
- uses: actions/cache@v1
21
+ uses: actions/cache@v3
22
22
  with:
23
23
  path: vendor/bundle
24
24
  key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.2.0"
3
+ }
data/CHANGELOG.md CHANGED
@@ -1,55 +1,70 @@
1
1
  # Changelog
2
2
 
3
- ## [1.0.0](https://www.github.com/googleapis/ruby-spanner-activerecord/compare/activerecord-spanner-adapter/v0.7.1...activerecord-spanner-adapter/v1.0.0) (2021-12-07)
3
+ ### 1.2.0 (2022-08-03)
4
4
 
5
+ #### Features
5
6
 
6
- ### Features
7
+ * support composite primary keys for interleaved tables ([#175](https://github.com/googleapis/ruby-spanner-activerecord/issues/175))
7
8
 
8
- * release 1.0.0 ([#146](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/146)) ([15ce616](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/15ce6161fd052aaf6a1f078e65c0f836e8d640f3))
9
+ ### 1.1.0 (2022-06-24)
9
10
 
10
- ### [0.7.1](https://www.github.com/googleapis/ruby-spanner-activerecord/compare/activerecord-spanner-adapter/v0.7.0...activerecord-spanner-adapter/v0.7.1) (2021-11-21)
11
+ #### Features
11
12
 
13
+ * Support insert_all and upsert_all with DML and mutations
12
14
 
13
- ### Performance Improvements
15
+ ### 1.0.1 (2022-04-21)
14
16
 
15
- * inline BeginTransaction with first statement in the transaction ([#139](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/139)) ([ed88647](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/ed88647a4df995b4f4221ac056f9204ee45ce90f))
17
+ #### Bug Fixes
16
18
 
17
- ## [0.7.0](https://www.github.com/googleapis/ruby-spanner-activerecord/compare/activerecord-spanner-adapter/v0.6.0...activerecord-spanner-adapter/v0.7.0) (2021-10-03)
19
+ * ActiveRecord::Type::Spanner::Array does not use element type
18
20
 
21
+ #### Documentation
19
22
 
20
- ### Features
23
+ * add limitation of interleaved tables
24
+ * fix a couple of minor formatting issues
21
25
 
22
- * add support for query hints ([#134](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/134)) ([f4b5b1e](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/f4b5b1e5b959d43756258e84f95f26f375b7fba8))
26
+ ### 1.0.0 (2021-12-07)
23
27
 
24
- ## [0.6.0](https://www.github.com/googleapis/ruby-spanner-activerecord/compare/activerecord-spanner-adapter/v0.5.0...activerecord-spanner-adapter/v0.6.0) (2021-09-09)
28
+ * GA release
25
29
 
30
+ ### 0.7.1 (2021-11-21)
26
31
 
27
- ### Features
32
+ #### Performance Improvements
28
33
 
29
- * support JSON data type ([#123](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/123)) ([d177ddf](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/d177ddfc7326f02189bd4054571564b94d162b02))
30
- * support single stale reads ([#127](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/127)) ([a600628](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/a600628267355b808f478ed543bc505e73f95d4a))
31
- * support stale reads in read-only transactions ([#126](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/126)) ([8bf7730](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/8bf77300283c01e951725dd5e457270db20e98d2))
34
+ * inline BeginTransaction with first statement in the transaction
32
35
 
33
- ## 0.5.0 (2021-08-31)
36
+ ### 0.7.0 (2021-10-03)
34
37
 
38
+ #### Features
35
39
 
36
- ### Features
40
+ * add support for query hints
37
41
 
38
- * Add support for NUMERIC type ([#73](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/73)) ([176cf99](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/176cf99dc8c26b3fd34d9e85d82a91dbde2b15c8))
39
- * Add support for ARRAY data type ([#86](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/86)) ([0c66a62](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/0c66a620cab968779de04faf48e03eec643ebea9))
40
- * google-cloud-spanner version upgraded to 2.2 ([#55](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/55)) ([d7581d6](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/d7581d60bd9a9e7b9989565449119f73e2caa694))
41
- * retry session not found ([#81](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/81)) ([88fd3b7](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/88fd3b70a03a90de2b667bb0f2e86efe5dc9328b))
42
- * support and test multiple ActiveRecord versions ([#107](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/107)) ([db9d96c](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/db9d96c44b9560f6904209df1a9aa42bf50a5844))
43
- * support DDL batches on connection ([#72](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/72)) ([0d18cd4](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/0d18cd49641bdb567012d6ac88b1909461d42551))
44
- * support generated columns ([#94](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/94)) ([68664eb](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/68664eb5c617abc2954dea274430f416e616a324))
45
- * support interleaved indexes + test other index features ([#101](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/101)) ([812e0f7](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/812e0f7f60b36ec26a974f6fb48266de5d840652))
46
- * support optimistic locking ([#92](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/92)) ([9eb71d8](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/9eb71d8a207a8df0406241bff5780593eb0afd34))
47
- * support PDML transactions ([#106](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/106)) ([fa0599a](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/fa0599afe986a184bb6ab26340305eeaa753dafa))
48
- * support prepared statements and query cache ([#74](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/74)) ([fed8258](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/fed825862c95e3e052410e3576de18fc3b7849b7))
49
- * support read only transactions ([#80](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/80)) ([2d6097b](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/2d6097bd8f4530634a41dcdbcbb3a02614f482b8))
50
- * support setting attributes to commit timestamp ([#89](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/89)) ([cdd8448](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/cdd844852da92fa4e2c43fd06eeef31310d6ff8a))
42
+ ### 0.6.0 (2021-09-09)
51
43
 
44
+ #### Features
52
45
 
53
- ### Performance Improvements
46
+ * support JSON data type
47
+ * support single stale reads
48
+ * support stale reads in read-only transactions
54
49
 
55
- * add benchmarks ([#98](https://www.github.com/googleapis/ruby-spanner-activerecord/issues/98)) ([80cbadc](https://www.github.com/googleapis/ruby-spanner-activerecord/commit/80cbadc5063f2f257ca1e6e7bf563fc376967428))
50
+ ### 0.5.0 (2021-08-31)
51
+
52
+ #### Features
53
+
54
+ * Add support for NUMERIC type
55
+ * Add support for ARRAY data type
56
+ * google-cloud-spanner version upgraded to 2.2
57
+ * retry session not found
58
+ * support and test multiple ActiveRecord versions
59
+ * support DDL batches on connection
60
+ * support generated columns
61
+ * support interleaved indexes + test other index features
62
+ * support optimistic locking
63
+ * support PDML transactions
64
+ * support prepared statements and query cache
65
+ * support read only transactions
66
+ * support setting attributes to commit timestamp
67
+
68
+ #### Performance Improvements
69
+
70
+ * add benchmarks
data/CONTRIBUTING.md CHANGED
@@ -70,7 +70,7 @@ $ cd ruby-spanner-activerecord
70
70
  $ bundle exec rubocop
71
71
  ```
72
72
 
73
- The rubocop settings depend on [googleapis/ruby-style](https://github.com/googleapis/ruby-style/), in addition to [.rubocop.yml](https://github.com/googleapis/ruby-spanner-activerecord/blob/master/.rubocop.yml).
73
+ The rubocop settings depend on [googleapis/ruby-style](https://github.com/googleapis/ruby-style/), in addition to [.rubocop.yml](https://github.com/googleapis/ruby-spanner-activerecord/blob/main/.rubocop.yml).
74
74
 
75
75
  ## Code of Conduct
76
76
 
data/Gemfile CHANGED
@@ -3,10 +3,14 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in activerecord-spanner.gemspec
4
4
  gemspec
5
5
 
6
- gem "minitest", "~> 5.14.0"
6
+ gem "activerecord", ENV.fetch("AR_VERSION", "~> 6.1.4")
7
+ gem "minitest", "~> 5.15.0"
7
8
  gem "pry", "~> 0.13.0"
8
9
  gem "pry-byebug", "~> 3.9.0"
9
10
 
11
+ # Required for samples and testing.
12
+ gem "composite_primary_keys"
13
+
10
14
  # Required for samples
11
- gem 'docker-api'
15
+ gem "docker-api"
12
16
  gem "sinatra-activerecord"
data/README.md CHANGED
@@ -75,6 +75,7 @@ Some noteworthy examples in the snippets directory:
75
75
 
76
76
  Limitation|Comment|Resolution
77
77
  ---|---|---
78
+ Interleaved tables are not supported|Cloud Spanner requires to use composite primary keys for interleaved tables, but Active Record does not support composite primary keys. More details: [#160](https://github.com/googleapis/ruby-spanner-activerecord/issues/160) |Use non-interleaved tables.
78
79
  Lack of DEFAULT for columns [change_column_default](https://apidock.com/rails/v5.2.3/ActiveRecord/ConnectionAdapters/SchemaStatements/change_column_default)|Cloud Spanner does not support DEFAULT values for columns. The use of default must be enforced in your controller logic| Always set a value in your model or controller logic.
79
80
  Lack of sequential and auto-assigned IDs|Cloud Spanner doesn't autogenerate IDs and this integration instead creates UUID4 to avoid [hotspotting](https://cloud.google.com/spanner/docs/schema-design#uuid_primary_key) so you SHOULD NOT rely on IDs being sorted| UUID4s are automatically generated for primary keys.
80
81
  Table without Primary Key| Cloud Spanner support does not support tables without a primary key.| Always define a primary key for your table.
@@ -92,4 +93,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
92
93
 
93
94
  ## Code of Conduct
94
95
 
95
- Everyone interacting in the Activerecord::Spanner project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/googleapis/ruby-spanner-activerecord/blob/master/CODE_OF_CONDUCT.md).
96
+ Everyone interacting in the Activerecord::Spanner project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/googleapis/ruby-spanner-activerecord/blob/main/CODE_OF_CONDUCT.md).
@@ -20,6 +20,8 @@ module ActiveRecord
20
20
 
21
21
  def setup
22
22
  super
23
+ @original_verbosity = $VERBOSE
24
+ $VERBOSE = nil
23
25
 
24
26
  @singer = Singer.create first_name: "FirstName1", last_name: "LastName1"
25
27
 
@@ -35,6 +37,8 @@ module ActiveRecord
35
37
  def teardown
36
38
  Album.destroy_all
37
39
  Singer.destroy_all
40
+
41
+ $VERBOSE = @original_verbosity
38
42
  end
39
43
 
40
44
  def test_has_many
@@ -73,8 +77,8 @@ module ActiveRecord
73
77
 
74
78
  def test_create_and_destroy_associated_records
75
79
  singer2 = Singer.new first_name: "First", last_name: "Last"
76
- singer2.albums.build title: "New Title 1"
77
- singer2.albums.build title: "New Title 2"
80
+ singer2.albums.build title: "New Title 1", albumid: Album.next_sequence_value
81
+ singer2.albums.build title: "New Title 2", albumid: Album.next_sequence_value
78
82
  singer2.save!
79
83
 
80
84
  singer2.reload
@@ -91,8 +95,8 @@ module ActiveRecord
91
95
 
92
96
  def test_create_and_destroy_nested_associated_records
93
97
  album3 = Album.new singer: singer, title: "Title 3"
94
- album3.tracks.build title: "Title3_1", duration: 2.5, singer: singer
95
- album3.tracks.build title: "Title3_2", singer: singer
98
+ album3.tracks.build title: "Title3_1", duration: 2.5, singer: singer, trackid: Track.next_sequence_value
99
+ album3.tracks.build title: "Title3_2", singer: singer, trackid: Track.next_sequence_value
96
100
  album3.save!
97
101
 
98
102
  album3.reload
@@ -110,8 +114,8 @@ module ActiveRecord
110
114
 
111
115
  def test_create_and_delete_associated_records
112
116
  singer2 = Singer.new first_name: "First", last_name: "Last"
113
- singer2.albums.build title: "Album - 11"
114
- singer2.albums.build title: "Album - 12"
117
+ singer2.albums.build title: "Album - 11", albumid: Album.next_sequence_value
118
+ singer2.albums.build title: "Album - 12", albumid: Album.next_sequence_value
115
119
  singer2.save!
116
120
 
117
121
  singer2.reload
@@ -128,8 +132,8 @@ module ActiveRecord
128
132
 
129
133
  def test_create_and_delete_nested_associated_records
130
134
  album3 = Album.new title: "Album 3", singer: singer
131
- album3.tracks.build title: "Track - 31", singer: singer
132
- album3.tracks.build title: "Track - 32", singer: singer
135
+ album3.tracks.build title: "Track - 31", singer: singer, trackid: Track.next_sequence_value
136
+ album3.tracks.build title: "Track - 32", singer: singer, trackid: Track.next_sequence_value
133
137
  album3.save!
134
138
 
135
139
  album3.reload