Sha256: 8a66c49cc1e7f5a1c38b0d798a2fc92b00b30d2c2a983003a055e162907e12c5

Contents?: true

Size: 1.61 KB

Versions: 22

Compression:

Stored size: 1.61 KB

Contents

# frozen_string_literal: true
#
# Why the funky filename
# (lib/active_record/connection_adapters/postgres_cipherstash_adapter.rb)
# that doesn't match the gem structure? It's to hook into Rails.
#
# See this chunk from:
# https://github.com/rails/rails/blob/d7d93faacfe0ca3297a47f676772828d7210b9bc/activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb#L325-L330
#
#   # Require the adapter itself and give useful feedback about
#   #   1. Missing adapter gems and
#   #   2. Adapter gems' missing dependencies.
#   path_to_adapter = "active_record/connection_adapters/#{db_config.adapter}_adapter"
#   begin
#     require path_to_adapter
#   ...
# This is the entrypoint that is called when Rails looks for the adapter,
# when you have this in your database.yml config:
#
#   adapter: postgres_cipherstash
#
# See: https://github.com/rails/rails/blob/d7d93faacfe0ca3297a47f676772828d7210b9bc/activerecord/lib/active_record/database_configurations/database_config.rb#L16-L18
#
#
# ... to match the implicit AR naming scheme enforced by "rails dbconsole", eg.
# https://github.com/rails/rails/blob/7-0-stable/railties/lib/rails/commands/dbconsole/dbconsole_command.rb#L46
#
#
# Depending on the version of Rails being used, the relevant child postgres_cipherstash_adapter module is required.


require "cipherstash-pg"

case ActiveRecord::VERSION::MAJOR
when 7
  require "active_record/connection_adapters/7.0/postgres_cipherstash_adapter"
when 6
  require "active_record/connection_adapters/6.1/postgres_cipherstash_adapter"
else
  STDERR.puts "CipherStash only supports ActiveRecord versions 6.x and 7.x"
  exit 1
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
activerecord-cipherstash-pg-adapter-0.7.0 lib/active_record/connection_adapters/postgres_cipherstash_adapter.rb
activerecord-cipherstash-pg-adapter-0.6.1 lib/active_record/connection_adapters/postgres_cipherstash_adapter.rb