activerecord-dsql-adapter 0.1.0 → 0.1.2
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/active_record/connection_adapters/dsql_adapter.rb +76 -4
- 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)
|
@@ -35,12 +47,37 @@ module ActiveRecord
|
|
35
47
|
end
|
36
48
|
end
|
37
49
|
|
38
|
-
|
39
|
-
|
50
|
+
# DSQL doesn't support serial or bigserial
|
51
|
+
|
52
|
+
def self.native_database_types # :nodoc:
|
53
|
+
@native_database_types ||= begin
|
54
|
+
types = NATIVE_DATABASE_TYPES.dup
|
55
|
+
types[:primary_key] = "bigint primary key"
|
56
|
+
types[:datetime] = types[datetime_type]
|
57
|
+
types
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# DSQL doesn't support these parameters, but PostgreSQLAdapter always sets them in #configure_connection
|
62
|
+
|
63
|
+
def client_min_messages
|
64
|
+
nil
|
65
|
+
end
|
66
|
+
|
67
|
+
def client_min_messages=(value)
|
68
|
+
nil
|
69
|
+
end
|
70
|
+
|
71
|
+
def set_standard_conforming_strings
|
72
|
+
nil
|
40
73
|
end
|
41
74
|
|
42
75
|
# https://docs.aws.amazon.com/aurora-dsql/latest/userguide/working-with-postgresql-compatibility-unsupported-features.html
|
43
76
|
|
77
|
+
def supports_advisory_locks?
|
78
|
+
false
|
79
|
+
end
|
80
|
+
|
44
81
|
def supports_views?
|
45
82
|
false
|
46
83
|
end
|
@@ -49,6 +86,14 @@ module ActiveRecord
|
|
49
86
|
false
|
50
87
|
end
|
51
88
|
|
89
|
+
def supports_foreign_keys?
|
90
|
+
false
|
91
|
+
end
|
92
|
+
|
93
|
+
def supports_exclusion_constraints?
|
94
|
+
false
|
95
|
+
end
|
96
|
+
|
52
97
|
def supports_extensions?
|
53
98
|
false
|
54
99
|
end
|
@@ -56,6 +101,33 @@ module ActiveRecord
|
|
56
101
|
def supports_index_sort_order?
|
57
102
|
false
|
58
103
|
end
|
104
|
+
|
105
|
+
def supports_json?
|
106
|
+
false
|
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
|
59
129
|
end
|
60
130
|
end
|
61
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
|