UNPKG

@microtica/database

Version:

Database tools

38 lines (37 loc) 1.35 kB
import * as Bluebird from "bluebird"; import { Column } from "anydb-sql"; import { Transaction } from "./transaction-like"; /** * Generates or drops database indexes. */ declare class DatabaseIndexGenerator { private readonly tx; /** * Creates an instance of DatabaseIndexGenerator. * @param {Transaction} tx the database transaction to use to generate the indexes. * @memberof DatabaseIndexGenerator */ constructor(tx: Transaction); private getIndexesFromSet; private executeQueries; /** * Creates a set of indexes. * @param columnSets a list of indexes to create, * each defined by a list of columns to create them on. The columns must all belong to the same table. * @returns * @memberof DatabaseIndexGenerator */ createIndexSets(columnSets: DatabaseIndexGenerator.ColumnSet[]): Bluebird<void[]>; /** * Drops a set of indexes. * @param columnSets a list of indexes to drop * each defined by a list of columns that they were created on. The columns must all belong to the same table. * @returns * @memberof DatabaseIndexGenerator */ dropIndexSets(columnSets: DatabaseIndexGenerator.ColumnSet[]): Bluebird<void[]>; } declare namespace DatabaseIndexGenerator { type ColumnSet = Column<any>[]; } export = DatabaseIndexGenerator;