build method

dynamic build ()

Implementation

build() {
  List<String> column = [];

  column.add(name);

  column.add(types[type.index]);

  if (isPrimaryKey) {
    column.add('PRIMARY KEY');
  } else {
    column.add(isNotNull ? 'NOT NULL' : 'NULL');
  }

  if (isUnique) {
    column.add('UNIQUE');
  }

  if (isAutoIncrement) {
    column.add('AUTOINCREMENT');
  }

  if (defaultValue != null) {
    column.add('DEFAULT $defaultValue');
  }

  if (foreignKey != null) {
    column.add("REFERENCES " + foreignKey[0] + '(' + foreignKey[1] + ')');
  }

  return column.join(' ');
}