toMap method

  1. @override
Map<String, dynamic> toMap()
override

Converts this operation to a map representation for serialization.

Implementation

@override
Map<String, dynamic> toMap() {
  return {
    'type': 'alterTable',
    'oldTable': oldTable.toMap(),
    'newTable': newTable.toMap(),
    if (renamedColumns.isNotEmpty) 'renamedColumns': renamedColumns,
    if (oldIndexes.isNotEmpty)
      'oldIndexes': oldIndexes.map((i) => i.toMap()).toList(),
    if (newIndexes.isNotEmpty)
      'newIndexes': newIndexes.map((i) => i.toMap()).toList(),
    if (referencedBy.isNotEmpty)
      'referencedBy': referencedBy.map((r) => r.toMap()).toList(),
  };
}