import { DataSource } from '../DataSource'; import { Blueprint } from './Blueprint'; /** * Runs schema operations against a specific DataSource. It builds a Blueprint, * lets the caller describe the table through the closure, asks the source's * SchemaGrammar to compile it to engine-specific DDL, and executes the * resulting statements (honouring any in-progress transaction on the source). * * Usually reached through the static `Schema` facade rather than instantiated * directly. */ export declare class SchemaBuilder { private readonly source; constructor(source: DataSource); private get grammar(); /** CREATE TABLE. */ create(table: string, callback: (table: Blueprint) => void): Promise; /** CREATE TABLE IF NOT EXISTS. */ createIfNotExists(table: string, callback: (table: Blueprint) => void): Promise; /** ALTER TABLE — add/drop/modify columns, indexes and foreign keys. */ table(table: string, callback: (table: Blueprint) => void): Promise; /** DROP TABLE. */ drop(table: string): Promise; /** DROP TABLE IF EXISTS. */ dropIfExists(table: string): Promise; /** RENAME TABLE. */ rename(from: string, to: string): Promise; /** Whether the given table exists. */ hasTable(table: string): Promise; /** Whether the given column exists on the given table. */ hasColumn(table: string, column: string): Promise; private build; /** * Rebuilds `table` without `dropColumns`, the way SQLite requires when a column * cannot be removed with `ALTER TABLE ... DROP COLUMN` (indexed / foreign-key * columns). It introspects the live schema via PRAGMA, recreates the table with * the surviving columns, foreign keys and single/compound primary key, copies * the data over, swaps the tables and recreates the explicit indexes whose * columns all survived. Foreign keys pointing at a dropped column are dropped * with it. */ private rebuildDroppingColumns; }