planetscale_rails 0.2.5 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/licensing.yml +1 -1
- data/.github/workflows/main.yml +1 -1
- data/.ruby-version +1 -1
- data/Gemfile.lock +121 -87
- data/README.md +15 -0
- data/lib/planetscale_rails/migration.rb +1 -3
- data/lib/planetscale_rails/tasks/psdb.rake +1 -1
- data/lib/planetscale_rails/version.rb +1 -1
- data/planetscale_rails.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba3416f998629348115ddc6be439a288758e4fe057d050ca49a157d7d78353bb
|
4
|
+
data.tar.gz: e677f4a2becb94820893b42553f99b31ca18dfb2529ea495b33b54bcf47d5a57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c960f01a6721185e00e2e61ad4394b96a049c3689567ad277320d4fde9eabee90f073141ba4dd3c88c7b40c403c940fed5c983561e6d8d28d1cabe1f31beb6e5
|
7
|
+
data.tar.gz: d2c93b515506b05cc208b934863693f707c65bdc8c1e8d3300708c7ff3516431fc132061b17cca91acf89c1d7d0c9633ba6de3deae3e6bd563896aa5759aa7a7
|
data/.github/workflows/main.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
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.
|
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.
|
12
|
-
actionpack (= 7.
|
13
|
-
activesupport (= 7.
|
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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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.
|
27
|
-
actionpack (= 7.
|
28
|
-
actionview (= 7.
|
29
|
-
activejob (= 7.
|
30
|
-
activesupport (= 7.
|
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.
|
36
|
-
actionpack (7.
|
37
|
-
actionview (= 7.
|
38
|
-
activesupport (= 7.
|
39
|
-
|
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.
|
42
|
-
rails-html-sanitizer (~> 1.
|
43
|
-
actiontext (7.
|
44
|
-
actionpack (= 7.
|
45
|
-
activerecord (= 7.
|
46
|
-
activestorage (= 7.
|
47
|
-
activesupport (= 7.
|
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.
|
51
|
-
activesupport (= 7.
|
54
|
+
actionview (7.1.3.3)
|
55
|
+
activesupport (= 7.1.3.3)
|
52
56
|
builder (~> 3.1)
|
53
|
-
erubi (~> 1.
|
54
|
-
rails-dom-testing (~> 2.
|
55
|
-
rails-html-sanitizer (~> 1.
|
56
|
-
activejob (7.
|
57
|
-
activesupport (= 7.
|
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.
|
60
|
-
activesupport (= 7.
|
61
|
-
activerecord (7.
|
62
|
-
activemodel (= 7.
|
63
|
-
activesupport (= 7.
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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
|
-
|
71
|
-
|
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.
|
90
|
+
concurrent-ruby (1.2.3)
|
91
|
+
connection_pool (2.4.1)
|
80
92
|
crass (1.0.6)
|
81
|
-
date (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
|
85
|
-
activesupport (>=
|
86
|
-
i18n (1.14.
|
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.
|
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.
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
net-imap (0.
|
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.
|
123
|
+
net-protocol (0.2.2)
|
107
124
|
timeout
|
108
|
-
net-smtp (0.
|
125
|
+
net-smtp (0.5.0)
|
109
126
|
net-protocol
|
110
|
-
nio4r (2.
|
111
|
-
nokogiri (1.
|
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.
|
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
|
-
|
119
|
-
|
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
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
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.
|
136
|
-
rails-dom-testing (2.
|
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.
|
144
|
-
actionpack (= 7.
|
145
|
-
activesupport (= 7.
|
146
|
-
|
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.
|
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
|
-
|
181
|
-
|
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.
|
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
|
|
data/planetscale_rails.gemspec
CHANGED
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.
|
4
|
+
version: 0.2.7
|
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-
|
12
|
+
date: 2024-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
version: '6.0'
|
35
35
|
- - "<"
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
37
|
+
version: '9'
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: '6.0'
|
45
45
|
- - "<"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '9'
|
48
48
|
description: A collection of rake tasks to make managing schema migrations with PlanetScale
|
49
49
|
easy
|
50
50
|
email:
|
@@ -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.
|
101
|
+
rubygems_version: 3.5.9
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Make Rails migrations easy with PlanetScale
|