diff --git a/config/initializers/zz_patch_activerecord_type_loading.rb b/config/initializers/zz_patch_activerecord_type_loading.rb index 0f45002bb10d..2c551ec5c3bf 100644 --- a/config/initializers/zz_patch_activerecord_type_loading.rb +++ b/config/initializers/zz_patch_activerecord_type_loading.rb @@ -3,6 +3,26 @@ module ConnectionAdapters module PostgreSQL module OID # :nodoc: class TypeMapInitializer # :nodoc: + def run(records) + records.each do |row| + if @store.key? row['oid'].to_i + continue + elsif @store.key? row['typname'] + register_mapped_type(row) + elsif row['typtype'] == 'r'.freeze + register_range_type(row) + elsif row['typtype'] == 'e'.freeze + register_enum_type(row) + elsif row['typtype'] == 'd'.freeze + register_domain_type(row) + elsif row['typinput'] == 'array_in'.freeze + register_array_type(row) + elsif row['typelem'].to_i != 0 + register_composite_type(row) + end + end + end + def query_conditions_for_initial_load(type_map) known_type_names = type_map.keys.map { |n| "'#{n}'" } known_type_types = %w('r' 'e' 'd')