activerecord-spanner-adapter 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (264) hide show
  1. checksums.yaml +5 -5
  2. data/.github/CODEOWNERS +7 -0
  3. data/.github/sync-repo-settings.yaml +16 -0
  4. data/.github/workflows/acceptance-tests-on-emulator.yaml +45 -0
  5. data/.github/workflows/acceptance-tests-on-production.yaml +36 -0
  6. data/.github/workflows/ci.yaml +33 -0
  7. data/.github/workflows/nightly-acceptance-tests-on-emulator.yaml +52 -0
  8. data/.github/workflows/nightly-acceptance-tests-on-production.yaml +35 -0
  9. data/.github/workflows/nightly-unit-tests.yaml +40 -0
  10. data/.github/workflows/release-please-label.yml +25 -0
  11. data/.github/workflows/release-please.yml +39 -0
  12. data/.github/workflows/rubocop.yaml +31 -0
  13. data/.gitignore +67 -5
  14. data/.kokoro/populate-secrets.sh +77 -0
  15. data/.kokoro/release.cfg +33 -0
  16. data/.kokoro/release.sh +15 -0
  17. data/.kokoro/trampoline_v2.sh +489 -0
  18. data/.rubocop.yml +46 -0
  19. data/.toys/release.rb +18 -0
  20. data/.trampolinerc +48 -0
  21. data/.yardopts +11 -0
  22. data/CHANGELOG.md +26 -0
  23. data/CODE_OF_CONDUCT.md +40 -0
  24. data/CONTRIBUTING.md +79 -0
  25. data/Gemfile +9 -4
  26. data/LICENSE +6 -6
  27. data/README.md +67 -30
  28. data/Rakefile +79 -3
  29. data/SECURITY.md +7 -0
  30. data/acceptance/cases/associations/has_many_associations_test.rb +119 -0
  31. data/acceptance/cases/associations/has_many_through_associations_test.rb +63 -0
  32. data/acceptance/cases/associations/has_one_associations_test.rb +79 -0
  33. data/acceptance/cases/associations/has_one_through_associations_test.rb +98 -0
  34. data/acceptance/cases/interleaved_associations/has_many_associations_using_interleaved_test.rb +211 -0
  35. data/acceptance/cases/migration/change_schema_test.rb +433 -0
  36. data/acceptance/cases/migration/change_table_test.rb +115 -0
  37. data/acceptance/cases/migration/column_attributes_test.rb +122 -0
  38. data/acceptance/cases/migration/column_positioning_test.rb +48 -0
  39. data/acceptance/cases/migration/columns_test.rb +201 -0
  40. data/acceptance/cases/migration/command_recorder_test.rb +406 -0
  41. data/acceptance/cases/migration/create_join_table_test.rb +216 -0
  42. data/acceptance/cases/migration/ddl_batching_test.rb +80 -0
  43. data/acceptance/cases/migration/foreign_key_test.rb +297 -0
  44. data/acceptance/cases/migration/index_test.rb +211 -0
  45. data/acceptance/cases/migration/references_foreign_key_test.rb +259 -0
  46. data/acceptance/cases/migration/references_index_test.rb +135 -0
  47. data/acceptance/cases/migration/references_statements_test.rb +166 -0
  48. data/acceptance/cases/migration/rename_column_test.rb +96 -0
  49. data/acceptance/cases/models/calculation_query_test.rb +128 -0
  50. data/acceptance/cases/models/generated_column_test.rb +126 -0
  51. data/acceptance/cases/models/mutation_test.rb +122 -0
  52. data/acceptance/cases/models/query_test.rb +147 -0
  53. data/acceptance/cases/sessions/session_not_found_test.rb +121 -0
  54. data/acceptance/cases/transactions/optimistic_locking_test.rb +141 -0
  55. data/acceptance/cases/transactions/read_only_transactions_test.rb +67 -0
  56. data/acceptance/cases/transactions/read_write_transactions_test.rb +248 -0
  57. data/acceptance/cases/type/all_types_test.rb +152 -0
  58. data/acceptance/cases/type/binary_test.rb +59 -0
  59. data/acceptance/cases/type/boolean_test.rb +31 -0
  60. data/acceptance/cases/type/date_test.rb +32 -0
  61. data/acceptance/cases/type/date_time_test.rb +30 -0
  62. data/acceptance/cases/type/float_test.rb +27 -0
  63. data/acceptance/cases/type/integer_test.rb +44 -0
  64. data/acceptance/cases/type/numeric_test.rb +27 -0
  65. data/acceptance/cases/type/string_test.rb +79 -0
  66. data/acceptance/cases/type/text_test.rb +30 -0
  67. data/acceptance/cases/type/time_test.rb +87 -0
  68. data/acceptance/models/account.rb +13 -0
  69. data/acceptance/models/address.rb +9 -0
  70. data/acceptance/models/album.rb +12 -0
  71. data/acceptance/models/all_types.rb +8 -0
  72. data/acceptance/models/author.rb +11 -0
  73. data/acceptance/models/club.rb +12 -0
  74. data/acceptance/models/comment.rb +9 -0
  75. data/acceptance/models/customer.rb +9 -0
  76. data/acceptance/models/department.rb +9 -0
  77. data/acceptance/models/firm.rb +10 -0
  78. data/acceptance/models/member.rb +13 -0
  79. data/acceptance/models/member_type.rb +9 -0
  80. data/acceptance/models/membership.rb +10 -0
  81. data/acceptance/models/organization.rb +9 -0
  82. data/acceptance/models/post.rb +10 -0
  83. data/acceptance/models/singer.rb +10 -0
  84. data/acceptance/models/track.rb +20 -0
  85. data/acceptance/models/transaction.rb +9 -0
  86. data/acceptance/schema/schema.rb +143 -0
  87. data/acceptance/test_helper.rb +260 -0
  88. data/activerecord-spanner-adapter.gemspec +32 -17
  89. data/assets/solidus-db.png +0 -0
  90. data/benchmarks/README.md +17 -0
  91. data/benchmarks/Rakefile +14 -0
  92. data/benchmarks/application.rb +308 -0
  93. data/benchmarks/config/database.yml +8 -0
  94. data/benchmarks/config/environment.rb +12 -0
  95. data/benchmarks/db/migrate/01_create_tables.rb +25 -0
  96. data/benchmarks/db/schema.rb +29 -0
  97. data/benchmarks/models/album.rb +9 -0
  98. data/benchmarks/models/singer.rb +9 -0
  99. data/bin/console +6 -7
  100. data/examples/rails/README.md +262 -0
  101. data/examples/snippets/README.md +29 -0
  102. data/examples/snippets/Rakefile +57 -0
  103. data/examples/snippets/array-data-type/README.md +45 -0
  104. data/examples/snippets/array-data-type/Rakefile +13 -0
  105. data/examples/snippets/array-data-type/application.rb +45 -0
  106. data/examples/snippets/array-data-type/config/database.yml +8 -0
  107. data/examples/snippets/array-data-type/db/migrate/01_create_tables.rb +24 -0
  108. data/examples/snippets/array-data-type/db/schema.rb +26 -0
  109. data/examples/snippets/array-data-type/db/seeds.rb +5 -0
  110. data/examples/snippets/array-data-type/models/entity_with_array_types.rb +18 -0
  111. data/examples/snippets/bin/create_emulator_instance.rb +18 -0
  112. data/examples/snippets/bulk-insert/README.md +21 -0
  113. data/examples/snippets/bulk-insert/Rakefile +13 -0
  114. data/examples/snippets/bulk-insert/application.rb +64 -0
  115. data/examples/snippets/bulk-insert/config/database.yml +8 -0
  116. data/examples/snippets/bulk-insert/db/migrate/01_create_tables.rb +21 -0
  117. data/examples/snippets/bulk-insert/db/schema.rb +26 -0
  118. data/examples/snippets/bulk-insert/db/seeds.rb +5 -0
  119. data/examples/snippets/bulk-insert/models/album.rb +9 -0
  120. data/examples/snippets/bulk-insert/models/singer.rb +9 -0
  121. data/examples/snippets/commit-timestamp/README.md +18 -0
  122. data/examples/snippets/commit-timestamp/Rakefile +13 -0
  123. data/examples/snippets/commit-timestamp/application.rb +53 -0
  124. data/examples/snippets/commit-timestamp/config/database.yml +8 -0
  125. data/examples/snippets/commit-timestamp/db/migrate/01_create_tables.rb +26 -0
  126. data/examples/snippets/commit-timestamp/db/schema.rb +29 -0
  127. data/examples/snippets/commit-timestamp/db/seeds.rb +5 -0
  128. data/examples/snippets/commit-timestamp/models/album.rb +9 -0
  129. data/examples/snippets/commit-timestamp/models/singer.rb +9 -0
  130. data/examples/snippets/config/environment.rb +21 -0
  131. data/examples/snippets/create-records/README.md +12 -0
  132. data/examples/snippets/create-records/Rakefile +13 -0
  133. data/examples/snippets/create-records/application.rb +42 -0
  134. data/examples/snippets/create-records/config/database.yml +8 -0
  135. data/examples/snippets/create-records/db/migrate/01_create_tables.rb +21 -0
  136. data/examples/snippets/create-records/db/schema.rb +26 -0
  137. data/examples/snippets/create-records/db/seeds.rb +5 -0
  138. data/examples/snippets/create-records/models/album.rb +9 -0
  139. data/examples/snippets/create-records/models/singer.rb +9 -0
  140. data/examples/snippets/date-data-type/README.md +19 -0
  141. data/examples/snippets/date-data-type/Rakefile +13 -0
  142. data/examples/snippets/date-data-type/application.rb +35 -0
  143. data/examples/snippets/date-data-type/config/database.yml +8 -0
  144. data/examples/snippets/date-data-type/db/migrate/01_create_tables.rb +20 -0
  145. data/examples/snippets/date-data-type/db/schema.rb +21 -0
  146. data/examples/snippets/date-data-type/db/seeds.rb +16 -0
  147. data/examples/snippets/date-data-type/models/singer.rb +8 -0
  148. data/examples/snippets/generated-column/README.md +41 -0
  149. data/examples/snippets/generated-column/Rakefile +13 -0
  150. data/examples/snippets/generated-column/application.rb +37 -0
  151. data/examples/snippets/generated-column/config/database.yml +8 -0
  152. data/examples/snippets/generated-column/db/migrate/01_create_tables.rb +23 -0
  153. data/examples/snippets/generated-column/db/schema.rb +21 -0
  154. data/examples/snippets/generated-column/db/seeds.rb +18 -0
  155. data/examples/snippets/generated-column/models/singer.rb +8 -0
  156. data/examples/snippets/interleaved-tables/README.md +152 -0
  157. data/examples/snippets/interleaved-tables/Rakefile +13 -0
  158. data/examples/snippets/interleaved-tables/application.rb +109 -0
  159. data/examples/snippets/interleaved-tables/config/database.yml +8 -0
  160. data/examples/snippets/interleaved-tables/db/migrate/01_create_tables.rb +44 -0
  161. data/examples/snippets/interleaved-tables/db/schema.rb +32 -0
  162. data/examples/snippets/interleaved-tables/db/seeds.rb +40 -0
  163. data/examples/snippets/interleaved-tables/models/album.rb +15 -0
  164. data/examples/snippets/interleaved-tables/models/singer.rb +20 -0
  165. data/examples/snippets/interleaved-tables/models/track.rb +25 -0
  166. data/examples/snippets/migrations/README.md +43 -0
  167. data/examples/snippets/migrations/Rakefile +13 -0
  168. data/examples/snippets/migrations/application.rb +26 -0
  169. data/examples/snippets/migrations/config/database.yml +8 -0
  170. data/examples/snippets/migrations/db/migrate/01_create_tables.rb +28 -0
  171. data/examples/snippets/migrations/db/schema.rb +33 -0
  172. data/examples/snippets/migrations/db/seeds.rb +5 -0
  173. data/examples/snippets/migrations/models/album.rb +10 -0
  174. data/examples/snippets/migrations/models/singer.rb +10 -0
  175. data/examples/snippets/migrations/models/track.rb +9 -0
  176. data/examples/snippets/mutations/README.md +34 -0
  177. data/examples/snippets/mutations/Rakefile +13 -0
  178. data/examples/snippets/mutations/application.rb +47 -0
  179. data/examples/snippets/mutations/config/database.yml +8 -0
  180. data/examples/snippets/mutations/db/migrate/01_create_tables.rb +22 -0
  181. data/examples/snippets/mutations/db/schema.rb +27 -0
  182. data/examples/snippets/mutations/db/seeds.rb +25 -0
  183. data/examples/snippets/mutations/models/album.rb +9 -0
  184. data/examples/snippets/mutations/models/singer.rb +9 -0
  185. data/examples/snippets/optimistic-locking/README.md +12 -0
  186. data/examples/snippets/optimistic-locking/Rakefile +13 -0
  187. data/examples/snippets/optimistic-locking/application.rb +48 -0
  188. data/examples/snippets/optimistic-locking/config/database.yml +8 -0
  189. data/examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb +26 -0
  190. data/examples/snippets/optimistic-locking/db/schema.rb +29 -0
  191. data/examples/snippets/optimistic-locking/db/seeds.rb +25 -0
  192. data/examples/snippets/optimistic-locking/models/album.rb +9 -0
  193. data/examples/snippets/optimistic-locking/models/singer.rb +9 -0
  194. data/examples/snippets/quickstart/README.md +26 -0
  195. data/examples/snippets/quickstart/Rakefile +13 -0
  196. data/examples/snippets/quickstart/application.rb +51 -0
  197. data/examples/snippets/quickstart/config/database.yml +8 -0
  198. data/examples/snippets/quickstart/db/migrate/01_create_tables.rb +21 -0
  199. data/examples/snippets/quickstart/db/schema.rb +26 -0
  200. data/examples/snippets/quickstart/db/seeds.rb +24 -0
  201. data/examples/snippets/quickstart/models/album.rb +9 -0
  202. data/examples/snippets/quickstart/models/singer.rb +9 -0
  203. data/examples/snippets/read-only-transactions/README.md +13 -0
  204. data/examples/snippets/read-only-transactions/Rakefile +13 -0
  205. data/examples/snippets/read-only-transactions/application.rb +49 -0
  206. data/examples/snippets/read-only-transactions/config/database.yml +8 -0
  207. data/examples/snippets/read-only-transactions/db/migrate/01_create_tables.rb +21 -0
  208. data/examples/snippets/read-only-transactions/db/schema.rb +26 -0
  209. data/examples/snippets/read-only-transactions/db/seeds.rb +24 -0
  210. data/examples/snippets/read-only-transactions/models/album.rb +9 -0
  211. data/examples/snippets/read-only-transactions/models/singer.rb +9 -0
  212. data/examples/snippets/read-write-transactions/README.md +12 -0
  213. data/examples/snippets/read-write-transactions/Rakefile +13 -0
  214. data/examples/snippets/read-write-transactions/application.rb +39 -0
  215. data/examples/snippets/read-write-transactions/config/database.yml +8 -0
  216. data/examples/snippets/read-write-transactions/db/migrate/01_create_tables.rb +22 -0
  217. data/examples/snippets/read-write-transactions/db/schema.rb +27 -0
  218. data/examples/snippets/read-write-transactions/db/seeds.rb +25 -0
  219. data/examples/snippets/read-write-transactions/models/album.rb +9 -0
  220. data/examples/snippets/read-write-transactions/models/singer.rb +9 -0
  221. data/examples/snippets/timestamp-data-type/README.md +17 -0
  222. data/examples/snippets/timestamp-data-type/Rakefile +13 -0
  223. data/examples/snippets/timestamp-data-type/application.rb +42 -0
  224. data/examples/snippets/timestamp-data-type/config/database.yml +8 -0
  225. data/examples/snippets/timestamp-data-type/db/migrate/01_create_tables.rb +21 -0
  226. data/examples/snippets/timestamp-data-type/db/schema.rb +21 -0
  227. data/examples/snippets/timestamp-data-type/db/seeds.rb +6 -0
  228. data/examples/snippets/timestamp-data-type/models/meeting.rb +19 -0
  229. data/examples/solidus/README.md +172 -0
  230. data/lib/active_record/connection_adapters/spanner/database_statements.rb +224 -269
  231. data/lib/active_record/connection_adapters/spanner/quoting.rb +42 -50
  232. data/lib/active_record/connection_adapters/spanner/schema_cache.rb +43 -0
  233. data/lib/active_record/connection_adapters/spanner/schema_creation.rb +125 -9
  234. data/lib/active_record/connection_adapters/spanner/schema_definitions.rb +122 -0
  235. data/lib/active_record/connection_adapters/spanner/schema_dumper.rb +19 -0
  236. data/lib/active_record/connection_adapters/spanner/schema_statements.rb +553 -139
  237. data/lib/active_record/connection_adapters/spanner/type_metadata.rb +37 -0
  238. data/lib/active_record/connection_adapters/spanner_adapter.rb +182 -78
  239. data/lib/active_record/tasks/spanner_database_tasks.rb +74 -0
  240. data/lib/active_record/type/spanner/array.rb +32 -0
  241. data/lib/active_record/type/spanner/bytes.rb +26 -0
  242. data/lib/active_record/type/spanner/spanner_active_record_converter.rb +32 -0
  243. data/lib/active_record/type/spanner/time.rb +37 -0
  244. data/lib/activerecord-spanner-adapter.rb +23 -0
  245. data/lib/activerecord_spanner_adapter/base.rb +217 -0
  246. data/lib/activerecord_spanner_adapter/connection.rb +324 -0
  247. data/lib/activerecord_spanner_adapter/errors.rb +13 -0
  248. data/lib/activerecord_spanner_adapter/foreign_key.rb +29 -0
  249. data/lib/activerecord_spanner_adapter/index/column.rb +38 -0
  250. data/lib/activerecord_spanner_adapter/index.rb +80 -0
  251. data/lib/activerecord_spanner_adapter/information_schema.rb +261 -0
  252. data/lib/activerecord_spanner_adapter/primary_key.rb +31 -0
  253. data/lib/activerecord_spanner_adapter/table/column.rb +59 -0
  254. data/lib/activerecord_spanner_adapter/table.rb +61 -0
  255. data/lib/activerecord_spanner_adapter/transaction.rb +113 -0
  256. data/lib/activerecord_spanner_adapter/version.rb +9 -0
  257. data/lib/arel/visitors/spanner.rb +35 -0
  258. data/lib/spanner_client_ext.rb +82 -0
  259. data/renovate.json +5 -0
  260. metadata +387 -34
  261. data/.travis.yml +0 -5
  262. data/lib/active_record/connection_adapters/spanner/client.rb +0 -190
  263. data/lib/active_record/connection_adapters/spanner.rb +0 -10
  264. data/lib/activerecord-spanner-adapter/version.rb +0 -3
@@ -0,0 +1,59 @@
1
+ # Copyright 2020 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
+ module ActiveRecordSpannerAdapter
8
+ class Table
9
+ class Column
10
+ attr_accessor :table_name, :name, :type, :limit, :ordinal_position,
11
+ :allow_commit_timestamp, :default, :primary_key
12
+ attr_writer :nullable
13
+
14
+ def initialize \
15
+ table_name,
16
+ name,
17
+ type,
18
+ limit: nil,
19
+ ordinal_position: nil,
20
+ nullable: true,
21
+ allow_commit_timestamp: nil,
22
+ default: nil
23
+ @table_name = table_name.to_s
24
+ @name = name.to_s
25
+ @type = type
26
+ @limit = limit
27
+ @nullable = nullable != false
28
+ @ordinal_position = ordinal_position
29
+ @allow_commit_timestamp = allow_commit_timestamp
30
+ @default = default
31
+ @primary_key = false
32
+ end
33
+
34
+ def nullable
35
+ return false if primary_key
36
+ @nullable
37
+ end
38
+
39
+ def spanner_type
40
+ return "#{type}(#{limit || 'MAX'})" if limit_allowed?
41
+ type
42
+ end
43
+
44
+ def options
45
+ {
46
+ limit: limit,
47
+ null: nullable,
48
+ allow_commit_timestamp: allow_commit_timestamp
49
+ }.delete_if { |_, v| v.nil? }
50
+ end
51
+
52
+ private
53
+
54
+ def limit_allowed?
55
+ ["BYTES", "STRING"].include? type
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,61 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2020 Google LLC.
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # ITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ # Copyright 2020 Google LLC
24
+ #
25
+ # Use of this source code is governed by an MIT-style
26
+ # license that can be found in the LICENSE file or at
27
+ # https://opensource.org/licenses/MIT.
28
+
29
+ require "activerecord_spanner_adapter/table/column"
30
+
31
+ module ActiveRecordSpannerAdapter
32
+ class Table
33
+ attr_accessor :name, :on_delete, :parent_table, :schema_name, :catalog,
34
+ :indexes, :columns, :foreign_keys
35
+
36
+ # parent_table == interleave_in
37
+ def initialize \
38
+ name,
39
+ parent_table: nil,
40
+ on_delete: nil,
41
+ schema_name: nil,
42
+ catalog: nil
43
+ @name = name.to_s
44
+ @parent_table = parent_table.to_s if parent_table
45
+ @on_delete = on_delete
46
+ @schema_name = schema_name
47
+ @catalog = catalog
48
+ @columns = []
49
+ @indexes = []
50
+ @foreign_keys = []
51
+ end
52
+
53
+ def primary_keys
54
+ columns.select(&:primary_key).map(&:name)
55
+ end
56
+
57
+ def cascade?
58
+ @on_delete == "CASCADE"
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,113 @@
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
+ module ActiveRecordSpannerAdapter
8
+ class Transaction
9
+ attr_reader :state
10
+
11
+ def initialize connection, isolation
12
+ @connection = connection
13
+ @isolation = isolation
14
+ @state = :INITIALIZED
15
+ @sequence_number = 0
16
+ @mutations = []
17
+ end
18
+
19
+ def active?
20
+ @state == :STARTED
21
+ end
22
+
23
+ def isolation
24
+ return nil unless active?
25
+ @isolation
26
+ end
27
+
28
+ def buffer mutation
29
+ @mutations << mutation
30
+ end
31
+
32
+ def begin
33
+ raise "Nested transactions are not allowed" if @state != :INITIALIZED
34
+ begin
35
+ @grpc_transaction =
36
+ case @isolation
37
+ when :read_only
38
+ @connection.session.create_snapshot strong: true
39
+ when :pdml
40
+ @connection.session.create_pdml
41
+ else
42
+ @connection.session.create_transaction
43
+ end
44
+ @state = :STARTED
45
+ rescue Google::Cloud::NotFoundError => e
46
+ if @connection.session_not_found? e
47
+ @connection.reset!
48
+ retry
49
+ end
50
+ @state = :FAILED
51
+ raise
52
+ rescue StandardError
53
+ @state = :FAILED
54
+ raise
55
+ end
56
+ end
57
+
58
+ def next_sequence_number
59
+ @sequence_number += 1 unless @isolation == :read_only
60
+ end
61
+
62
+ def commit
63
+ raise "This transaction is not active" unless active?
64
+
65
+ begin
66
+ @connection.session.commit_transaction @grpc_transaction, @mutations \
67
+ unless [:read_only, :pdml].include? @isolation
68
+ @state = :COMMITTED
69
+ rescue Google::Cloud::NotFoundError => e
70
+ if @connection.session_not_found? e
71
+ shoot_and_forget_rollback
72
+ @connection.reset!
73
+ @connection.raise_aborted_err
74
+ end
75
+ @state = :FAILED
76
+ raise
77
+ rescue StandardError
78
+ @state = :FAILED
79
+ raise
80
+ end
81
+ end
82
+
83
+ def rollback
84
+ # Allow rollback after abort and/or a failed commit.
85
+ raise "This transaction is not active" unless active? || @state == :FAILED || @state == :ABORTED
86
+ if active?
87
+ # We do a shoot-and-forget rollback here, as the error that caused the transaction to be rolled back could
88
+ # also have invalidated the transaction (e.g. `Session not found`). If the rollback fails for any other
89
+ # reason, we also do not need to retry it or propagate the error to the application, as the transaction will
90
+ # automatically be aborted by Cloud Spanner after 10 seconds anyways.
91
+ shoot_and_forget_rollback
92
+ end
93
+ @state = :ROLLED_BACK
94
+ end
95
+
96
+ def shoot_and_forget_rollback
97
+ @connection.session.rollback @grpc_transaction.transaction_id unless @isolation == :read_only
98
+ rescue StandardError # rubocop:disable Lint/HandleExceptions
99
+ # Ignored
100
+ end
101
+
102
+ def mark_aborted
103
+ @state = :ABORTED
104
+ end
105
+
106
+ def transaction_selector
107
+ return unless active?
108
+
109
+ Google::Spanner::V1::TransactionSelector.new \
110
+ id: @grpc_transaction.transaction_id
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,9 @@
1
+ # Copyright 2020 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
+ module ActiveRecordSpannerAdapter
8
+ VERSION = "0.5.0".freeze
9
+ end
@@ -0,0 +1,35 @@
1
+ # Copyright 2020 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
+ module Arel # :nodoc: all
8
+ module Visitors
9
+ class Spanner < Arel::Visitors::ToSql
10
+ def compile node, collector = Arel::Collectors::SQLString.new
11
+ @index = 0
12
+ accept(node, collector).value
13
+ end
14
+
15
+ private
16
+
17
+ BIND_BLOCK = proc { |i| "@p#{i}" }
18
+ private_constant :BIND_BLOCK
19
+
20
+ def bind_block
21
+ BIND_BLOCK
22
+ end
23
+
24
+ # rubocop:disable Naming/MethodName
25
+ def visit_Arel_Nodes_BindParam o, collector
26
+ # Do not generate a query parameter if the value should be set to the PENDING_COMMIT_TIMESTAMP(), as that is
27
+ # not supported as a parameter value by Cloud Spanner.
28
+ return collector << "PENDING_COMMIT_TIMESTAMP()" \
29
+ if o.value.type.is_a?(ActiveRecord::Type::Spanner::Time) && o.value.value == :commit_timestamp
30
+ collector.add_bind(o.value, &bind_block)
31
+ end
32
+ # rubocop:enable Naming/MethodName
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,82 @@
1
+ # Copyright 2020 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
+
8
+ module Google
9
+ module Cloud
10
+ module Spanner
11
+ class Project
12
+ def create_session instance_id, database_id, labels: nil
13
+ ensure_service!
14
+
15
+ grpc = @service.create_session(
16
+ Admin::Database::V1::DatabaseAdmin::Paths.database_path(
17
+ project: project, instance: instance_id, database: database_id
18
+ ),
19
+ labels: labels
20
+ )
21
+ Session.from_grpc grpc, @service
22
+ end
23
+ end
24
+
25
+ class Session
26
+ def commit_transaction transaction, mutations = []
27
+ ensure_service!
28
+
29
+ resp = service.commit(
30
+ path,
31
+ mutations,
32
+ transaction_id: transaction.transaction_id
33
+ )
34
+ @last_updated_at = Time.now
35
+ Convert.timestamp_to_time resp.commit_timestamp
36
+ end
37
+
38
+ def create_snapshot strong: nil,
39
+ timestamp: nil, read_timestamp: nil,
40
+ staleness: nil, exact_staleness: nil
41
+ validate_snapshot_args! strong: strong, timestamp: timestamp,
42
+ read_timestamp: read_timestamp,
43
+ staleness: staleness,
44
+ exact_staleness: exact_staleness
45
+ ensure_service!
46
+
47
+ snp_grpc = service.create_snapshot \
48
+ path, timestamp: (timestamp || read_timestamp),
49
+ staleness: (staleness || exact_staleness)
50
+ Snapshot.from_grpc snp_grpc, self
51
+ end
52
+
53
+ def create_pdml
54
+ ensure_service!
55
+ pdml_grpc = service.create_pdml path
56
+ Transaction.from_grpc pdml_grpc, self
57
+ end
58
+
59
+ private
60
+
61
+ ##
62
+ # Check for valid snapshot arguments
63
+ def validate_snapshot_args! strong: nil,
64
+ timestamp: nil, read_timestamp: nil,
65
+ staleness: nil, exact_staleness: nil
66
+ valid_args_count = [
67
+ strong, timestamp, read_timestamp, staleness, exact_staleness
68
+ ].compact.count
69
+ return true if valid_args_count <= 1
70
+ raise ArgumentError,
71
+ "Can only provide one of the following arguments: " \
72
+ "(strong, timestamp, read_timestamp, staleness, " \
73
+ "exact_staleness)"
74
+ end
75
+ end
76
+
77
+ class Transaction
78
+ attr_accessor :seqno, :commit
79
+ end
80
+ end
81
+ end
82
+ end
data/renovate.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": [
3
+ "config:base"
4
+ ]
5
+ }
metadata CHANGED
@@ -1,126 +1,480 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-spanner-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
- - Yuki Yugui Sonoda
7
+ - Google LLC
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-03 00:00:00.000000000 Z
11
+ date: 2021-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activerecord
14
+ name: google-cloud-spanner
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '2.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.0'
26
+ version: '2.4'
27
27
  - !ruby/object:Gem::Dependency
28
- name: google-cloud-spanner
28
+ name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.23'
33
+ version: 6.1.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.23'
40
+ version: 6.1.4
41
41
  - !ruby/object:Gem::Dependency
42
- name: google-gax
42
+ name: autotest-suffix
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.8'
48
- type: :runtime
47
+ version: '1.1'
48
+ type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.8'
54
+ version: '1.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.14'
61
+ version: '2.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: google-style
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.24.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.24.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '5.10'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '5.10'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest-autotest
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.0'
62
104
  type: :development
63
105
  prerelease: false
64
106
  version_requirements: !ruby/object:Gem::Requirement
65
107
  requirements:
66
108
  - - "~>"
67
109
  - !ruby/object:Gem::Version
68
- version: '1.14'
110
+ version: '1.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: minitest-focus
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.1'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.1'
125
+ - !ruby/object:Gem::Dependency
126
+ name: minitest-rg
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '5.2'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '5.2'
69
139
  - !ruby/object:Gem::Dependency
70
140
  name: rake
71
141
  requirement: !ruby/object:Gem::Requirement
72
142
  requirements:
73
143
  - - "~>"
74
144
  - !ruby/object:Gem::Version
75
- version: '10.0'
145
+ version: '13.0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '13.0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: redcarpet
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '3.0'
76
160
  type: :development
77
161
  prerelease: false
78
162
  version_requirements: !ruby/object:Gem::Requirement
79
163
  requirements:
80
164
  - - "~>"
81
165
  - !ruby/object:Gem::Version
82
- version: '10.0'
166
+ version: '3.0'
83
167
  - !ruby/object:Gem::Dependency
84
- name: rspec
168
+ name: simplecov
85
169
  requirement: !ruby/object:Gem::Requirement
86
170
  requirements:
87
171
  - - "~>"
88
172
  - !ruby/object:Gem::Version
89
- version: 3.6.0
173
+ version: '0.9'
90
174
  type: :development
91
175
  prerelease: false
92
176
  version_requirements: !ruby/object:Gem::Requirement
93
177
  requirements:
94
178
  - - "~>"
95
179
  - !ruby/object:Gem::Version
96
- version: 3.6.0
97
- description: Connection Adapter of Google Cloud Spanner to ActiveRecord O/R mapper
98
- library
180
+ version: '0.9'
181
+ - !ruby/object:Gem::Dependency
182
+ name: yard
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '0.9'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '0.9'
195
+ - !ruby/object:Gem::Dependency
196
+ name: yard-doctest
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: 0.1.13
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: 0.1.13
209
+ description: Rails ActiveRecord connector for Google Spanner Database
99
210
  email:
100
- - yuki.sonoda@supership.jp
211
+ - cloud-spanner-developers@googlegroups.com
101
212
  executables: []
102
213
  extensions: []
103
214
  extra_rdoc_files: []
104
215
  files:
216
+ - ".github/CODEOWNERS"
217
+ - ".github/sync-repo-settings.yaml"
218
+ - ".github/workflows/acceptance-tests-on-emulator.yaml"
219
+ - ".github/workflows/acceptance-tests-on-production.yaml"
220
+ - ".github/workflows/ci.yaml"
221
+ - ".github/workflows/nightly-acceptance-tests-on-emulator.yaml"
222
+ - ".github/workflows/nightly-acceptance-tests-on-production.yaml"
223
+ - ".github/workflows/nightly-unit-tests.yaml"
224
+ - ".github/workflows/release-please-label.yml"
225
+ - ".github/workflows/release-please.yml"
226
+ - ".github/workflows/rubocop.yaml"
105
227
  - ".gitignore"
106
- - ".travis.yml"
228
+ - ".kokoro/populate-secrets.sh"
229
+ - ".kokoro/release.cfg"
230
+ - ".kokoro/release.sh"
231
+ - ".kokoro/trampoline_v2.sh"
232
+ - ".rubocop.yml"
233
+ - ".toys/release.rb"
234
+ - ".trampolinerc"
235
+ - ".yardopts"
236
+ - CHANGELOG.md
237
+ - CODE_OF_CONDUCT.md
238
+ - CONTRIBUTING.md
107
239
  - Gemfile
108
240
  - LICENSE
109
241
  - README.md
110
242
  - Rakefile
243
+ - SECURITY.md
244
+ - acceptance/cases/associations/has_many_associations_test.rb
245
+ - acceptance/cases/associations/has_many_through_associations_test.rb
246
+ - acceptance/cases/associations/has_one_associations_test.rb
247
+ - acceptance/cases/associations/has_one_through_associations_test.rb
248
+ - acceptance/cases/interleaved_associations/has_many_associations_using_interleaved_test.rb
249
+ - acceptance/cases/migration/change_schema_test.rb
250
+ - acceptance/cases/migration/change_table_test.rb
251
+ - acceptance/cases/migration/column_attributes_test.rb
252
+ - acceptance/cases/migration/column_positioning_test.rb
253
+ - acceptance/cases/migration/columns_test.rb
254
+ - acceptance/cases/migration/command_recorder_test.rb
255
+ - acceptance/cases/migration/create_join_table_test.rb
256
+ - acceptance/cases/migration/ddl_batching_test.rb
257
+ - acceptance/cases/migration/foreign_key_test.rb
258
+ - acceptance/cases/migration/index_test.rb
259
+ - acceptance/cases/migration/references_foreign_key_test.rb
260
+ - acceptance/cases/migration/references_index_test.rb
261
+ - acceptance/cases/migration/references_statements_test.rb
262
+ - acceptance/cases/migration/rename_column_test.rb
263
+ - acceptance/cases/models/calculation_query_test.rb
264
+ - acceptance/cases/models/generated_column_test.rb
265
+ - acceptance/cases/models/mutation_test.rb
266
+ - acceptance/cases/models/query_test.rb
267
+ - acceptance/cases/sessions/session_not_found_test.rb
268
+ - acceptance/cases/transactions/optimistic_locking_test.rb
269
+ - acceptance/cases/transactions/read_only_transactions_test.rb
270
+ - acceptance/cases/transactions/read_write_transactions_test.rb
271
+ - acceptance/cases/type/all_types_test.rb
272
+ - acceptance/cases/type/binary_test.rb
273
+ - acceptance/cases/type/boolean_test.rb
274
+ - acceptance/cases/type/date_test.rb
275
+ - acceptance/cases/type/date_time_test.rb
276
+ - acceptance/cases/type/float_test.rb
277
+ - acceptance/cases/type/integer_test.rb
278
+ - acceptance/cases/type/numeric_test.rb
279
+ - acceptance/cases/type/string_test.rb
280
+ - acceptance/cases/type/text_test.rb
281
+ - acceptance/cases/type/time_test.rb
282
+ - acceptance/models/account.rb
283
+ - acceptance/models/address.rb
284
+ - acceptance/models/album.rb
285
+ - acceptance/models/all_types.rb
286
+ - acceptance/models/author.rb
287
+ - acceptance/models/club.rb
288
+ - acceptance/models/comment.rb
289
+ - acceptance/models/customer.rb
290
+ - acceptance/models/department.rb
291
+ - acceptance/models/firm.rb
292
+ - acceptance/models/member.rb
293
+ - acceptance/models/member_type.rb
294
+ - acceptance/models/membership.rb
295
+ - acceptance/models/organization.rb
296
+ - acceptance/models/post.rb
297
+ - acceptance/models/singer.rb
298
+ - acceptance/models/track.rb
299
+ - acceptance/models/transaction.rb
300
+ - acceptance/schema/schema.rb
301
+ - acceptance/test_helper.rb
111
302
  - activerecord-spanner-adapter.gemspec
303
+ - assets/solidus-db.png
304
+ - benchmarks/README.md
305
+ - benchmarks/Rakefile
306
+ - benchmarks/application.rb
307
+ - benchmarks/config/database.yml
308
+ - benchmarks/config/environment.rb
309
+ - benchmarks/db/migrate/01_create_tables.rb
310
+ - benchmarks/db/schema.rb
311
+ - benchmarks/models/album.rb
312
+ - benchmarks/models/singer.rb
112
313
  - bin/console
113
314
  - bin/setup
114
- - lib/active_record/connection_adapters/spanner.rb
115
- - lib/active_record/connection_adapters/spanner/client.rb
315
+ - examples/rails/README.md
316
+ - examples/snippets/README.md
317
+ - examples/snippets/Rakefile
318
+ - examples/snippets/array-data-type/README.md
319
+ - examples/snippets/array-data-type/Rakefile
320
+ - examples/snippets/array-data-type/application.rb
321
+ - examples/snippets/array-data-type/config/database.yml
322
+ - examples/snippets/array-data-type/db/migrate/01_create_tables.rb
323
+ - examples/snippets/array-data-type/db/schema.rb
324
+ - examples/snippets/array-data-type/db/seeds.rb
325
+ - examples/snippets/array-data-type/models/entity_with_array_types.rb
326
+ - examples/snippets/bin/create_emulator_instance.rb
327
+ - examples/snippets/bulk-insert/README.md
328
+ - examples/snippets/bulk-insert/Rakefile
329
+ - examples/snippets/bulk-insert/application.rb
330
+ - examples/snippets/bulk-insert/config/database.yml
331
+ - examples/snippets/bulk-insert/db/migrate/01_create_tables.rb
332
+ - examples/snippets/bulk-insert/db/schema.rb
333
+ - examples/snippets/bulk-insert/db/seeds.rb
334
+ - examples/snippets/bulk-insert/models/album.rb
335
+ - examples/snippets/bulk-insert/models/singer.rb
336
+ - examples/snippets/commit-timestamp/README.md
337
+ - examples/snippets/commit-timestamp/Rakefile
338
+ - examples/snippets/commit-timestamp/application.rb
339
+ - examples/snippets/commit-timestamp/config/database.yml
340
+ - examples/snippets/commit-timestamp/db/migrate/01_create_tables.rb
341
+ - examples/snippets/commit-timestamp/db/schema.rb
342
+ - examples/snippets/commit-timestamp/db/seeds.rb
343
+ - examples/snippets/commit-timestamp/models/album.rb
344
+ - examples/snippets/commit-timestamp/models/singer.rb
345
+ - examples/snippets/config/environment.rb
346
+ - examples/snippets/create-records/README.md
347
+ - examples/snippets/create-records/Rakefile
348
+ - examples/snippets/create-records/application.rb
349
+ - examples/snippets/create-records/config/database.yml
350
+ - examples/snippets/create-records/db/migrate/01_create_tables.rb
351
+ - examples/snippets/create-records/db/schema.rb
352
+ - examples/snippets/create-records/db/seeds.rb
353
+ - examples/snippets/create-records/models/album.rb
354
+ - examples/snippets/create-records/models/singer.rb
355
+ - examples/snippets/date-data-type/README.md
356
+ - examples/snippets/date-data-type/Rakefile
357
+ - examples/snippets/date-data-type/application.rb
358
+ - examples/snippets/date-data-type/config/database.yml
359
+ - examples/snippets/date-data-type/db/migrate/01_create_tables.rb
360
+ - examples/snippets/date-data-type/db/schema.rb
361
+ - examples/snippets/date-data-type/db/seeds.rb
362
+ - examples/snippets/date-data-type/models/singer.rb
363
+ - examples/snippets/generated-column/README.md
364
+ - examples/snippets/generated-column/Rakefile
365
+ - examples/snippets/generated-column/application.rb
366
+ - examples/snippets/generated-column/config/database.yml
367
+ - examples/snippets/generated-column/db/migrate/01_create_tables.rb
368
+ - examples/snippets/generated-column/db/schema.rb
369
+ - examples/snippets/generated-column/db/seeds.rb
370
+ - examples/snippets/generated-column/models/singer.rb
371
+ - examples/snippets/interleaved-tables/README.md
372
+ - examples/snippets/interleaved-tables/Rakefile
373
+ - examples/snippets/interleaved-tables/application.rb
374
+ - examples/snippets/interleaved-tables/config/database.yml
375
+ - examples/snippets/interleaved-tables/db/migrate/01_create_tables.rb
376
+ - examples/snippets/interleaved-tables/db/schema.rb
377
+ - examples/snippets/interleaved-tables/db/seeds.rb
378
+ - examples/snippets/interleaved-tables/models/album.rb
379
+ - examples/snippets/interleaved-tables/models/singer.rb
380
+ - examples/snippets/interleaved-tables/models/track.rb
381
+ - examples/snippets/migrations/README.md
382
+ - examples/snippets/migrations/Rakefile
383
+ - examples/snippets/migrations/application.rb
384
+ - examples/snippets/migrations/config/database.yml
385
+ - examples/snippets/migrations/db/migrate/01_create_tables.rb
386
+ - examples/snippets/migrations/db/schema.rb
387
+ - examples/snippets/migrations/db/seeds.rb
388
+ - examples/snippets/migrations/models/album.rb
389
+ - examples/snippets/migrations/models/singer.rb
390
+ - examples/snippets/migrations/models/track.rb
391
+ - examples/snippets/mutations/README.md
392
+ - examples/snippets/mutations/Rakefile
393
+ - examples/snippets/mutations/application.rb
394
+ - examples/snippets/mutations/config/database.yml
395
+ - examples/snippets/mutations/db/migrate/01_create_tables.rb
396
+ - examples/snippets/mutations/db/schema.rb
397
+ - examples/snippets/mutations/db/seeds.rb
398
+ - examples/snippets/mutations/models/album.rb
399
+ - examples/snippets/mutations/models/singer.rb
400
+ - examples/snippets/optimistic-locking/README.md
401
+ - examples/snippets/optimistic-locking/Rakefile
402
+ - examples/snippets/optimistic-locking/application.rb
403
+ - examples/snippets/optimistic-locking/config/database.yml
404
+ - examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
405
+ - examples/snippets/optimistic-locking/db/schema.rb
406
+ - examples/snippets/optimistic-locking/db/seeds.rb
407
+ - examples/snippets/optimistic-locking/models/album.rb
408
+ - examples/snippets/optimistic-locking/models/singer.rb
409
+ - examples/snippets/quickstart/README.md
410
+ - examples/snippets/quickstart/Rakefile
411
+ - examples/snippets/quickstart/application.rb
412
+ - examples/snippets/quickstart/config/database.yml
413
+ - examples/snippets/quickstart/db/migrate/01_create_tables.rb
414
+ - examples/snippets/quickstart/db/schema.rb
415
+ - examples/snippets/quickstart/db/seeds.rb
416
+ - examples/snippets/quickstart/models/album.rb
417
+ - examples/snippets/quickstart/models/singer.rb
418
+ - examples/snippets/read-only-transactions/README.md
419
+ - examples/snippets/read-only-transactions/Rakefile
420
+ - examples/snippets/read-only-transactions/application.rb
421
+ - examples/snippets/read-only-transactions/config/database.yml
422
+ - examples/snippets/read-only-transactions/db/migrate/01_create_tables.rb
423
+ - examples/snippets/read-only-transactions/db/schema.rb
424
+ - examples/snippets/read-only-transactions/db/seeds.rb
425
+ - examples/snippets/read-only-transactions/models/album.rb
426
+ - examples/snippets/read-only-transactions/models/singer.rb
427
+ - examples/snippets/read-write-transactions/README.md
428
+ - examples/snippets/read-write-transactions/Rakefile
429
+ - examples/snippets/read-write-transactions/application.rb
430
+ - examples/snippets/read-write-transactions/config/database.yml
431
+ - examples/snippets/read-write-transactions/db/migrate/01_create_tables.rb
432
+ - examples/snippets/read-write-transactions/db/schema.rb
433
+ - examples/snippets/read-write-transactions/db/seeds.rb
434
+ - examples/snippets/read-write-transactions/models/album.rb
435
+ - examples/snippets/read-write-transactions/models/singer.rb
436
+ - examples/snippets/timestamp-data-type/README.md
437
+ - examples/snippets/timestamp-data-type/Rakefile
438
+ - examples/snippets/timestamp-data-type/application.rb
439
+ - examples/snippets/timestamp-data-type/config/database.yml
440
+ - examples/snippets/timestamp-data-type/db/migrate/01_create_tables.rb
441
+ - examples/snippets/timestamp-data-type/db/schema.rb
442
+ - examples/snippets/timestamp-data-type/db/seeds.rb
443
+ - examples/snippets/timestamp-data-type/models/meeting.rb
444
+ - examples/solidus/README.md
116
445
  - lib/active_record/connection_adapters/spanner/database_statements.rb
117
446
  - lib/active_record/connection_adapters/spanner/quoting.rb
447
+ - lib/active_record/connection_adapters/spanner/schema_cache.rb
118
448
  - lib/active_record/connection_adapters/spanner/schema_creation.rb
449
+ - lib/active_record/connection_adapters/spanner/schema_definitions.rb
450
+ - lib/active_record/connection_adapters/spanner/schema_dumper.rb
119
451
  - lib/active_record/connection_adapters/spanner/schema_statements.rb
452
+ - lib/active_record/connection_adapters/spanner/type_metadata.rb
120
453
  - lib/active_record/connection_adapters/spanner_adapter.rb
121
- - lib/activerecord-spanner-adapter/version.rb
122
- homepage: https://github.com/supership-jp/activerecord-spanner-adapter
123
- licenses: []
454
+ - lib/active_record/tasks/spanner_database_tasks.rb
455
+ - lib/active_record/type/spanner/array.rb
456
+ - lib/active_record/type/spanner/bytes.rb
457
+ - lib/active_record/type/spanner/spanner_active_record_converter.rb
458
+ - lib/active_record/type/spanner/time.rb
459
+ - lib/activerecord-spanner-adapter.rb
460
+ - lib/activerecord_spanner_adapter/base.rb
461
+ - lib/activerecord_spanner_adapter/connection.rb
462
+ - lib/activerecord_spanner_adapter/errors.rb
463
+ - lib/activerecord_spanner_adapter/foreign_key.rb
464
+ - lib/activerecord_spanner_adapter/index.rb
465
+ - lib/activerecord_spanner_adapter/index/column.rb
466
+ - lib/activerecord_spanner_adapter/information_schema.rb
467
+ - lib/activerecord_spanner_adapter/primary_key.rb
468
+ - lib/activerecord_spanner_adapter/table.rb
469
+ - lib/activerecord_spanner_adapter/table/column.rb
470
+ - lib/activerecord_spanner_adapter/transaction.rb
471
+ - lib/activerecord_spanner_adapter/version.rb
472
+ - lib/arel/visitors/spanner.rb
473
+ - lib/spanner_client_ext.rb
474
+ - renovate.json
475
+ homepage: https://github.com/googleapis/ruby-spanner-activerecord
476
+ licenses:
477
+ - MIT
124
478
  metadata: {}
125
479
  post_install_message:
126
480
  rdoc_options: []
@@ -130,16 +484,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
484
  requirements:
131
485
  - - ">="
132
486
  - !ruby/object:Gem::Version
133
- version: '0'
487
+ version: '2.5'
134
488
  required_rubygems_version: !ruby/object:Gem::Requirement
135
489
  requirements:
136
490
  - - ">="
137
491
  - !ruby/object:Gem::Version
138
492
  version: '0'
139
493
  requirements: []
140
- rubyforge_project:
141
- rubygems_version: 2.6.10
494
+ rubygems_version: 3.2.17
142
495
  signing_key:
143
496
  specification_version: 4
144
- summary: Adapts Google Cloud Spanner to ActiveRecord
497
+ summary: Rails ActiveRecord connector for Google Spanner Database
145
498
  test_files: []