Method: ActiveRecord::PGExtensions::PostgreSQLAdapter#set_replica_identity

Defined in:
lib/active_record/pg_extensions/postgresql_adapter.rb

#set_replica_identity(table, identity = :default) ⇒ Object

[View source]

31
32
33
34
35
36
37
38
39
# File 'lib/active_record/pg_extensions/postgresql_adapter.rb', line 31

def set_replica_identity(table, identity = :default)
  identity_clause = case identity
                    when :default, :full, :nothing
                      identity.to_s.upcase
                    else
                      "USING INDEX #{quote_column_name(identity)}"
                    end
  execute("ALTER TABLE #{quote_table_name(table)} REPLICA IDENTITY #{identity_clause}")
end