Sha256: 01e3c8a11688ad00ea8ce13496cca294fbfc2a8903a0793644f8e83a2e0df23f
Contents?: true
Size: 1.08 KB
Versions: 21
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true # TODO: - remove this once/if Heroku fixes this. # Refer: https://devcenter.heroku.com/changelog-items/2446 # https://stackoverflow.com/a/73273766 module NeetoCommonsBackend module Initializers module EnableExtensionHerokuMonkeypatch def self.apply_patch! if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter patched_method = ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.instance_method(:enable_extension) # Only patch this method if it's method signature matches what we're expecting ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend InstanceMethods if patched_method&.arity == 1 end end module InstanceMethods def enable_extension(name) name_override = name if schema_exists?("heroku_ext") Rails.logger.debug "enable_extension -- Adding SCHEMA heroku_ext" name_override = "#{name}\" SCHEMA heroku_ext -- Ignore trailing double quote" end super name_override end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems