code: function findConstraints (pgFkConstraints, schemaName, tableName) {
    return pgFkConstraints
      .filter(fk => fk.source_table === `${schemaName}.${tableName}`)
      .reduce((fkConstraints, constraint) => {
        const fkName = constraint.constraint_name
        if (!fkConstraints.hasOwnProperty(fkName)) {
          fkConstraints[fkName] = {
            targetTable: constraint.target_table,
            sourceColumns: [constraint.source_column],
            targetColumns: [constraint.target_column],
            updateAction: FK_ACTION_CODES[constraint.update_action],
            deleteAction: FK_ACTION_CODES[constraint.delete_action],
            matchType: FK_MATCH_TYPES[constraint.match_type]
          }
        } else {
          fkConstraints[fkName].sourceColumns.push(constraint.source_column)
          fkConstraints[fkName].targetColumns.push(constraint.target_column)
        }
        return fkConstraints
      },
      {}
      )
  }
docs: findFunctions