addIndex method
Implementation
@override
void addIndex(String name, List<String> columns, IndexType type) {
// mask the column names, is more safety
columns = columns.map((column) => '`$column`').toList();
switch (type) {
case IndexType.primaryKey:
_stack.add(
'ALTER TABLE `$tableName` ADD PRIMARY KEY (${columns.join(',')});',
);
break;
case IndexType.unique:
_stack.add(
'CREATE UNIQUE INDEX IF NOT EXISTS `$name` '
'ON `$tableName` (${columns.join(',')});',
);
break;
case IndexType.standardIndex:
case IndexType.none:
_stack.add(
'CREATE INDEX `$name` ON `$tableName` (${columns.join(',')});',
);
break;
}
}