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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ad2818119d3d7093a3ddd37e8931c729ce600b50ed12e5cf6596f0ffa81672e
4
- data.tar.gz: bc006c7e000efa466b91e64a4aafae12eb4c9fa2094d3d476c6f2b729e0feee9
3
+ metadata.gz: 521857d7d6e64cb32e944b19916fee20987cede5125fbdee5ee186107551c538
4
+ data.tar.gz: d991051dde9b6541635ac6c9663b3086288e9acb657ffce36a567099457e6ed5
5
5
  SHA512:
6
- metadata.gz: aabca4cd463236250820fb6676c78b16aa2df30f0dd6fab4ee36bfbf003db58212ad44140177e1a7d0c3ad223a03131de94d754f559dfb6d1801a4dc1ed88d0a
7
- data.tar.gz: 7ee6a43d1f0aa09cfb84006bc10b83277f8e6f64496f9af2a546940e7db57b39b6c39862dd941b5d70b5405700f3f801194a72caef23c233d4f17a65477f3859
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 "active_record"
4
- require "active_record/connection_adapters"
3
+ require "active_support/lazy_load_hooks"
5
4
 
6
- ActiveRecord::ConnectionAdapters.register("dsql", "ActiveRecord::ConnectionAdapters::DSQLAdapter", "active_record/connection_adapters/dsql_adapter")
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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-dsql-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Cochran
metadata.gz.sig CHANGED
Binary file