ColumnOperation.add constructor
ColumnOperation.add(})
Adds a column named name.
The value is defaultValue, or the result of compute (which receives
the full row) when provided. Provide exactly one of the two.
If the column already exists it is left untouched unless overwrite
is true.
For SQL adapters, sqlType overrides the column type inferred from
defaultValue (e.g. 'TEXT'), and sqlExpression is the SQL
counterpart of compute used to backfill the new column
(UPDATE t SET name = sqlExpression). Both are ignored by the
map-based migration path.
Implementation
factory ColumnOperation.add(
String name, {
Object? defaultValue,
Object? Function(Map<String, dynamic> row)? compute,
bool overwrite = false,
String? sqlType,
String? sqlExpression,
}) =>
AddColumn(
name,
defaultValue: defaultValue,
compute: compute,
overwrite: overwrite,
sqlType: sqlType,
sqlExpression: sqlExpression,
);