foreignUuid method

ColumnBuilder foreignUuid(
  1. String name, {
  2. ColumnMutation mutation = ColumnMutation.add,
  3. bool nullable = false,
  4. String? constrainedTable,
  5. String referencedColumn = 'id',
  6. ReferenceAction onDelete = ReferenceAction.noAction,
  7. ReferenceAction onUpdate = ReferenceAction.noAction,
})

Implementation

ColumnBuilder foreignUuid(
  String name, {
  ColumnMutation mutation = ColumnMutation.add,
  bool nullable = false,
  String? constrainedTable,
  String referencedColumn = 'id',
  ReferenceAction onDelete = ReferenceAction.noAction,
  ReferenceAction onUpdate = ReferenceAction.noAction,
}) {
  final builder = uuid(name, mutation: mutation);
  if (nullable) {
    builder.nullable();
  }
  if (constrainedTable != null) {
    foreign(
      [name],
      references: constrainedTable,
      referencedColumns: [referencedColumn],
      onDelete: onDelete,
      onUpdate: onUpdate,
    );
  }
  return builder;
}