createOrReplaceNoFkUpdateTrigger method

List<String> createOrReplaceNoFkUpdateTrigger(
  1. QualifiedTablename table,
  2. List<String> pk
)

Creates or replaces a trigger that prevents updates to the primary key.

Implementation

List<String> createOrReplaceNoFkUpdateTrigger(
  QualifiedTablename table,
  List<String> pk,
) {
  return [
    dropTriggerIfExists(
      'update_ensure_${table.namespace}_${table.tablename}_primarykey',
      table,
    ),
    ...createNoFkUpdateTrigger(table, pk),
  ];
}