activerecord-dsql-adapter 0.1.3 → 0.1.4
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/railtie.rb +13 -0
- data/lib/active_record/connection_adapters/dsql/schema_dumper.rb +15 -0
- data/lib/active_record/connection_adapters/dsql_adapter.rb +11 -12
- data/lib/active_record/tasks/dsql_database_tasks.rb +30 -0
- data/lib/activerecord-dsql-adapter.rb +23 -1
- data.tar.gz.sig +0 -0
- metadata +4 -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: a2a6400458dc398fea1b2033dd3fe8c8e488808c71f459dfe693cc905b8ceebc
|
4
|
+
data.tar.gz: 50eceb300ff89ca6f93aff37165794a32760a3d242f84be60779d0a8a00d3302
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abcb7ee0f219fbf922ee539b03becb54bdcdb600a0685bde8415c0886319296c90ea8c15d5ee0ccd8428f162c1d1b2bb597d42e4c1e751ab14f8bfd8e91d8987
|
7
|
+
data.tar.gz: 664df396b1edb20293c1a22bec8647a321f0f4224e8e6e352ed78b51568774fee07dcee443b48691d6ce25cf4eef6f694066792db34b8e50b0867ab9cd7c2d91
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module ConnectionAdapters
|
5
|
+
module DSQL
|
6
|
+
class Railtie < ::Rails::Railtie
|
7
|
+
rake_tasks do
|
8
|
+
ActiveRecord::Tasks::DatabaseTasks.register_task("dsql", "ActiveRecord::Tasks::DSQLDatabaseTasks")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -7,14 +7,6 @@ require "active_record/connection_adapters/postgresql_adapter"
|
|
7
7
|
|
8
8
|
module ActiveRecord
|
9
9
|
module ConnectionAdapters
|
10
|
-
module DSQL
|
11
|
-
class Railtie < ::Rails::Railtie
|
12
|
-
rake_tasks do
|
13
|
-
ActiveRecord::DatabaseTasks.register_task("dsql", "ActiveRecord::Tasks::DSQLDatabaseTasks")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
10
|
class DSQLAdapter < PostgreSQLAdapter
|
19
11
|
ADAPTER_NAME = "DSQL"
|
20
12
|
|
@@ -127,6 +119,14 @@ module ActiveRecord
|
|
127
119
|
false
|
128
120
|
end
|
129
121
|
|
122
|
+
# Ignore DSQL sys schema.
|
123
|
+
#
|
124
|
+
# https://docs.aws.amazon.com/aurora-dsql/latest/userguide/working-with-systems-tables.html
|
125
|
+
#
|
126
|
+
def schema_names
|
127
|
+
super - ["sys"]
|
128
|
+
end
|
129
|
+
|
130
130
|
# DSQL creates a primary key index which INCLUDES all columns in the
|
131
131
|
# table. We use indnkeyatts to only take notice of key (not INCLUDE-ed)
|
132
132
|
# columns for the primary key.
|
@@ -149,11 +149,10 @@ module ActiveRecord
|
|
149
149
|
ORDER BY i.idx
|
150
150
|
SQL
|
151
151
|
end
|
152
|
-
end
|
153
|
-
end
|
154
152
|
|
155
|
-
|
156
|
-
|
153
|
+
def create_schema_dumper(options) # :nodoc:
|
154
|
+
DSQL::SchemaDumper.create(self, options)
|
155
|
+
end
|
157
156
|
end
|
158
157
|
end
|
159
158
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_record"
|
4
|
+
require "active_record/tasks/postgresql_database_tasks"
|
5
|
+
|
6
|
+
module ActiveRecord
|
7
|
+
module Tasks
|
8
|
+
class DSQLDatabaseTasks < PostgreSQLDatabaseTasks
|
9
|
+
def initialize(config)
|
10
|
+
config_hash = config.configuration_hash.dup
|
11
|
+
|
12
|
+
config_hash[:sslmode] ||= "require"
|
13
|
+
config_hash[:database] ||= "postgres"
|
14
|
+
config_hash[:username] ||= "admin"
|
15
|
+
|
16
|
+
config = ActiveRecord::DatabaseConfigurations::HashConfig.new(config.env_name, config.name, config_hash)
|
17
|
+
|
18
|
+
super(config)
|
19
|
+
end
|
20
|
+
|
21
|
+
def create(...)
|
22
|
+
fail "DSQL does not support CREATE DATABASE"
|
23
|
+
end
|
24
|
+
|
25
|
+
def drop(...)
|
26
|
+
fail "DSQL does not support DROP DATABASE"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,7 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "active_record"
|
4
4
|
|
5
5
|
ActiveSupport.on_load(:active_record) do
|
6
6
|
ActiveRecord::ConnectionAdapters.register("dsql", "ActiveRecord::ConnectionAdapters::DSQLAdapter", "active_record/connection_adapters/dsql_adapter")
|
7
7
|
end
|
8
|
+
|
9
|
+
module ActiveRecord
|
10
|
+
module ConnectionAdapters
|
11
|
+
module DSQL
|
12
|
+
extend ActiveSupport::Autoload
|
13
|
+
|
14
|
+
autoload :SchemaDumper
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module ActiveRecord
|
20
|
+
module Tasks
|
21
|
+
extend ActiveSupport::Autoload
|
22
|
+
|
23
|
+
autoload :DSQLDatabaseTasks, "active_record/tasks/dsql_database_tasks"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
if defined? Rails
|
28
|
+
require "active_record/connection_adapters/dsql/railtie"
|
29
|
+
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.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Cochran
|
@@ -80,7 +80,10 @@ extensions: []
|
|
80
80
|
extra_rdoc_files: []
|
81
81
|
files:
|
82
82
|
- README.md
|
83
|
+
- lib/active_record/connection_adapters/dsql/railtie.rb
|
84
|
+
- lib/active_record/connection_adapters/dsql/schema_dumper.rb
|
83
85
|
- lib/active_record/connection_adapters/dsql_adapter.rb
|
86
|
+
- lib/active_record/tasks/dsql_database_tasks.rb
|
84
87
|
- lib/activerecord-dsql-adapter.rb
|
85
88
|
homepage: https://github.com/sj26/activerecord-dsql-adapter
|
86
89
|
licenses: []
|
metadata.gz.sig
CHANGED
Binary file
|