activerecord-cipherstash-pg-adapter 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +11 -1
- data/activerecord-cipherstash-pg-adapter.gemspec +1 -1
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/column.rb +55 -0
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/database_statements.rb +149 -0
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/array.rb +91 -0
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date.rb +23 -0
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date_time.rb +31 -0
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/hstore.rb +72 -0
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/type_map_initializer.rb +113 -0
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/oid.rb +36 -0
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/quoting.rb +205 -0
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/referential_integrity.rb +43 -0
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_creation.rb +80 -0
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_definitions.rb +222 -0
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb +49 -0
- data/lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_statements.rb +794 -0
- data/lib/active_record/connection_adapters/6.1/postgres_cipherstash_adapter.rb +958 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/explain_pretty_printer.rb +44 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/bit.rb +53 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/bit_varying.rb +15 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/bytea.rb +17 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/cidr.rb +48 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/decimal.rb +15 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/enum.rb +20 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/inet.rb +15 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/interval.rb +49 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/jsonb.rb +15 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/legacy_point.rb +44 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/macaddr.rb +25 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/money.rb +41 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/oid.rb +15 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/point.rb +64 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/range.rb +115 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/specialized_string.rb +18 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/uuid.rb +35 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/vector.rb +28 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/xml.rb +30 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/oid.rb +38 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/type_metadata.rb +44 -0
- data/lib/active_record/connection_adapters/7.0/cipherstash_pg/utils.rb +80 -0
- data/lib/active_record/connection_adapters/{cipherstash_pg_adapter.rb → 7.0/postgres_cipherstash_adapter.rb} +16 -48
- data/lib/active_record/connection_adapters/postgres_cipherstash_adapter.rb +42 -12
- data/lib/activerecord-cipherstash-pg-adapter.rb +1 -1
- data/lib/version.rb +1 -1
- metadata +89 -46
- data/lib/active_record/connection_adapters/cipherstash_pg/oid.rb +0 -38
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/explain_pretty_printer.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/bit.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/bit_varying.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/bytea.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/cidr.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/decimal.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/enum.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/inet.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/interval.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/jsonb.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/legacy_point.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/macaddr.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/money.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/oid.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/point.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/range.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/specialized_string.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/uuid.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/vector.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/xml.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/type_metadata.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/utils.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/column.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/database_statements.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/oid/array.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/oid/date.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/oid/date_time.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/oid/hstore.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/oid/timestamp.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/oid/timestamp_with_time_zone.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/oid/type_map_initializer.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/quoting.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/referential_integrity.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/schema_creation.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/schema_definitions.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/schema_dumper.rb +0 -0
- /data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/schema_statements.rb +0 -0
- /data/lib/{active_record/connection_adapters/cipherstash_pg/cipherstash_tasks.rake → cipherstash_tasks.rake} +0 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module ConnectionAdapters
|
5
|
+
module CipherStashPG
|
6
|
+
module OID # :nodoc:
|
7
|
+
class Xml < Type::String # :nodoc:
|
8
|
+
def type
|
9
|
+
:xml
|
10
|
+
end
|
11
|
+
|
12
|
+
def serialize(value)
|
13
|
+
return unless value
|
14
|
+
Data.new(super)
|
15
|
+
end
|
16
|
+
|
17
|
+
class Data # :nodoc:
|
18
|
+
def initialize(value)
|
19
|
+
@value = value
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
@value
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "./oid/array"
|
4
|
+
require_relative "./oid/bit"
|
5
|
+
require_relative "./oid/bit_varying"
|
6
|
+
require_relative "./oid/bytea"
|
7
|
+
require_relative "./oid/cidr"
|
8
|
+
require_relative "./oid/date"
|
9
|
+
require_relative "./oid/date_time"
|
10
|
+
require_relative "./oid/decimal"
|
11
|
+
require_relative "./oid/enum"
|
12
|
+
require_relative "./oid/hstore"
|
13
|
+
require_relative "./oid/inet"
|
14
|
+
require_relative "./oid/interval"
|
15
|
+
require_relative "./oid/jsonb"
|
16
|
+
require_relative "./oid/macaddr"
|
17
|
+
require_relative "./oid/money"
|
18
|
+
require_relative "./oid/oid"
|
19
|
+
require_relative "./oid/point"
|
20
|
+
require_relative "./oid/legacy_point"
|
21
|
+
require_relative "./oid/range"
|
22
|
+
require_relative "./oid/specialized_string"
|
23
|
+
require_relative "./oid/timestamp"
|
24
|
+
require_relative "./oid/timestamp_with_time_zone"
|
25
|
+
require_relative "./oid/uuid"
|
26
|
+
require_relative "./oid/vector"
|
27
|
+
require_relative "./oid/xml"
|
28
|
+
|
29
|
+
require_relative "./oid/type_map_initializer"
|
30
|
+
|
31
|
+
module ActiveRecord
|
32
|
+
module ConnectionAdapters
|
33
|
+
module CipherStashPG
|
34
|
+
module OID # :nodoc:
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
# :stopdoc:
|
5
|
+
module ConnectionAdapters
|
6
|
+
module CipherStashPG
|
7
|
+
class TypeMetadata < DelegateClass(SqlTypeMetadata)
|
8
|
+
undef to_yaml if method_defined?(:to_yaml)
|
9
|
+
|
10
|
+
include Deduplicable
|
11
|
+
|
12
|
+
attr_reader :oid, :fmod
|
13
|
+
|
14
|
+
def initialize(type_metadata, oid: nil, fmod: nil)
|
15
|
+
super(type_metadata)
|
16
|
+
@oid = oid
|
17
|
+
@fmod = fmod
|
18
|
+
end
|
19
|
+
|
20
|
+
def ==(other)
|
21
|
+
other.is_a?(TypeMetadata) &&
|
22
|
+
__getobj__ == other.__getobj__ &&
|
23
|
+
oid == other.oid &&
|
24
|
+
fmod == other.fmod
|
25
|
+
end
|
26
|
+
alias eql? ==
|
27
|
+
|
28
|
+
def hash
|
29
|
+
TypeMetadata.hash ^
|
30
|
+
__getobj__.hash ^
|
31
|
+
oid.hash ^
|
32
|
+
fmod.hash
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
def deduplicated
|
37
|
+
__setobj__(__getobj__.deduplicate)
|
38
|
+
super
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
CipherStashPGTypeMetadata = CipherStashPG::TypeMetadata
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module ConnectionAdapters
|
5
|
+
module CipherStashPG
|
6
|
+
# Value Object to hold a schema qualified name.
|
7
|
+
# This is usually the name of a PostgreSQL relation but it can also represent
|
8
|
+
# schema qualified type names. +schema+ and +identifier+ are unquoted to prevent
|
9
|
+
# double quoting.
|
10
|
+
class Name # :nodoc:
|
11
|
+
SEPARATOR = "."
|
12
|
+
attr_reader :schema, :identifier
|
13
|
+
|
14
|
+
def initialize(schema, identifier)
|
15
|
+
@schema, @identifier = unquote(schema), unquote(identifier)
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
parts.join SEPARATOR
|
20
|
+
end
|
21
|
+
|
22
|
+
def quoted
|
23
|
+
if schema
|
24
|
+
PG::Connection.quote_ident(schema) << SEPARATOR << PG::Connection.quote_ident(identifier)
|
25
|
+
else
|
26
|
+
PG::Connection.quote_ident(identifier)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def ==(o)
|
31
|
+
o.class == self.class && o.parts == parts
|
32
|
+
end
|
33
|
+
alias_method :eql?, :==
|
34
|
+
|
35
|
+
def hash
|
36
|
+
parts.hash
|
37
|
+
end
|
38
|
+
|
39
|
+
protected
|
40
|
+
def parts
|
41
|
+
@parts ||= [@schema, @identifier].compact
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
def unquote(part)
|
46
|
+
if part && part.start_with?('"')
|
47
|
+
part[1..-2]
|
48
|
+
else
|
49
|
+
part
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
module Utils # :nodoc:
|
55
|
+
extend self
|
56
|
+
|
57
|
+
# Returns an instance of <tt>ActiveRecord::ConnectionAdapters::CipherStashPG::Name</tt>
|
58
|
+
# extracted from +string+.
|
59
|
+
# +schema+ is +nil+ if not specified in +string+.
|
60
|
+
# +schema+ and +identifier+ exclude surrounding quotes (regardless of whether provided in +string+)
|
61
|
+
# +string+ supports the range of schema/table references understood by PostgreSQL, for example:
|
62
|
+
#
|
63
|
+
# * <tt>table_name</tt>
|
64
|
+
# * <tt>"table.name"</tt>
|
65
|
+
# * <tt>schema_name.table_name</tt>
|
66
|
+
# * <tt>schema_name."table.name"</tt>
|
67
|
+
# * <tt>"schema_name".table_name</tt>
|
68
|
+
# * <tt>"schema.name"."table name"</tt>
|
69
|
+
def extract_schema_qualified_name(string)
|
70
|
+
schema, table = string.scan(/[^".]+|"[^"]*"/)
|
71
|
+
if table.nil?
|
72
|
+
table = schema
|
73
|
+
schema = nil
|
74
|
+
end
|
75
|
+
CipherStashPG::Name.new(schema, table)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -1,60 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
#
|
3
|
-
# Why the funky filename
|
4
|
-
# (lib/active_record/connection_adapters/cipherstash_pg_adapter.rb)
|
5
|
-
# that doesn't match the gem structure? It's to hook into Rails.
|
6
|
-
#
|
7
|
-
# See this chunk from:
|
8
|
-
# https://github.com/rails/rails/blob/d7d93faacfe0ca3297a47f676772828d7210b9bc/activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb#L325-L330
|
9
|
-
#
|
10
|
-
# # Require the adapter itself and give useful feedback about
|
11
|
-
# # 1. Missing adapter gems and
|
12
|
-
# # 2. Adapter gems' missing dependencies.
|
13
|
-
# path_to_adapter = "active_record/connection_adapters/#{db_config.adapter}_adapter"
|
14
|
-
# begin
|
15
|
-
# require path_to_adapter
|
16
|
-
# ...
|
17
|
-
|
18
|
-
# TODO: is this actually required?
|
19
|
-
#gem "cipherstash-pg", "~> 1.1"
|
20
|
-
|
21
|
-
require "cipherstash-pg"
|
22
2
|
|
23
3
|
require "active_support/core_ext/object/try"
|
24
4
|
require "active_record/connection_adapters/abstract_adapter"
|
25
5
|
require "active_record/connection_adapters/statement_pool"
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
6
|
+
|
7
|
+
require_relative "./cipherstash_pg/column"
|
8
|
+
require_relative "./cipherstash_pg/database_statements"
|
9
|
+
require_relative "./cipherstash_pg/explain_pretty_printer"
|
10
|
+
require_relative "./cipherstash_pg/oid"
|
11
|
+
require_relative "./cipherstash_pg/quoting"
|
12
|
+
require_relative "./cipherstash_pg/referential_integrity"
|
13
|
+
require_relative "./cipherstash_pg/schema_creation"
|
14
|
+
require_relative "./cipherstash_pg/schema_definitions"
|
15
|
+
require_relative "./cipherstash_pg/schema_dumper"
|
16
|
+
require_relative "./cipherstash_pg/schema_statements"
|
17
|
+
require_relative "./cipherstash_pg/type_metadata"
|
18
|
+
require_relative "./cipherstash_pg/utils"
|
38
19
|
|
39
20
|
module ActiveRecord
|
40
21
|
module ConnectionHandling
|
41
|
-
# This is the entrypoint that is called when Rails looks for the adapter,
|
42
|
-
# when you have this in your database.yml config:
|
43
|
-
#
|
44
|
-
# adapter: cipherstash_pg
|
45
|
-
#
|
46
|
-
# See: https://github.com/rails/rails/blob/d7d93faacfe0ca3297a47f676772828d7210b9bc/activerecord/lib/active_record/database_configurations/database_config.rb#L16-L18
|
47
|
-
#
|
48
|
-
# Please note that we now recommend instead having:
|
49
|
-
#
|
50
|
-
# adapter: postgres_cipherstash
|
51
|
-
#
|
52
|
-
# ... to match the implicit AR naming scheme enforced by "rails dbconsole", eg.
|
53
|
-
# https://github.com/rails/rails/blob/7-0-stable/railties/lib/rails/commands/dbconsole/dbconsole_command.rb#L46
|
54
|
-
|
55
22
|
###########################################################################
|
56
23
|
# Everything from this point onwards is a copy-paste or inherit from Rails'
|
57
24
|
# activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
|
25
|
+
# subtree as of f1aa436d738.
|
58
26
|
#
|
59
27
|
# ... with the exception of adding the ore_64_8_v1 type support on line 635.
|
60
28
|
#
|
@@ -63,7 +31,7 @@ module ActiveRecord
|
|
63
31
|
# now] have both 'cipherstash-pg' and 'pg' loaded at the same time.)
|
64
32
|
###########################################################################
|
65
33
|
|
66
|
-
def
|
34
|
+
def postgres_cipherstash_connection(config)
|
67
35
|
conn_params = config.symbolize_keys.compact
|
68
36
|
|
69
37
|
# Map ActiveRecords param names to PGs.
|
@@ -312,7 +280,7 @@ module ActiveRecord
|
|
312
280
|
end
|
313
281
|
|
314
282
|
def self.database_exists?(config)
|
315
|
-
!!ActiveRecord::Base.
|
283
|
+
!!ActiveRecord::Base.postgres_cipherstash_connection(config)
|
316
284
|
rescue ActiveRecord::NoDatabaseError
|
317
285
|
false
|
318
286
|
end
|
@@ -1,13 +1,43 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Why the funky filename
|
4
|
+
# (lib/active_record/connection_adapters/cipherstash_pg_adapter.rb)
|
5
|
+
# that doesn't match the gem structure? It's to hook into Rails.
|
6
|
+
#
|
7
|
+
# See this chunk from:
|
8
|
+
# https://github.com/rails/rails/blob/d7d93faacfe0ca3297a47f676772828d7210b9bc/activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb#L325-L330
|
9
|
+
#
|
10
|
+
# # Require the adapter itself and give useful feedback about
|
11
|
+
# # 1. Missing adapter gems and
|
12
|
+
# # 2. Adapter gems' missing dependencies.
|
13
|
+
# path_to_adapter = "active_record/connection_adapters/#{db_config.adapter}_adapter"
|
14
|
+
# begin
|
15
|
+
# require path_to_adapter
|
16
|
+
# ...
|
17
|
+
# This is the entrypoint that is called when Rails looks for the adapter,
|
18
|
+
# when you have this in your database.yml config:
|
19
|
+
#
|
20
|
+
# adapter: postgres_cipherstash
|
21
|
+
#
|
22
|
+
# See: https://github.com/rails/rails/blob/d7d93faacfe0ca3297a47f676772828d7210b9bc/activerecord/lib/active_record/database_configurations/database_config.rb#L16-L18
|
23
|
+
#
|
24
|
+
#
|
25
|
+
# ... to match the implicit AR naming scheme enforced by "rails dbconsole", eg.
|
26
|
+
# https://github.com/rails/rails/blob/7-0-stable/railties/lib/rails/commands/dbconsole/dbconsole_command.rb#L46
|
27
|
+
#
|
28
|
+
#
|
29
|
+
# Depending on the version of Rails being used, the relevant child postgres_cipherstash_adapter module is required.
|
30
|
+
|
31
|
+
|
32
|
+
require "cipherstash-pg"
|
33
|
+
|
34
|
+
case Rails::VERSION::MAJOR
|
35
|
+
when 7
|
36
|
+
require "active_record/connection_adapters/7.0/postgres_cipherstash_adapter"
|
37
|
+
when 6
|
38
|
+
require "active_record/connection_adapters/6.1/postgres_cipherstash_adapter"
|
39
|
+
else
|
40
|
+
STDERR.puts "CipherStash only supports Rails versions 6.x and 7.x"
|
41
|
+
exit 1
|
13
42
|
end
|
43
|
+
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-cipherstash-pg-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robin Howard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 6.0.0
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
22
|
+
version: 8.0.0
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 6.0.0
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: 8.0.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: cipherstash-pg
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,50 +59,87 @@ files:
|
|
53
59
|
- README.md
|
54
60
|
- Rakefile
|
55
61
|
- activerecord-cipherstash-pg-adapter.gemspec
|
56
|
-
- lib/active_record/connection_adapters/cipherstash_pg/
|
57
|
-
- lib/active_record/connection_adapters/cipherstash_pg/
|
62
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/column.rb
|
63
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/database_statements.rb
|
64
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/explain_pretty_printer.rb
|
65
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid.rb
|
66
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/array.rb
|
67
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/bit.rb
|
68
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/bit_varying.rb
|
69
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/bytea.rb
|
70
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/cidr.rb
|
71
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date.rb
|
72
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date_time.rb
|
73
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/decimal.rb
|
74
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/enum.rb
|
75
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/hstore.rb
|
76
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/inet.rb
|
77
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/interval.rb
|
78
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/jsonb.rb
|
79
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/legacy_point.rb
|
80
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/macaddr.rb
|
81
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/money.rb
|
82
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/oid.rb
|
83
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/point.rb
|
84
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/range.rb
|
85
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/specialized_string.rb
|
86
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/type_map_initializer.rb
|
87
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/uuid.rb
|
88
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/vector.rb
|
89
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/xml.rb
|
90
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/quoting.rb
|
91
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/referential_integrity.rb
|
92
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_creation.rb
|
93
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_definitions.rb
|
94
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
|
95
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_statements.rb
|
96
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/type_metadata.rb
|
97
|
+
- lib/active_record/connection_adapters/6.1/cipherstash_pg/utils.rb
|
98
|
+
- lib/active_record/connection_adapters/6.1/postgres_cipherstash_adapter.rb
|
99
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/column.rb
|
100
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/database_statements.rb
|
101
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/explain_pretty_printer.rb
|
102
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid.rb
|
103
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/array.rb
|
104
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/bit.rb
|
105
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/bit_varying.rb
|
106
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/bytea.rb
|
107
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/cidr.rb
|
108
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/date.rb
|
109
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/date_time.rb
|
110
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/decimal.rb
|
111
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/enum.rb
|
112
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/hstore.rb
|
113
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/inet.rb
|
114
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/interval.rb
|
115
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/jsonb.rb
|
116
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/legacy_point.rb
|
117
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/macaddr.rb
|
118
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/money.rb
|
119
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/oid.rb
|
120
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/point.rb
|
121
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/range.rb
|
122
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/specialized_string.rb
|
123
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp.rb
|
124
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/timestamp_with_time_zone.rb
|
125
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/type_map_initializer.rb
|
126
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/uuid.rb
|
127
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/vector.rb
|
128
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/xml.rb
|
129
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/quoting.rb
|
130
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/referential_integrity.rb
|
131
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/schema_creation.rb
|
132
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/schema_definitions.rb
|
133
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/schema_dumper.rb
|
134
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/schema_statements.rb
|
135
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/type_metadata.rb
|
136
|
+
- lib/active_record/connection_adapters/7.0/cipherstash_pg/utils.rb
|
137
|
+
- lib/active_record/connection_adapters/7.0/postgres_cipherstash_adapter.rb
|
58
138
|
- lib/active_record/connection_adapters/cipherstash_pg/database_extensions.rb
|
59
|
-
- lib/active_record/connection_adapters/cipherstash_pg/database_statements.rb
|
60
139
|
- lib/active_record/connection_adapters/cipherstash_pg/database_tasks.rb
|
61
|
-
- lib/active_record/connection_adapters/cipherstash_pg/explain_pretty_printer.rb
|
62
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid.rb
|
63
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/array.rb
|
64
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/bit.rb
|
65
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/bit_varying.rb
|
66
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/bytea.rb
|
67
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/cidr.rb
|
68
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/date.rb
|
69
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/date_time.rb
|
70
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/decimal.rb
|
71
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/enum.rb
|
72
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/hstore.rb
|
73
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/inet.rb
|
74
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/interval.rb
|
75
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/jsonb.rb
|
76
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/legacy_point.rb
|
77
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/macaddr.rb
|
78
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/money.rb
|
79
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/oid.rb
|
80
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/point.rb
|
81
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/range.rb
|
82
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/specialized_string.rb
|
83
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/timestamp.rb
|
84
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/timestamp_with_time_zone.rb
|
85
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/type_map_initializer.rb
|
86
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/uuid.rb
|
87
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/vector.rb
|
88
|
-
- lib/active_record/connection_adapters/cipherstash_pg/oid/xml.rb
|
89
|
-
- lib/active_record/connection_adapters/cipherstash_pg/quoting.rb
|
90
|
-
- lib/active_record/connection_adapters/cipherstash_pg/referential_integrity.rb
|
91
|
-
- lib/active_record/connection_adapters/cipherstash_pg/schema_creation.rb
|
92
|
-
- lib/active_record/connection_adapters/cipherstash_pg/schema_definitions.rb
|
93
|
-
- lib/active_record/connection_adapters/cipherstash_pg/schema_dumper.rb
|
94
|
-
- lib/active_record/connection_adapters/cipherstash_pg/schema_statements.rb
|
95
|
-
- lib/active_record/connection_adapters/cipherstash_pg/type_metadata.rb
|
96
|
-
- lib/active_record/connection_adapters/cipherstash_pg/utils.rb
|
97
|
-
- lib/active_record/connection_adapters/cipherstash_pg_adapter.rb
|
98
140
|
- lib/active_record/connection_adapters/postgres_cipherstash_adapter.rb
|
99
141
|
- lib/activerecord-cipherstash-pg-adapter.rb
|
142
|
+
- lib/cipherstash_tasks.rake
|
100
143
|
- lib/version.rb
|
101
144
|
homepage: https://github.com/cipherstash/activerecord-cipherstash-pg-adapter
|
102
145
|
licenses:
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/array"
|
4
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/bit"
|
5
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/bit_varying"
|
6
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/bytea"
|
7
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/cidr"
|
8
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/date"
|
9
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/date_time"
|
10
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/decimal"
|
11
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/enum"
|
12
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/hstore"
|
13
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/inet"
|
14
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/interval"
|
15
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/jsonb"
|
16
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/macaddr"
|
17
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/money"
|
18
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/oid"
|
19
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/point"
|
20
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/legacy_point"
|
21
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/range"
|
22
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/specialized_string"
|
23
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/timestamp"
|
24
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/timestamp_with_time_zone"
|
25
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/uuid"
|
26
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/vector"
|
27
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/xml"
|
28
|
-
|
29
|
-
require "active_record/connection_adapters/cipherstash_pg/oid/type_map_initializer"
|
30
|
-
|
31
|
-
module ActiveRecord
|
32
|
-
module ConnectionAdapters
|
33
|
-
module CipherStashPG
|
34
|
-
module OID # :nodoc:
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/bit.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/bit_varying.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/bytea.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/cidr.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/decimal.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/enum.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/inet.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/interval.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/jsonb.rb
RENAMED
File without changes
|
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/macaddr.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/money.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/oid.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/point.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/range.rb
RENAMED
File without changes
|
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/uuid.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/vector.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/oid/xml.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 6.1/cipherstash_pg}/type_metadata.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/oid/array.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/oid/date.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/oid/date_time.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/oid/hstore.rb
RENAMED
File without changes
|
/data/lib/active_record/connection_adapters/{cipherstash_pg → 7.0/cipherstash_pg}/oid/timestamp.rb
RENAMED
File without changes
|