renderAddIndex method

  1. @override
List<String> renderAddIndex(
  1. String tableName,
  2. IndexBlueprint index
)
override

Implementation

@override
List<String> renderAddIndex(String tableName, IndexBlueprint index) {
  return [
    jsonEncode({
      '_vania_migration': 'createIndex',
      'collection': tableName,
      'keys': {for (final c in index.columns) c: 1},
      'options': {
        'name': index.name,
        if (index.type == ColumnIndex.unique) 'unique': true,
      },
    }),
  ];
}