@microtica/database
Version:
Database tools
35 lines (34 loc) • 1.3 kB
TypeScript
import { Column } from "anydb-sql";
import { TransactionLike } from ".";
/**
*
*
* @export
* @class DBSchema
*/
export declare class DBSchema {
private readonly databaseURL;
constructor(databaseURL: string);
/**
* Gets the name of the database for the current configuration.
* @return {String} the name of the database for the current configuration.
*/
getDatabaseName(): string;
/** Gets the database dialect. */
extractDialect(): string;
/**
* Checks if a column exists in a table in the current database.
* @param tx the transaction to use to make the check query.
* @param tableName the name of the table.
* @param columnName the name of the column.
* @return {Promise<boolean>} resolves to a value indicating whether the specified column exists.
*/
columnExistsByName(tx: TransactionLike, tableName: string, columnName: string): Promise<boolean>;
/**
* Checks if a column exists in the current database.
* @param tx the transaction to use to make the check query.
* @param column the column to check.
* @return {Promise<boolean>} resolves to a value indicating whether the specified column exists.
*/
columnExists(tx: TransactionLike, column: Column<any>): Promise<boolean>;
}