activerecord-dsql-adapter 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/active_record/connection_adapters/dsql_adapter.rb +37 -2
- data/lib/activerecord-dsql-adapter.rb +4 -3
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 521857d7d6e64cb32e944b19916fee20987cede5125fbdee5ee186107551c538
|
4
|
+
data.tar.gz: d991051dde9b6541635ac6c9663b3086288e9acb657ffce36a567099457e6ed5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f9b349d16a2a860e46e89932fd5bef016b78135542addd07395cc08ddbacb209ac98b0eff862289a42f122968b01d2a2a89b5483241fc8384a93d55fd4f569b
|
7
|
+
data.tar.gz: '089e5e042d90cc75c8298e7a34f89db2c795e3e63d29c606532883268ffef2c61a69e9dd2802f18fcd7c5d2ded73d2c69c3c401163df5eb50f589116020f35a2'
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -13,14 +13,26 @@ module ActiveRecord
|
|
13
13
|
class << self
|
14
14
|
def new_client(conn_params)
|
15
15
|
conn_params[:sslmode] ||= "require"
|
16
|
-
conn_params[:user] ||= "admin"
|
17
16
|
conn_params[:dbname] ||= "postgres"
|
18
|
-
|
17
|
+
conn_params[:user] ||= "admin"
|
19
18
|
conn_params[:password] ||= generate_password(conn_params)
|
20
19
|
|
21
20
|
super(conn_params)
|
22
21
|
end
|
23
22
|
|
23
|
+
def dbconsole(config, options = {})
|
24
|
+
config_hash = config.configuration_hash.dup
|
25
|
+
|
26
|
+
config_hash[:sslmode] ||= "require"
|
27
|
+
config_hash[:database] ||= "postgres"
|
28
|
+
config_hash[:username] ||= "admin"
|
29
|
+
config_hash[:password] ||= generate_password(config_hash)
|
30
|
+
|
31
|
+
config = ActiveRecord::DatabaseConfigurations::HashConfig.new(config.env_name, config.name, config_hash)
|
32
|
+
|
33
|
+
super(config, options)
|
34
|
+
end
|
35
|
+
|
24
36
|
private
|
25
37
|
|
26
38
|
def generate_password(conn_params)
|
@@ -93,6 +105,29 @@ module ActiveRecord
|
|
93
105
|
def supports_json?
|
94
106
|
false
|
95
107
|
end
|
108
|
+
|
109
|
+
# DSQL *does* support DDL transactions, but does not support mixing DDL and
|
110
|
+
# DML, so inserting the migration version into the schema_migrations
|
111
|
+
# table fails unless we turn off the DDL transaction.
|
112
|
+
#
|
113
|
+
# PG::FeatureNotSupported: ERROR: ddl and dml are not supported in the same transaction
|
114
|
+
#
|
115
|
+
def supports_ddl_transactions?
|
116
|
+
false
|
117
|
+
end
|
118
|
+
|
119
|
+
class Railtie < ::Rails::Railtie
|
120
|
+
rake_tasks do
|
121
|
+
ActiveRecord::DatabaseTasks.register_task("dsql", "ActiveRecord::Tasks::DSQLDatabaseTasks")
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
module Tasks
|
128
|
+
class DSQLDatabaseTasks < PostgreSQLDatabaseTasks
|
96
129
|
end
|
97
130
|
end
|
98
131
|
end
|
132
|
+
|
133
|
+
ActiveSupport.run_load_hooks(:active_record_dsql_adapter, ActiveRecord::ConnectionAdapters::DSQLAdapter)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
4
|
-
require "active_record/connection_adapters"
|
3
|
+
require "active_support/lazy_load_hooks"
|
5
4
|
|
6
|
-
|
5
|
+
ActiveSupport.on_load(:active_record) do
|
6
|
+
ActiveRecord::ConnectionAdapters.register("dsql", "ActiveRecord::ConnectionAdapters::DSQLAdapter", "active_record/connection_adapters/dsql_adapter")
|
7
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|