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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b576c75df39b5f6614a13458d0470b4381e4addec43940b53ae76666175c0ce
4
- data.tar.gz: 3df4dc2c5b42817bc69fa7c0b2c1cc19dd0c9e063dbff9d88888472e6a759890
3
+ metadata.gz: a2a6400458dc398fea1b2033dd3fe8c8e488808c71f459dfe693cc905b8ceebc
4
+ data.tar.gz: 50eceb300ff89ca6f93aff37165794a32760a3d242f84be60779d0a8a00d3302
5
5
  SHA512:
6
- metadata.gz: 275a8d7abcbc96fee0c9cba68b34e258b0c804cb5794dc52c339d15ed7357059984730228aa9c547202c7a7f9cb7feb5b6c838a3976fac242e25a71dbae453f5
7
- data.tar.gz: 92f3755515e1aa655f043cc76560ae4d82e85f71bd88a772fc79cec1ca5de1e9a7d6aca911a2f380b7972c1254fd541a24ef138184dbd54403a130b889dfc996
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
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveRecord
4
+ module ConnectionAdapters
5
+ module DSQL
6
+ class SchemaDumper < PostgreSQL::SchemaDumper # :nodoc:
7
+ private
8
+
9
+ def extensions(stream)
10
+ # Ignore extensions
11
+ end
12
+ end
13
+ end
14
+ end
15
+ 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
- module Tasks
156
- class DSQLDatabaseTasks < PostgreSQLDatabaseTasks
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 "active_support/lazy_load_hooks"
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.3
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