planetscale_rails 0.2.3 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f6d7a222eeb8aad5e6b25c09db2b51e1c9897c8233a8fb7a63e51fcceb59ca1
|
4
|
+
data.tar.gz: 991216a366f7fc53a29086b4706bc5f531e2253c4932bb14462c80b446c9e274
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16a273f6d0473dd0e447259d7065a3d385c5e2755fe3ef474ca24d34d99a7a54902538f2c2694445b8a451ab818eb7a62d01fc77da83c1a0f7a9504ef812d6fe
|
7
|
+
data.tar.gz: befc832fd4d59199510792f9a60ff893550758c7a0fbef22d253f0d209af08eb9db5dca47a2da6d68d3f49eba289318eb2b9d9a8c3a5ebaeea7d9b8fc13a2539
|
@@ -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.except(:keyspace))
|
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.5
|
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
|