Sha256: 7d31e87949290049a4ba4015e06b387d5dce719998eb07a696754035d563614b

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require "active_record"
require "active_record/connection_adapters/postgresql/schema_dumper"
require "active_record/connection_adapters/postgresql/schema_statements"
require "active_record/connection_adapters/postgresql_adapter"
require "active_support/lazy_load_hooks"

ActiveSupport.on_load(:active_record) do
  require "active_record/pg_enum/command_recorder"
  require "active_record/pg_enum/postgresql_adapter"
  require "active_record/pg_enum/schema_dumper"
  require "active_record/pg_enum/schema_statements"
  require "active_record/pg_enum/helper"

  ar_version = Gem.loaded_specs["activerecord"].version

  ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES.merge!(enum: { name: "enum" })

  if ar_version >= Gem::Version.new("5.2.0")
    ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaDumper.prepend ActiveRecord::PGEnum::SchemaDumper
  end

  ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include ActiveRecord::PGEnum::PostgreSQLAdapter
  ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include ActiveRecord::PGEnum::SchemaStatements
  ActiveRecord::Migration::CommandRecorder.include ActiveRecord::PGEnum::CommandRecorder
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-pg_enum-0.2.1 lib/active_record/pg_enum.rb