onDeleteToString function

String onDeleteToString(
  1. OnDelete onDelete
)

Convert an on delete constraint to a string

Implementation

String onDeleteToString(OnDelete onDelete) {
  String res;
  switch (onDelete) {
    case OnDelete.cascade:
      res = "cascade";
      break;
    case OnDelete.restrict:
      res = "restrict";
      break;
    case OnDelete.setDefault:
      res = "set_default";
      break;
    case OnDelete.setNull:
      res = "set_null";
      break;
  }
  return res;
}