planetscale_rails 0.2.5 → 0.2.6

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: 5f6d7a222eeb8aad5e6b25c09db2b51e1c9897c8233a8fb7a63e51fcceb59ca1
4
- data.tar.gz: 991216a366f7fc53a29086b4706bc5f531e2253c4932bb14462c80b446c9e274
3
+ metadata.gz: 89021dbe9a8a5e397bb0a9c9aba28b42032204e4d1a3125904b592811db24d00
4
+ data.tar.gz: a10287c5d28851e4a07f0e5d638aed27575e853ede46e878b4f5f6ff472a2e5b
5
5
  SHA512:
6
- metadata.gz: 16a273f6d0473dd0e447259d7065a3d385c5e2755fe3ef474ca24d34d99a7a54902538f2c2694445b8a451ab818eb7a62d01fc77da83c1a0f7a9504ef812d6fe
7
- data.tar.gz: befc832fd4d59199510792f9a60ff893550758c7a0fbef22d253f0d209af08eb9db5dca47a2da6d68d3f49eba289318eb2b9d9a8c3a5ebaeea7d9b8fc13a2539
6
+ metadata.gz: f99d3cdef9698c9cf1847aa6160eee26cc4b506e3a954677e2433d94d83c4300cf7f7bf3d5de9366631d3052493273636ca0516ce6c99fe3ecdff93ebb915b3e
7
+ data.tar.gz: 0ef94d8b855530df999d171cd9cd4932cc543dbb97026df83e6cd3af113982e67793fd4d6a1315bd6ca52df3320291ef87539208ab62d62ad03fbca88f88b92f
@@ -20,7 +20,7 @@ jobs:
20
20
  - name: Set up Ruby
21
21
  uses: ruby/setup-ruby@v1
22
22
  with:
23
- ruby-version: 3.1.2
23
+ ruby-version: 3.3.1
24
24
  bundler-cache: false
25
25
  - run: bundle install
26
26
  - run: gem install license_finder
@@ -10,7 +10,7 @@ jobs:
10
10
  - name: Set up Ruby
11
11
  uses: ruby/setup-ruby@v1
12
12
  with:
13
- ruby-version: 3.2.1
13
+ ruby-version: 3.3.1
14
14
  bundler-cache: false
15
15
  - run: bundle install
16
16
  - name: Run the default task
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.1
1
+ 3.3.1
data/Gemfile.lock CHANGED
@@ -1,92 +1,109 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- planetscale_rails (0.2.0)
4
+ planetscale_rails (0.2.6)
5
5
  colorize (~> 0.8.1)
6
6
  rails (>= 6.0, < 8)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (7.0.6)
12
- actionpack (= 7.0.6)
13
- activesupport (= 7.0.6)
11
+ actioncable (7.1.3.3)
12
+ actionpack (= 7.1.3.3)
13
+ activesupport (= 7.1.3.3)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (7.0.6)
17
- actionpack (= 7.0.6)
18
- activejob (= 7.0.6)
19
- activerecord (= 7.0.6)
20
- activestorage (= 7.0.6)
21
- activesupport (= 7.0.6)
16
+ zeitwerk (~> 2.6)
17
+ actionmailbox (7.1.3.3)
18
+ actionpack (= 7.1.3.3)
19
+ activejob (= 7.1.3.3)
20
+ activerecord (= 7.1.3.3)
21
+ activestorage (= 7.1.3.3)
22
+ activesupport (= 7.1.3.3)
22
23
  mail (>= 2.7.1)
23
24
  net-imap
24
25
  net-pop
25
26
  net-smtp
26
- actionmailer (7.0.6)
27
- actionpack (= 7.0.6)
28
- actionview (= 7.0.6)
29
- activejob (= 7.0.6)
30
- activesupport (= 7.0.6)
27
+ actionmailer (7.1.3.3)
28
+ actionpack (= 7.1.3.3)
29
+ actionview (= 7.1.3.3)
30
+ activejob (= 7.1.3.3)
31
+ activesupport (= 7.1.3.3)
31
32
  mail (~> 2.5, >= 2.5.4)
32
33
  net-imap
33
34
  net-pop
34
35
  net-smtp
35
- rails-dom-testing (~> 2.0)
36
- actionpack (7.0.6)
37
- actionview (= 7.0.6)
38
- activesupport (= 7.0.6)
39
- rack (~> 2.0, >= 2.2.4)
36
+ rails-dom-testing (~> 2.2)
37
+ actionpack (7.1.3.3)
38
+ actionview (= 7.1.3.3)
39
+ activesupport (= 7.1.3.3)
40
+ nokogiri (>= 1.8.5)
41
+ racc
42
+ rack (>= 2.2.4)
43
+ rack-session (>= 1.0.1)
40
44
  rack-test (>= 0.6.3)
41
- rails-dom-testing (~> 2.0)
42
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
- actiontext (7.0.6)
44
- actionpack (= 7.0.6)
45
- activerecord (= 7.0.6)
46
- activestorage (= 7.0.6)
47
- activesupport (= 7.0.6)
45
+ rails-dom-testing (~> 2.2)
46
+ rails-html-sanitizer (~> 1.6)
47
+ actiontext (7.1.3.3)
48
+ actionpack (= 7.1.3.3)
49
+ activerecord (= 7.1.3.3)
50
+ activestorage (= 7.1.3.3)
51
+ activesupport (= 7.1.3.3)
48
52
  globalid (>= 0.6.0)
49
53
  nokogiri (>= 1.8.5)
50
- actionview (7.0.6)
51
- activesupport (= 7.0.6)
54
+ actionview (7.1.3.3)
55
+ activesupport (= 7.1.3.3)
52
56
  builder (~> 3.1)
53
- erubi (~> 1.4)
54
- rails-dom-testing (~> 2.0)
55
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
56
- activejob (7.0.6)
57
- activesupport (= 7.0.6)
57
+ erubi (~> 1.11)
58
+ rails-dom-testing (~> 2.2)
59
+ rails-html-sanitizer (~> 1.6)
60
+ activejob (7.1.3.3)
61
+ activesupport (= 7.1.3.3)
58
62
  globalid (>= 0.3.6)
59
- activemodel (7.0.6)
60
- activesupport (= 7.0.6)
61
- activerecord (7.0.6)
62
- activemodel (= 7.0.6)
63
- activesupport (= 7.0.6)
64
- activestorage (7.0.6)
65
- actionpack (= 7.0.6)
66
- activejob (= 7.0.6)
67
- activerecord (= 7.0.6)
68
- activesupport (= 7.0.6)
63
+ activemodel (7.1.3.3)
64
+ activesupport (= 7.1.3.3)
65
+ activerecord (7.1.3.3)
66
+ activemodel (= 7.1.3.3)
67
+ activesupport (= 7.1.3.3)
68
+ timeout (>= 0.4.0)
69
+ activestorage (7.1.3.3)
70
+ actionpack (= 7.1.3.3)
71
+ activejob (= 7.1.3.3)
72
+ activerecord (= 7.1.3.3)
73
+ activesupport (= 7.1.3.3)
69
74
  marcel (~> 1.0)
70
- mini_mime (>= 1.1.0)
71
- activesupport (7.0.6)
75
+ activesupport (7.1.3.3)
76
+ base64
77
+ bigdecimal
72
78
  concurrent-ruby (~> 1.0, >= 1.0.2)
79
+ connection_pool (>= 2.2.5)
80
+ drb
73
81
  i18n (>= 1.6, < 2)
74
82
  minitest (>= 5.1)
83
+ mutex_m
75
84
  tzinfo (~> 2.0)
76
85
  ast (2.4.2)
86
+ base64 (0.2.0)
87
+ bigdecimal (3.1.8)
77
88
  builder (3.2.4)
78
89
  colorize (0.8.1)
79
- concurrent-ruby (1.2.2)
90
+ concurrent-ruby (1.2.3)
91
+ connection_pool (2.4.1)
80
92
  crass (1.0.6)
81
- date (3.3.3)
93
+ date (3.3.4)
82
94
  diff-lcs (1.5.0)
95
+ drb (2.2.1)
83
96
  erubi (1.12.0)
84
- globalid (1.1.0)
85
- activesupport (>= 5.0)
86
- i18n (1.14.1)
97
+ globalid (1.2.1)
98
+ activesupport (>= 6.1)
99
+ i18n (1.14.5)
87
100
  concurrent-ruby (~> 1.0)
101
+ io-console (0.7.2)
102
+ irb (1.13.1)
103
+ rdoc (>= 4.0.0)
104
+ reline (>= 0.4.2)
88
105
  json (2.6.3)
89
- loofah (2.21.3)
106
+ loofah (2.22.0)
90
107
  crass (~> 1.0.2)
91
108
  nokogiri (>= 1.12.0)
92
109
  mail (2.8.1)
@@ -94,62 +111,76 @@ GEM
94
111
  net-imap
95
112
  net-pop
96
113
  net-smtp
97
- marcel (1.0.2)
98
- method_source (1.0.0)
99
- mini_mime (1.1.2)
100
- minitest (5.19.0)
101
- net-imap (0.3.7)
114
+ marcel (1.0.4)
115
+ mini_mime (1.1.5)
116
+ minitest (5.23.1)
117
+ mutex_m (0.2.0)
118
+ net-imap (0.4.11)
102
119
  date
103
120
  net-protocol
104
121
  net-pop (0.1.2)
105
122
  net-protocol
106
- net-protocol (0.2.1)
123
+ net-protocol (0.2.2)
107
124
  timeout
108
- net-smtp (0.3.3)
125
+ net-smtp (0.5.0)
109
126
  net-protocol
110
- nio4r (2.5.9)
111
- nokogiri (1.15.4-x86_64-darwin)
127
+ nio4r (2.7.3)
128
+ nokogiri (1.16.5-arm64-darwin)
129
+ racc (~> 1.4)
130
+ nokogiri (1.16.5-x86_64-darwin)
112
131
  racc (~> 1.4)
113
- nokogiri (1.15.4-x86_64-linux)
132
+ nokogiri (1.16.5-x86_64-linux)
114
133
  racc (~> 1.4)
115
134
  parallel (1.22.1)
116
135
  parser (3.2.1.0)
117
136
  ast (~> 2.4.1)
118
- racc (1.7.3)
119
- rack (2.2.7)
137
+ psych (5.1.2)
138
+ stringio
139
+ racc (1.8.0)
140
+ rack (3.0.11)
141
+ rack-session (2.0.0)
142
+ rack (>= 3.0.0)
120
143
  rack-test (2.1.0)
121
144
  rack (>= 1.3)
122
- rails (7.0.6)
123
- actioncable (= 7.0.6)
124
- actionmailbox (= 7.0.6)
125
- actionmailer (= 7.0.6)
126
- actionpack (= 7.0.6)
127
- actiontext (= 7.0.6)
128
- actionview (= 7.0.6)
129
- activejob (= 7.0.6)
130
- activemodel (= 7.0.6)
131
- activerecord (= 7.0.6)
132
- activestorage (= 7.0.6)
133
- activesupport (= 7.0.6)
145
+ rackup (2.1.0)
146
+ rack (>= 3)
147
+ webrick (~> 1.8)
148
+ rails (7.1.3.3)
149
+ actioncable (= 7.1.3.3)
150
+ actionmailbox (= 7.1.3.3)
151
+ actionmailer (= 7.1.3.3)
152
+ actionpack (= 7.1.3.3)
153
+ actiontext (= 7.1.3.3)
154
+ actionview (= 7.1.3.3)
155
+ activejob (= 7.1.3.3)
156
+ activemodel (= 7.1.3.3)
157
+ activerecord (= 7.1.3.3)
158
+ activestorage (= 7.1.3.3)
159
+ activesupport (= 7.1.3.3)
134
160
  bundler (>= 1.15.0)
135
- railties (= 7.0.6)
136
- rails-dom-testing (2.1.1)
161
+ railties (= 7.1.3.3)
162
+ rails-dom-testing (2.2.0)
137
163
  activesupport (>= 5.0.0)
138
164
  minitest
139
165
  nokogiri (>= 1.6)
140
166
  rails-html-sanitizer (1.6.0)
141
167
  loofah (~> 2.21)
142
168
  nokogiri (~> 1.14)
143
- railties (7.0.6)
144
- actionpack (= 7.0.6)
145
- activesupport (= 7.0.6)
146
- method_source
169
+ railties (7.1.3.3)
170
+ actionpack (= 7.1.3.3)
171
+ activesupport (= 7.1.3.3)
172
+ irb
173
+ rackup (>= 1.0.0)
147
174
  rake (>= 12.2)
148
- thor (~> 1.0)
149
- zeitwerk (~> 2.5)
175
+ thor (~> 1.0, >= 1.2.2)
176
+ zeitwerk (~> 2.6)
150
177
  rainbow (3.1.1)
151
178
  rake (13.0.6)
179
+ rdoc (6.7.0)
180
+ psych (>= 4.0.0)
152
181
  regexp_parser (2.7.0)
182
+ reline (0.5.7)
183
+ io-console (~> 0.5)
153
184
  rexml (3.2.5)
154
185
  rspec (3.12.0)
155
186
  rspec-core (~> 3.12.0)
@@ -177,17 +208,20 @@ GEM
177
208
  rubocop-ast (1.27.0)
178
209
  parser (>= 3.2.1.0)
179
210
  ruby-progressbar (1.12.0)
180
- thor (1.2.2)
181
- timeout (0.4.0)
211
+ stringio (3.1.0)
212
+ thor (1.3.1)
213
+ timeout (0.4.1)
182
214
  tzinfo (2.0.6)
183
215
  concurrent-ruby (~> 1.0)
184
216
  unicode-display_width (2.4.2)
217
+ webrick (1.8.1)
185
218
  websocket-driver (0.7.6)
186
219
  websocket-extensions (>= 0.1.0)
187
220
  websocket-extensions (0.1.5)
188
- zeitwerk (2.6.9)
221
+ zeitwerk (2.6.15)
189
222
 
190
223
  PLATFORMS
224
+ arm64-darwin-23
191
225
  x86_64-darwin-20
192
226
  x86_64-darwin-22
193
227
  x86_64-linux
data/README.md CHANGED
@@ -80,6 +80,21 @@ pscale deploy-request create database-name my-new-branch-name
80
80
 
81
81
  4. To get your schema change to production, run the deploy request. Then, once it's complete, you can merge your code changes into your `main` branch in git and deploy your application code.
82
82
 
83
+ ## Usage with multiple keyspace (or sharded) databases
84
+
85
+ This gem supports working with multi-keyspace PlanetScale databases. When running migrations, Vitess will automatically route the schema change (DDL) to the correct keyspace based on the name of the table being altered.
86
+
87
+ **Creating new tables**
88
+
89
+ For adding a new table, you must specify the `keyspace` for the table. When running `psdb:migrate`, this gem will create the table in the correct keyspace. When running the migration locally against plain MySQL,
90
+ the keyspace will be ignored and the table will be created as normal within the same database.
91
+
92
+ ```ruby
93
+ create_table(:new_table, id: { type: :bigint, unsigned: true }, keyspace: "keyspace-name") do |t|
94
+ t.string :name
95
+ end
96
+ ```
97
+
83
98
  ## Using PlanetScale deploy requests vs `psdb:migrate` directly in production.
84
99
 
85
100
  PlanetScale's deploy requests [solve the schema change problem](https://planetscale.com/docs/learn/how-online-schema-change-tools-work). They make a normally high risk operation, safe. This is done by running your schema change using [Vitess's online schema change](https://vitess.io/docs/18.0/user-guides/schema-changes/) tools. Once the change is made, a deploy request is [also revertible without data loss](https://planetscale.com/blog/revert-a-migration-without-losing-data). None of this is possible when running `rails db:migrate` directly against your production database.
@@ -10,10 +10,8 @@ module PlanetscaleRails
10
10
  def create_table(table_name, **options)
11
11
  if ENV["ENABLE_PSDB"] && options[:keyspace].present?
12
12
  table_name = "#{options[:keyspace]}.#{table_name}"
13
- super(table_name, **options.except(:keyspace))
14
- else
15
- super(table_name, **options.except(:keyspace))
16
13
  end
14
+ super(table_name, **options.except(:keyspace))
17
15
  end
18
16
  end
19
17
  end
@@ -94,7 +94,7 @@ namespace :psdb do
94
94
 
95
95
  short_hash = SecureRandom.hex(2)[0, 4]
96
96
  password_name = "planetscale-rails-#{short_hash}"
97
- command = "pscale password create #{database} #{branch} #{password_name} -f json #{ENV["SERVICE_TOKEN_CONFIG"]}"
97
+ command = "pscale password create #{database} #{branch} #{password_name} -f json --ttl 10m #{ENV["SERVICE_TOKEN_CONFIG"]}"
98
98
 
99
99
  output = `#{command}`
100
100
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlanetscaleRails
4
- VERSION = "0.2.5"
4
+ VERSION = "0.2.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: planetscale_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Coutermarsh
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-04-01 00:00:00.000000000 Z
12
+ date: 2024-05-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  requirements: []
101
- rubygems_version: 3.4.7
101
+ rubygems_version: 3.5.9
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Make Rails migrations easy with PlanetScale