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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d5653142d403dfb1efc8e710f3f2e9cc72264bfdce1f0a21e0fb7f8d4ee316f
4
- data.tar.gz: f66eb457cedb77489ec8c761e022af67f9d68cac59cf6eb4db7c12851868592e
3
+ metadata.gz: 521857d7d6e64cb32e944b19916fee20987cede5125fbdee5ee186107551c538
4
+ data.tar.gz: d991051dde9b6541635ac6c9663b3086288e9acb657ffce36a567099457e6ed5
5
5
  SHA512:
6
- metadata.gz: 56ebe63d14994b848c165eb8a95844d51c182eca011578694a183883e36f3c6ef9ee75f5c8a982d056144baf5ab4264e016ed64d52dcee16b0654fa7022cc16e
7
- data.tar.gz: 1a81f168feff53852f0cc6c192e744f70dca091155ebdef87a92901104940d58a8568150560562998675dc745a62178d11eec513e6cb7aa48846dbbd015b935c
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
- def configure_connection
39
- # PostgreSQLAdapter sets a bunch of parameters here which DSQL doesn't support
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 "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.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Cochran
metadata.gz.sig CHANGED
Binary file