import { Blueprint } from '../Blueprint'; import { ColumnDefinition } from '../ColumnDefinition'; import { ForeignCommand, SchemaCommand } from '../Command'; import { SchemaGrammar } from './SchemaGrammar'; /** * Standard-SQL schema grammar. Its output targets PostgreSQL (the most * ANSI-faithful of the supported engines), so PostgresSchemaGrammar barely has * to override anything, while the MySQL and SQLite grammars adjust the pieces * that differ (identifier quoting, auto-increment syntax, boolean/array types). */ export declare class DefaultSchemaGrammar extends SchemaGrammar { compileCreate(blueprint: Blueprint): string[]; compileAlter(blueprint: Blueprint): string[]; compileDrop(table: string): string; compileDropIfExists(table: string): string; compileRename(from: string, to: string): string; compileTableExists(table: string): { sql: string; bindings: any[]; }; compileColumnExists(table: string, column: string): { sql: string; bindings: any[]; }; protected compileCommand(table: string, command: SchemaCommand): string[]; protected compileDropIndex(_table: string, index: string): string; /** * PostgreSQL changes a column with a sequence of ALTER COLUMN statements. * Engines with a single MODIFY/CHANGE statement (MySQL) override this. */ protected compileChangeColumn(table: string, column: ColumnDefinition): string[]; protected getColumnSql(column: ColumnDefinition): string; protected getAutoIncrementType(column: ColumnDefinition): string; protected modifyNullable(column: ColumnDefinition): string; protected modifyUnsigned(_column: ColumnDefinition): string; protected modifyDefault(column: ColumnDefinition): string; protected getDefaultLiteral(column: ColumnDefinition): string; protected formatDefaultValue(value: any): string; protected booleanLiteral(value: boolean): string; protected arrayLiteral(value: any[]): string; protected getType(column: ColumnDefinition): string; protected getTableConstraints(blueprint: Blueprint): string[]; /** Primary-key columns, excluding auto-increment columns (their PK is inline). */ protected collectPrimaryColumns(blueprint: Blueprint): string[]; protected collectUniqueGroups(blueprint: Blueprint): Array<{ columns: string[]; name?: string; }>; protected collectIndexes(blueprint: Blueprint): Array<{ columns: string[]; name?: string; using?: string; }>; /** * `ifNotExists` guards against re-running a migration that already created * this index (e.g. a `Schema.createIfNotExists` table whose CREATE TABLE was * a no-op because the table already existed). PostgreSQL and SQLite both * support `IF NOT EXISTS` on `CREATE INDEX`; MySqlSchemaGrammar overrides * this method because MySQL has no equivalent syntax. */ protected createIndexSql(table: string, columns: string[], name?: string, unique?: boolean, ifNotExists?: boolean, _using?: string): string; protected foreignClause(table: string, command: ForeignCommand, forceName?: boolean): string; protected generateIndexName(table: string, columns: string[], type: string): string; protected columnize(columns: string[]): string; /** * Emits an identifier unquoted, matching the query builder convention used * across neorm (DefaultQueryBuilder / PostgresQueryBuilder do not quote * identifiers). This keeps DDL and DML in agreement: on PostgreSQL an * unquoted mixed-case identifier folds to lower case, so a column created * here is found by the (also unquoted) INSERT/SELECT statements. MySQL * overrides this to use backticks. */ protected wrap(name: string): string; protected wrapTable(table: string): string; }