Sha256: dff535464e209bd892938507bd09a1a46d2e15e435ab08af437111aa15b79be6
Contents?: true
Size: 717 Bytes
Versions: 4
Compression:
Stored size: 717 Bytes
Contents
require_relative 'base_adapter' module BulkInsert module StatementAdapters class PostgreSQLAdapter < BaseAdapter def insert_ignore_statement '' end def on_conflict_statement(columns, ignore, update_duplicates) if ignore ' ON CONFLICT DO NOTHING' elsif update_duplicates update_values = columns.map do |column| "#{column.name}=EXCLUDED.#{column.name}" end.join(', ') ' ON CONFLICT(' + update_duplicates.join(', ') + ') DO UPDATE SET ' + update_values else '' end end def primary_key_return_statement(primary_key) " RETURNING #{primary_key}" end end end end
Version data entries
4 entries across 4 versions & 2 rubygems