import type { ColumnSchema, ForeignKeySchema, IndexSchema, QuerierPool, RawRow, SchemaIntrospector, SqlQuerier, TableSchema } from '../../type/index.js'; import { BaseSqlIntrospector } from './baseSqlIntrospector.js'; /** * Referential action type for foreign key constraints. */ export type ReferentialAction = 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION'; /** * Abstract base class for SQL schema introspectors. * * Uses the template-method pattern to consolidate shared logic while allowing * dialect-specific implementations for SQL queries and type normalization. * * Subclasses must implement: * - `getTableNamesQuery()` - SQL to list all table names * - `tableExistsQuery()` - SQL to check if a table exists * - `getColumnsQuery()` - SQL to get column metadata * - `getIndexesQuery()` - SQL to get index metadata * - `getForeignKeysQuery()` - SQL to get foreign key metadata * - `getPrimaryKeyQuery()` - SQL to get primary key columns * - `mapColumnRow()` - Map a column query result row to ColumnSchema * - `mapIndexRow()` - Map an index query result row to IndexSchema * - `mapForeignKeyRow()` - Map a foreign key query result row to ForeignKeySchema * - `mapTableNameRow()` - Extract table name from a row * - `mapPrimaryKeyRow()` - Extract column name from a PK row */ export declare abstract class AbstractSqlSchemaIntrospector extends BaseSqlIntrospector implements SchemaIntrospector { protected abstract readonly pool: QuerierPool; getTableSchema(tableName: string): Promise; getTableNames(): Promise; tableExists(tableName: string): Promise; protected getQuerier(): Promise; protected tableExistsInternal(querier: SqlQuerier, tableName: string): Promise; protected getColumns(querier: SqlQuerier, tableName: string): Promise; protected getIndexes(querier: SqlQuerier, tableName: string): Promise; protected getForeignKeys(querier: SqlQuerier, tableName: string): Promise; protected getPrimaryKey(querier: SqlQuerier, tableName: string): Promise; protected tableExistsParams(tableName: string): unknown[]; protected getColumnsParams(tableName: string): unknown[]; protected getIndexesParams(tableName: string): unknown[]; protected getForeignKeysParams(tableName: string): unknown[]; protected getPrimaryKeyParams(tableName: string): unknown[]; /** * Normalize referential action string to standard type. */ protected normalizeReferentialAction(action: string): ReferentialAction | undefined; /** * Convert bigint/null values to number safely. */ protected toNumber(value: unknown): number | undefined; /** SQL query to list all table names. */ protected abstract getTableNamesQuery(): string; /** SQL query to check if a table exists. Parameter: tableName. */ protected abstract tableExistsQuery(): string; /** Parse the result of tableExistsQuery to boolean. */ protected abstract parseTableExistsResult(results: RawRow[]): boolean; /** SQL query to get column metadata. Parameter: tableName (for PRAGMA-style). */ protected abstract getColumnsQuery(tableName: string): string; /** SQL query to get index metadata. Parameter: tableName (for PRAGMA-style). */ protected abstract getIndexesQuery(tableName: string): string; /** SQL query to get foreign key metadata. Parameter: tableName (for PRAGMA-style). */ protected abstract getForeignKeysQuery(tableName: string): string; /** SQL query to get primary key columns. Parameter: tableName (for PRAGMA-style). */ protected abstract getPrimaryKeyQuery(tableName: string): string; /** Extract table name from a row returned by getTableNamesQuery. */ protected abstract mapTableNameRow(row: RawRow): string; /** Map column query results to ColumnSchema array. Allows async for SQLite's unique column check. */ protected abstract mapColumnsResult(querier: SqlQuerier, tableName: string, results: RawRow[]): Promise; /** Map index query results to IndexSchema array. Allows async for SQLite's index_info calls. */ protected abstract mapIndexesResult(querier: SqlQuerier, tableName: string, results: RawRow[]): Promise; /** Map foreign key query results to ForeignKeySchema array. */ protected abstract mapForeignKeysResult(querier: SqlQuerier, tableName: string, results: RawRow[]): Promise; /** Map primary key query results to column names array. */ protected abstract mapPrimaryKeyResult(results: RawRow[]): string[] | undefined; /** Parse default value string to appropriate type. */ protected abstract parseDefaultValue(defaultValue: string | null): unknown; } //# sourceMappingURL=abstractSqlSchemaIntrospector.d.ts.map