lib/generators/lockbox/audits_generator.rb in lockbox-0.6.1 vs lib/generators/lockbox/audits_generator.rb in lockbox-0.6.2

- old
+ new

@@ -14,18 +14,26 @@ def migration_version "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]" end def data_type - # use connection_config instead of connection.adapter - # so database connection isn't needed - case ActiveRecord::Base.connection_config[:adapter].to_s + case adapter when /postg/i # postgres, postgis "jsonb" when /mysql/i "json" else "text" + end + end + + # use connection_config instead of connection.adapter + # so database connection isn't needed + def adapter + if ActiveRecord::VERSION::STRING.to_f >= 6.1 + ActiveRecord::Base.connection_db_config.adapter.to_s + else + ActiveRecord::Base.connection_config[:adapter].to_s end end end end end