planetscale_rails 0.2.3 → 0.2.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b12ba63e8011c5a5838a651e7c6c89f4784bdf0729e571e1ce438aecf257dad
|
4
|
+
data.tar.gz: 2b90fe7b6861488cff954a6793a1fd30793b2c5690805ea0c1558663da2245ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff86c5cc8e0f75a5455ad9672decf0e3be090405fc5169c431a7f03c2960ba4ffb330bb26feade3a3ff0a2cafd97b1717ad8de89ac8a00860c8360eb33508638
|
7
|
+
data.tar.gz: 1460c3295ae6c8cb006d0a4150e15d7bf02d1eca4e7974b795a096e79ecb7b33f1f9c7f6890ed307394310c9bd5bf5acd229656dacd2132fbc567d4f0cdb4e5a
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PlanetscaleRails
|
4
|
+
module Migration
|
5
|
+
module Current
|
6
|
+
# Allows users to set the `keyspace` option in their migration file.
|
7
|
+
# If the migration is being run against PlanetScale (i.e. `ENABLE_PSDB` is set), then we prepend the keyspace to the table name.
|
8
|
+
#
|
9
|
+
# For local MySQL databases, the keyspace is ignored.
|
10
|
+
def create_table(table_name, **options)
|
11
|
+
if ENV["ENABLE_PSDB"] && options[:keyspace].present?
|
12
|
+
table_name = "#{options[:keyspace]}.#{table_name}"
|
13
|
+
super(table_name, **options.except(:keyspace))
|
14
|
+
else
|
15
|
+
super(table_name, **options)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -112,7 +112,7 @@ namespace :psdb do
|
|
112
112
|
adapter = "trilogy"
|
113
113
|
end
|
114
114
|
|
115
|
-
url = "#{adapter}://#{username}:#{password}@#{host}:3306
|
115
|
+
url = "#{adapter}://#{username}:#{password}@#{host}:3306/@primary?ssl_mode=VERIFY_IDENTITY"
|
116
116
|
|
117
117
|
# Check common CA paths for certs.
|
118
118
|
ssl_ca_path = %w[/etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt /etc/ssl/ca-bundle.pem /etc/ssl/cert.pem].find { |f| File.exist?(f) }
|
@@ -135,6 +135,7 @@ namespace :psdb do
|
|
135
135
|
task "create_creds" => %i[environment check_ci] do
|
136
136
|
ENV["PSCALE_DATABASE_URL"] = create_connection_string
|
137
137
|
ENV["DISABLE_SCHEMA_DUMP"] = "true"
|
138
|
+
ENV["ENABLE_PSDB"] = "true"
|
138
139
|
end
|
139
140
|
|
140
141
|
desc "Connects to the current PlanetScale branch and runs rails db:migrate"
|
data/lib/planetscale_rails.rb
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "active_support"
|
4
|
+
|
3
5
|
require_relative "planetscale_rails/version"
|
6
|
+
require_relative "planetscale_rails/migration"
|
4
7
|
|
5
8
|
module PlanetscaleRails
|
6
9
|
require "planetscale_rails/railtie" if defined?(Rails)
|
7
10
|
end
|
11
|
+
|
12
|
+
ActiveSupport.on_load(:active_record) do
|
13
|
+
ActiveRecord::Migration::Current.prepend(PlanetscaleRails::Migration::Current)
|
14
|
+
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.
|
4
|
+
version: 0.2.4
|
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-01
|
12
|
+
date: 2024-04-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- bin/setup
|
72
72
|
- lib/Rakefile
|
73
73
|
- lib/planetscale_rails.rb
|
74
|
+
- lib/planetscale_rails/migration.rb
|
74
75
|
- lib/planetscale_rails/railtie.rb
|
75
76
|
- lib/planetscale_rails/tasks/psdb.rake
|
76
77
|
- lib/planetscale_rails/version.rb
|