activerecord-spanner-adapter 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e91546c93ad037bfaa453c4e80f0f9bd3ce5f6ced1e98cfd74ea92a8495996ec
4
- data.tar.gz: 1180932c1f3644a0338b856f1b170ed5a4aa2735ac8410071981db28697c7bf4
3
+ metadata.gz: bcc2624f18893422bf8ac9c23d07fff039e79cee5f51b975054314f49820b694
4
+ data.tar.gz: 7145b48f67236eb7ee9aac20bd1dfa907268419f262abf82cd6973acba25ab64
5
5
  SHA512:
6
- metadata.gz: cbb029027fc34279f095294df20756d1bcfa2a077b45919d4447d4be8a29f7fb5bbb911896b8a5a3441766af735a0ec3ad38b4dfae2527ef401c1d4e9a39132e
7
- data.tar.gz: 33a6509c950572f3880dc9d48c34dc35784909b46fc1d1226f2e20c57c77e734c53149f6620be17a8d3e85b4e086624bf545dae5bcc91a671cd1089cad885b36
6
+ metadata.gz: 49aed5257b191aee1e9271c1d04e91c2ff1663c78e9b1e70e89acda430587324991a10cb1b2aabdfd9b1e9d70ab862b3a1579fda5c032023175303fa260deeed
7
+ data.tar.gz: 1764369d2a370d4c8d35cbbcd3b9c45130514cc6e76bac67e5a9dafbf2bf020734b973be44f354b13da9acaaffdebaba78e31046da56c6e62efe0546aca30611
@@ -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:
@@ -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:
@@ -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:
@@ -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:
@@ -21,19 +21,20 @@ jobs:
21
21
  steps:
22
22
  - name: Checkout repo
23
23
  uses: actions/checkout@v2
24
- - name: Install Ruby 2.7
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
27
+ ruby-version: "3.0"
28
+ - name: Install NodeJS 16.x
29
29
  uses: actions/setup-node@v2
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:
@@ -18,7 +18,7 @@ jobs:
18
18
  with:
19
19
  ruby-version: '2.5'
20
20
  - name: cache gems
21
- uses: actions/cache@v1
21
+ uses: actions/cache@v2
22
22
  with:
23
23
  path: vendor/bundle
24
24
  key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.0.1"
3
+ }
data/CHANGELOG.md CHANGED
@@ -1,55 +1,58 @@
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.0.1 (2022-04-21)
4
4
 
5
+ #### Bug Fixes
5
6
 
6
- ### Features
7
+ * ActiveRecord::Type::Spanner::Array does not use element type
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
+ #### Documentation
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
+ * add limitation of interleaved tables
12
+ * fix a couple of minor formatting issues
11
13
 
14
+ ### 1.0.0 (2021-12-07)
12
15
 
13
- ### Performance Improvements
16
+ * GA release
14
17
 
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))
18
+ ### 0.7.1 (2021-11-21)
16
19
 
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)
20
+ #### Performance Improvements
18
21
 
22
+ * inline BeginTransaction with first statement in the transaction
19
23
 
20
- ### Features
24
+ ### 0.7.0 (2021-10-03)
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
+ #### Features
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
+ * add support for query hints
25
29
 
30
+ ### 0.6.0 (2021-09-09)
26
31
 
27
- ### Features
32
+ #### Features
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
+ * support JSON data type
35
+ * support single stale reads
36
+ * support stale reads in read-only transactions
32
37
 
33
- ## 0.5.0 (2021-08-31)
38
+ ### 0.5.0 (2021-08-31)
34
39
 
40
+ #### Features
35
41
 
36
- ### Features
42
+ * Add support for NUMERIC type
43
+ * Add support for ARRAY data type
44
+ * google-cloud-spanner version upgraded to 2.2
45
+ * retry session not found
46
+ * support and test multiple ActiveRecord versions
47
+ * support DDL batches on connection
48
+ * support generated columns
49
+ * support interleaved indexes + test other index features
50
+ * support optimistic locking
51
+ * support PDML transactions
52
+ * support prepared statements and query cache
53
+ * support read only transactions
54
+ * support setting attributes to commit timestamp
37
55
 
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))
56
+ #### Performance Improvements
51
57
 
52
-
53
- ### Performance Improvements
54
-
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))
58
+ * 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,7 +3,7 @@ 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 "minitest", "~> 5.15.0"
7
7
  gem "pry", "~> 0.13.0"
8
8
  gem "pry-byebug", "~> 3.9.0"
9
9
 
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).
@@ -32,17 +32,18 @@ module ActiveRecord
32
32
  col_timestamp: ::Time.new(2021, 6, 23, 17, 8, 21, "+02:00"),
33
33
  col_json: ENV["SPANNER_EMULATOR_HOST"] ? "" : { kind: "user_renamed", change: %w[jack john]},
34
34
  col_array_string: ["string1", nil, "string2"],
35
- col_array_int64: [100, nil, 200],
36
- col_array_float64: [3.14, nil, 2.0/3.0],
37
- col_array_numeric: [6.626, nil, 3.20],
38
- col_array_bool: [true, nil, false],
35
+ col_array_int64: [100, nil, 200, "300"],
36
+ col_array_float64: [3.14, nil, 2.0/3.0, "3.14"],
37
+ col_array_numeric: [6.626, nil, 3.20, "400"],
38
+ col_array_bool: [true, nil, false, "false"],
39
39
  col_array_bytes: [StringIO.new("bytes1"), nil, StringIO.new("bytes2")],
40
- col_array_date: [::Date.new(2021, 6, 23), nil, ::Date.new(2021, 6, 24)],
40
+ col_array_date: [::Date.new(2021, 6, 23), nil, ::Date.new(2021, 6, 24), "2021-06-25"],
41
41
  col_array_timestamp: [::Time.new(2021, 6, 23, 17, 8, 21, "+02:00"), nil, \
42
- ::Time.new(2021, 6, 24, 17, 8, 21, "+02:00")],
42
+ ::Time.new(2021, 6, 24, 17, 8, 21, "+02:00"), "2021-06-25 17:08:21 +02:00"],
43
43
  col_array_json: ENV["SPANNER_EMULATOR_HOST"] ? [""] : \
44
44
  [{ kind: "user_renamed", change: %w[jack john]}, nil, \
45
- { kind: "user_renamed", change: %w[alice meredith]}]
45
+ { kind: "user_renamed", change: %w[alice meredith]},
46
+ "{\"kind\":\"user_renamed\",\"change\":[\"bob\",\"carol\"]}"]
46
47
  end
47
48
 
48
49
  def test_create_record
@@ -69,20 +70,21 @@ module ActiveRecord
69
70
  record.col_json unless ENV["SPANNER_EMULATOR_HOST"]
70
71
 
71
72
  assert_equal ["string1", nil, "string2"], record.col_array_string
72
- assert_equal [100, nil, 200], record.col_array_int64
73
- assert_equal [3.14, nil, 2.0/3.0], record.col_array_float64
74
- assert_equal [6.626, nil, 3.20], record.col_array_numeric
75
- assert_equal [true, nil, false], record.col_array_bool
73
+ assert_equal [100, nil, 200, 300], record.col_array_int64
74
+ assert_equal [3.14, nil, 2.0/3.0, 3.14], record.col_array_float64
75
+ assert_equal [6.626, nil, 3.20, 400], record.col_array_numeric
76
+ assert_equal [true, nil, false, false], record.col_array_bool
76
77
  assert_equal [StringIO.new("bytes1"), nil, StringIO.new("bytes2")].map { |bytes| bytes&.read },
77
78
  record.col_array_bytes.map { |bytes| bytes&.read }
78
- assert_equal [::Date.new(2021, 6, 23), nil, ::Date.new(2021, 6, 24)], record.col_array_date
79
+ assert_equal [::Date.new(2021, 6, 23), nil, ::Date.new(2021, 6, 24), ::Date.new(2021, 06, 25)], record.col_array_date
79
80
  assert_equal [::Time.new(2021, 6, 23, 17, 8, 21, "+02:00"), \
80
81
  nil, \
81
- ::Time.new(2021, 6, 24, 17, 8, 21, "+02:00")].map { |timestamp| timestamp&.utc },
82
+ ::Time.new(2021, 6, 24, 17, 8, 21, "+02:00"), ::Time.new(2021, 6, 25, 17, 8, 21, "+02:00")].map { |timestamp| timestamp&.utc },
82
83
  record.col_array_timestamp.map { |timestamp| timestamp&.utc}
83
84
  assert_equal [{"kind" => "user_renamed", "change" => %w[jack john]}, \
84
85
  nil, \
85
- {"kind" => "user_renamed", "change" => %w[alice meredith]}],
86
+ {"kind" => "user_renamed", "change" => %w[alice meredith]},
87
+ {"kind" => "user_renamed", "change" => %w[bob carol]}],
86
88
  record.col_array_json unless ENV["SPANNER_EMULATOR_HOST"]
87
89
  end
88
90
  end
@@ -142,17 +142,17 @@ Replace `[PROJECT_ID]` with the project id you are currently using.
142
142
  ### Create database
143
143
 
144
144
  You now can run the following command to create the database:
145
- ```shell
146
- ./bin/rails db:create
147
- ```
148
- You should see output like the following:
149
- ```
150
- Created database 'blog_dev'
151
- ```
145
+
146
+ ```shell
147
+ ./bin/rails db:create
148
+ ```
149
+
150
+ You should see output like the following: `Created database 'blog_dev'`
151
+
152
152
  ### Generate a Model and apply the migration
153
153
  1. Use the model generato to define a model:
154
154
  ```shell
155
- bin/rails generate model Article title:string body:text
155
+ ./bin/rails generate model Article title:string body:text
156
156
  ```
157
157
  1. Apply the migration:
158
158
  ```shell
@@ -198,7 +198,7 @@ module ActiveRecord
198
198
 
199
199
  def register_array_types m
200
200
  m.register_type %r{^ARRAY<BOOL>}i, Type::Spanner::Array.new(Type::Boolean.new)
201
- m.register_type %r{^ARRAY<BYTES\((MAX|d+)\)>}i, Type::Spanner::Array.new(Type::Binary.new)
201
+ m.register_type %r{^ARRAY<BYTES\((MAX|d+)\)>}i, Type::Spanner::Array.new(ActiveRecord::Type::Spanner::Bytes.new)
202
202
  m.register_type %r{^ARRAY<DATE>}i, Type::Spanner::Array.new(Type::Date.new)
203
203
  m.register_type %r{^ARRAY<FLOAT64>}i, Type::Spanner::Array.new(Type::Float.new)
204
204
  m.register_type %r{^ARRAY<NUMERIC>}i, Type::Spanner::Array.new(Type::Decimal.new)
@@ -15,15 +15,29 @@ module ActiveRecord
15
15
  @element_type = element_type
16
16
  end
17
17
 
18
- def serialize value
18
+ def cast value
19
19
  return super if value.nil?
20
- return super unless @element_type.is_a? Type::Decimal
21
20
  return super unless value.respond_to? :map
22
21
 
23
- # Convert a decimal (NUMERIC) array to a String array to prevent it from being encoded as a FLOAT64 array.
24
22
  value.map do |v|
25
- next if v.nil?
26
- v.to_s
23
+ @element_type.cast v
24
+ end
25
+ end
26
+
27
+ def serialize value
28
+ return super if value.nil?
29
+ return super unless value.respond_to? :map
30
+
31
+ if @element_type.is_a? ActiveRecord::Type::Decimal
32
+ # Convert a decimal (NUMERIC) array to a String array to prevent it from being encoded as a FLOAT64 array.
33
+ value.map do |v|
34
+ next if v.nil?
35
+ v.to_s
36
+ end
37
+ else
38
+ value.map do |v|
39
+ @element_type.serialize v
40
+ end
27
41
  end
28
42
  end
29
43
  end
@@ -5,5 +5,5 @@
5
5
  # https://opensource.org/licenses/MIT.
6
6
 
7
7
  module ActiveRecordSpannerAdapter
8
- VERSION = "1.0.0".freeze
8
+ VERSION = "1.0.1".freeze
9
9
  end
@@ -0,0 +1,19 @@
1
+ {
2
+ "bump-minor-pre-major": true,
3
+ "bump-patch-for-minor-pre-major": false,
4
+ "draft": false,
5
+ "include-component-in-tag": true,
6
+ "include-v-in-tag": true,
7
+ "prerelease": false,
8
+ "release-type": "ruby-yoshi",
9
+ "skip-github-release": false,
10
+ "separate-pull-requests": true,
11
+ "tag-separator": "/",
12
+ "sequential-calls": true,
13
+ "packages": {
14
+ ".": {
15
+ "component": "activerecord-spanner-adapter",
16
+ "version-file": "lib/activerecord_spanner_adapter/version.rb"
17
+ }
18
+ }
19
+ }
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.0.0
4
+ version: 1.0.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: 2021-12-07 00:00:00.000000000 Z
11
+ date: 2022-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-spanner
@@ -214,6 +214,7 @@ extensions: []
214
214
  extra_rdoc_files: []
215
215
  files:
216
216
  - ".github/CODEOWNERS"
217
+ - ".github/blunderbuss.yml"
217
218
  - ".github/sync-repo-settings.yaml"
218
219
  - ".github/workflows/acceptance-tests-on-emulator.yaml"
219
220
  - ".github/workflows/acceptance-tests-on-production.yaml"
@@ -229,6 +230,7 @@ files:
229
230
  - ".kokoro/release.cfg"
230
231
  - ".kokoro/release.sh"
231
232
  - ".kokoro/trampoline_v2.sh"
233
+ - ".release-please-manifest.json"
232
234
  - ".rubocop.yml"
233
235
  - ".toys/release.rb"
234
236
  - ".trampolinerc"
@@ -489,6 +491,7 @@ files:
489
491
  - lib/activerecord_spanner_adapter/version.rb
490
492
  - lib/arel/visitors/spanner.rb
491
493
  - lib/spanner_client_ext.rb
494
+ - release-please-config.json
492
495
  - renovate.json
493
496
  homepage: https://github.com/googleapis/ruby-spanner-activerecord
494
497
  licenses:
@@ -509,7 +512,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
509
512
  - !ruby/object:Gem::Version
510
513
  version: '0'
511
514
  requirements: []
512
- rubygems_version: 3.2.17
515
+ rubygems_version: 3.3.5
513
516
  signing_key:
514
517
  specification_version: 4
515
518
  summary: Rails ActiveRecord connector for Google Spanner Database