planetscale_rails 0.2.8 → 0.2.9

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: a729aacf558e6da145241a597684adb4d29955b6eeab42f29240b770c8a3408a
4
- data.tar.gz: c87ade0cd8a1cb10439d1d59fbeb9337b242ec2ad1c5ce3b5dc49ab7c18e7c61
3
+ metadata.gz: daf913803fb37b2cca87b9b72a196b4bb62a66143657ac7f7566bb915a7d9ca0
4
+ data.tar.gz: cf29f4137f4a36860cb918b653e88ff859509a0138638070ca7f08e82b3fb59f
5
5
  SHA512:
6
- metadata.gz: c9a2a1aef31f58431a6bbfe557b7daafb25964c87eb264b41bd00b32ac8e646cc1d5f6c3aa349701446bb468d7ed0e1b5eac4043c1dd7bf0fbf3b3d023625980
7
- data.tar.gz: 9d6c76a0c66b8137af59292c897952dbe2e8e261aeb0f2ae7a4cfe082a6fff332b09878df8861153d747a46259f0cb65c478787c3c92aaf9e3053c5ece674ddd
6
+ metadata.gz: 7bf9630285fa1e18a55e0f63c65295a97a7cc4a6d307b8437018c047a0cd6b0e6f492dce48b20e09c7c519b7628e37ffe7359f1902c0764c7188d6c5123aba32
7
+ data.tar.gz: c00fc461c965bdf6181b49faff03c8e2f5ba159dcd29398500bf9a1306f2edc83300d22cf172613a5ce02db319133011f1b047d857a09851aecc1a49730581d7
@@ -191,6 +191,30 @@ namespace :psdb do
191
191
  end
192
192
 
193
193
  namespace :schema do
194
+ desc "Connects to the current PlanetScale branch and runs rails db:schema:load"
195
+ task load: %i[environment check_ci create_creds] do
196
+ db_configs = ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env)
197
+
198
+ unless db_configs.size == 1
199
+ raise "Found multiple database configurations, please specify which database you want to load schema for using `psdb:schema:load:<database_name>`".colorize(:red)
200
+ end
201
+
202
+ puts "Loading schema..."
203
+
204
+ command = "DATABASE_URL=\"#{ENV["PSCALE_DATABASE_URL"]}\" bundle exec rails db:schema:load"
205
+ IO.popen(command) do |io|
206
+ io.each_line do |line|
207
+ puts line
208
+ end
209
+ end
210
+
211
+ unless $CHILD_STATUS.success?
212
+ puts "Failed to load schema".colorize(:red)
213
+ end
214
+ ensure
215
+ delete_password
216
+ end
217
+
194
218
  namespace :load do
195
219
  ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
196
220
  desc "Connects to the current PlanetScale branch and runs rails db:schema:load:#{name}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlanetscaleRails
4
- VERSION = "0.2.8"
4
+ VERSION = "0.2.9"
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.8
4
+ version: 0.2.9
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-19 00:00:00.000000000 Z
12
+ date: 2025-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize