module ActiveRecord::Import::PostgreSQLAdapter

Constants

MIN_VERSION_FOR_UPSERT

Public Instance Methods

next_value_for_sequence(sequence_name) click to toggle source
# File lib/activerecord-import/adapters/postgresql_adapter.rb, line 29
def next_value_for_sequence(sequence_name)
  %{nextval('#{sequence_name}')}
end
sql_for_conflict_target( args = {} ) click to toggle source
# File lib/activerecord-import/adapters/postgresql_adapter.rb, line 113
def sql_for_conflict_target( args = {} )
  constraint_name = args[:constraint_name]
  conflict_target = args[:conflict_target]
  if constraint_name.present?
    "ON CONSTRAINT #{constraint_name} "
  elsif conflict_target.present?
    '(' << Array( conflict_target ).reject( &:empty? ).join( ', ' ) << ') '
  end
end
sql_for_default_conflict_target( table_name ) click to toggle source
# File lib/activerecord-import/adapters/postgresql_adapter.rb, line 123
def sql_for_default_conflict_target( table_name )
  conflict_target = primary_key( table_name )
  "(#{conflict_target}) " if conflict_target
end
support_setting_primary_key_of_imported_objects?() click to toggle source
# File lib/activerecord-import/adapters/postgresql_adapter.rb, line 141
def support_setting_primary_key_of_imported_objects?
  true
end
supports_on_duplicate_key_ignore?(current_version = postgresql_version) click to toggle source
# File lib/activerecord-import/adapters/postgresql_adapter.rb, line 137
def supports_on_duplicate_key_ignore?(current_version = postgresql_version)
  supports_on_duplicate_key_update?(current_version)
end
supports_on_duplicate_key_update?(current_version = postgresql_version) click to toggle source
# File lib/activerecord-import/adapters/postgresql_adapter.rb, line 133
def supports_on_duplicate_key_update?(current_version = postgresql_version)
  current_version >= MIN_VERSION_FOR_UPSERT
end