forGenerator property

  1. @override
String get forGenerator

Generated Dart code to include in a schema.

Implementation

@override
String get forGenerator {
  final parts = ["'$name'", columnType];

  if (autoincrement != InsertColumn.defaults.autoincrement) {
    parts.add('autoincrement: $autoincrement');
  }

  if (defaultValue != null) {
    parts.add('defaultValue: $defaultValue');
  }

  if (nullable != InsertColumn.defaults.nullable) {
    parts.add('nullable: $nullable');
  }

  if (isPrimaryKey) {
    parts.add('isPrimaryKey: $isPrimaryKey');
  }

  if (isForeignKey) {
    parts.add('isForeignKey: $isForeignKey');
    parts.add("foreignTableName: '$foreignTableName'");
    parts.add('onDeleteCascade: $onDeleteCascade');
    parts.add('onDeleteSetDefault: $onDeleteSetDefault');
  }

  if (unique != InsertColumn.defaults.unique) {
    parts.add('unique: $unique');
  }

  return 'SchemaColumn(${parts.join(', ')})';
}