addIndex method

  1. @override
void addIndex(
  1. String name,
  2. List<String> columns,
  3. IndexType type
)

Adds a unique or a standard index of columns. Throws an UnsupportedError for a primary key, which SQLite adds to no table.

Implementation

@override
void addIndex(String name, List<String> columns, IndexType type) {
  if (type == IndexType.primaryKey) {
    throw _rebuildNeeded('add a primary key');
  }
  _statements.add(
    compileCreateIndex(
      name,
      tableName,
      columns,
      unique: type == IndexType.unique,
    ),
  );
}