Closed dhruvCW closed 11 months ago
@charkost would be awesome if we could release this once merged 😁 🍻
Hotpatch initializer version:
# frozen_string_literal: true
if defined?(Prosopite)
begin
Prosopite.fingerprint("select 1")
rescue LoadError
# Add support for the trilogy adapter.
Prosopite.module_exec do
class << self
def fingerprint(query)
if ActiveRecord::Base.connection.adapter_name.downcase.start_with?("mysql", "trilogy")
mysql_fingerprint(query)
else
begin
require "pg_query"
rescue LoadError => e
msg = "Could not load the 'pg_query' gem. Add `gem 'pg_query'` to your Gemfile"
raise LoadError, msg, e.backtrace
end
PgQuery.fingerprint(query)
end
end
end
end
end
end
Thanks @dhruvCW !
Check if the adapter is mysql or trilogy to decide if the fingerprinting should be mysql or postgresql.
trilogy
is a new mysql adapter for ruby.more info here https://github.com/trilogy-libraries
trilogy will also be a bundled adapter from rails 7.1