activerecord-spanner-adapter 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 499376d85989274623aa1cda4cb9197e14636b42cd5cf5d5bda4b3fbdb2a6494
4
- data.tar.gz: 4e0f7e384b4450b28581523a79540416567aa44745e44377a1f7744e11ff95e7
3
+ metadata.gz: 2f432fe0aba4f4aaa5d2bcc689d8337fb944b393a8f71e11731f21bd2bc1aad5
4
+ data.tar.gz: 3dd03abd67174f3b7239d2c19a18ae0df756ad009988ae8ecddbd2369eb7164b
5
5
  SHA512:
6
- metadata.gz: a3d5ff8b79e774c6eb6c74431162366543d2476a8f2e7eb3f3f2d81dac249b0493a773b09cd787cdf5a8dd5b287d85170021b2e7c47c2aba9d06f76a77c2b9d6
7
- data.tar.gz: 28bebd4c40535b80239992f66aed5030744623c21c00f875b548fac2c0318280871e83c294e8b87681a2376d34446050cee60283da469ff4fe175b2ad78685a6
6
+ metadata.gz: d99d549f841dcb2facf0438335b06449f70e033ad9c030fa2396fff16650e8a9ee653157ee8699cd9e473515630766e2f9b3e117acc73d6ddf35fb8ee83724a1
7
+ data.tar.gz: 4e207e65e60ab191c7479f7ae47c9fdd0ebac9a5ca54505841155428b88dc60c379dae96db6e43cd17e8c2bc2af9d9b7b5b4c5ae091281416cdf9d7616edaf9c
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "1.4.0"
2
+ ".": "1.4.1"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.4.1 (2023-03-01)
4
+
5
+ #### Bug Fixes
6
+
7
+ * wrap default values in () as required ([#238](https://github.com/googleapis/ruby-spanner-activerecord/issues/238))
8
+ #### Documentation
9
+
10
+ * call out best practices and dialect compatibility ([#240](https://github.com/googleapis/ruby-spanner-activerecord/issues/240))
11
+
3
12
  ### 1.4.0 (2023-01-18)
4
13
 
5
14
  #### Features
data/README.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  ![rubocop](https://github.com/googleapis/ruby-spanner-activerecord/workflows/rubocop/badge.svg)
6
6
 
7
+ __This adapter only supports GoogleSQL-dialect Cloud Spanner databases. PostgreSQL-dialect
8
+ databases are not supported.__
9
+
7
10
  This project provides a Cloud Spanner adapter for ActiveRecord. It supports the following versions:
8
11
 
9
12
  - ActiveRecord 6.0.x with Ruby 2.6 and 2.7.
@@ -13,9 +16,6 @@ This project provides a Cloud Spanner adapter for ActiveRecord. It supports the
13
16
  Known limitations are listed in the [Limitations](#limitations) section.
14
17
  Please report any problems that you might encounter by [creating a new issue](https://github.com/googleapis/ruby-spanner-activerecord/issues/new).
15
18
 
16
- This adapter only supports GoogleSQL-dialect Cloud Spanner databases. PostgreSQL-dialect
17
- databases are not supported.
18
-
19
19
  ## Installation
20
20
 
21
21
  Add this line to your application's Gemfile:
@@ -36,6 +36,14 @@ And then execute:
36
36
 
37
37
  ## Usage
38
38
 
39
+ ### Migrations
40
+ __Use DDL batching when executing migrations for the best possible performance.__
41
+
42
+ Executing multiple schema changes on Cloud Spanner can take a long time. It is therefore
43
+ strongly recommended that you limit the number of schema change operations. You can do
44
+ this by using DDL batching in your migrations. See [the migrations examples](examples/snippets/migrations)
45
+ for how to do this.
46
+
39
47
  ### Database Connection
40
48
  In Rails application `config/database.yml`, make the change as the following:
41
49
 
@@ -120,6 +120,27 @@ module ActiveRecord
120
120
  end
121
121
  end
122
122
 
123
+ def test_create_table_with_column_default
124
+ testings_klass = Class.new ActiveRecord::Base
125
+ connection.ddl_batch do
126
+ connection.create_table :testings do |t|
127
+ t.string :name, null: false, default: "no name"
128
+ t.integer :age, null: false, default: 10
129
+ end
130
+ testings_klass.table_name = "testings"
131
+ end
132
+
133
+ testings_klass.reset_column_information
134
+ assert_equal false, testings_klass.columns_hash["name"].null
135
+ assert_equal false, testings_klass.columns_hash["age"].null
136
+
137
+ assert_nothing_raised {
138
+ testings_klass.connection.transaction {
139
+ testings_klass.connection.execute("insert into testings (id, name, age) values (#{generate_id}, DEFAULT, DEFAULT)")
140
+ }
141
+ }
142
+ end
143
+
123
144
  def test_create_table_with_limits
124
145
  connection.ddl_batch do
125
146
  connection.create_table :testings do |t|
@@ -129,7 +129,7 @@ module ActiveRecord
129
129
  sql << " NOT NULL"
130
130
  end
131
131
  if options.key? :default
132
- sql << " DEFAULT #{quote_default_expression options[:default], column}"
132
+ sql << " DEFAULT (#{quote_default_expression options[:default], column})"
133
133
  end
134
134
 
135
135
  if !options[:allow_commit_timestamp].nil? &&
@@ -5,5 +5,5 @@
5
5
  # https://opensource.org/licenses/MIT.
6
6
 
7
7
  module ActiveRecordSpannerAdapter
8
- VERSION = "1.4.0".freeze
8
+ VERSION = "1.4.1".freeze
9
9
  end
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.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-18 00:00:00.000000000 Z
11
+ date: 2023-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-spanner