defineField method

String defineField(
  1. TableColumn col
)

Implementation

String defineField(TableColumn col) {
  ColumnProto proto = col.proto;
  SpaceBuffer buf = SpaceBuffer(col.nameSQL);

  if (proto.autoInc > 0) {
    buf << autoIncDefine(proto.type);
  } else {
    buf << proto.type;
  }
  if (proto.notNull) {
    buf << "NOT NULL";
  }
  if (proto.defaultValue.notEmpty) {
    buf << "DEFAULT" << proto.defaultValue!;
  }
  if (proto.check.notEmpty) {
    buf << "CHECK (" << proto.check! << ")";
  }
  if (proto.extras.notBlank) {
    buf << proto.extras!;
  }
  return buf.toString();
}