Sha256: 295a34fa1ac455c6444265ea7eef40af206ae078b22b7b6bb5760dfcdce17a7c
Contents?: true
Size: 1.74 KB
Versions: 4
Compression:
Stored size: 1.74 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 if ActiveRecord::VERSION::MINOR == 0 require "active_record/connection_adapters/7.0/postgres_cipherstash_adapter" else require "active_record/connection_adapters/7.1/postgres_cipherstash_adapter" end 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
4 entries across 4 versions & 1 rubygems