Files
evento/node_modules/@mikro-orm/sql/dialects/sqlite/SqliteSchemaHelper.d.ts
2026-03-18 14:55:56 -03:00

79 lines
3.3 KiB
TypeScript

import { type Connection } from '@mikro-orm/core';
import type { AbstractSqlConnection } from '../../AbstractSqlConnection.js';
import { SchemaHelper } from '../../schema/SchemaHelper.js';
import type { Column, IndexDef, Table, TableDifference } from '../../typings.js';
import type { DatabaseTable } from '../../schema/DatabaseTable.js';
import type { DatabaseSchema } from '../../schema/DatabaseSchema.js';
export declare class SqliteSchemaHelper extends SchemaHelper {
disableForeignKeysSQL(): string;
enableForeignKeysSQL(): string;
supportsSchemaConstraints(): boolean;
getCreateNamespaceSQL(name: string): string;
getDropNamespaceSQL(name: string): string;
getListTablesSQL(): string;
getAllTables(connection: AbstractSqlConnection, schemas?: string[]): Promise<Table[]>;
getNamespaces(connection: AbstractSqlConnection): Promise<string[]>;
private getIgnoredViewsCondition;
getListViewsSQL(): string;
loadViews(schema: DatabaseSchema, connection: AbstractSqlConnection, schemaName?: string): Promise<void>;
getDropDatabaseSQL(name: string): string;
loadInformationSchema(
schema: DatabaseSchema,
connection: AbstractSqlConnection,
tables: Table[],
schemas?: string[],
): Promise<void>;
createTable(table: DatabaseTable, alter?: boolean): string[];
createTableColumn(column: Column, table: DatabaseTable, _changedProperties?: Set<string>): string | undefined;
getAddColumnsSQL(table: DatabaseTable, columns: Column[], diff?: TableDifference): string[];
dropForeignKey(tableName: string, constraintName: string): string;
getDropColumnsSQL(tableName: string, columns: Column[], schemaName?: string): string;
getCreateIndexSQL(tableName: string, index: IndexDef): string;
private parseTableDefinition;
/**
* Returns schema prefix for pragma and sqlite_master queries.
* Returns empty string for main database (no prefix needed).
*/
private getSchemaPrefix;
/**
* Returns all database names excluding 'temp'.
*/
private getDatabaseList;
/**
* Extracts the SELECT part from a CREATE VIEW statement.
*/
private extractViewDefinition;
private getColumns;
/**
* SQLite strips outer parentheses from expression defaults (`DEFAULT (expr)` → `expr` in pragma).
* We need to add them back so they match what we generate in DDL.
*/
private wrapExpressionDefault;
private getEnumDefinitions;
getPrimaryKeys(
connection: AbstractSqlConnection,
indexes: IndexDef[],
tableName: string,
schemaName?: string,
): Promise<string[]>;
private getIndexes;
private getChecks;
private getColumnDefinitions;
private getForeignKeys;
getManagementDbName(): string;
getCreateDatabaseSQL(name: string): string;
databaseExists(connection: Connection, name: string): Promise<boolean>;
/**
* Implicit indexes will be ignored when diffing
*/
isImplicitIndex(name: string): boolean;
dropIndex(table: string, index: IndexDef, oldIndexName?: string): string;
/**
* SQLite does not support schema-qualified table names in REFERENCES clauses.
* Foreign key references can only point to tables in the same database.
*/
getReferencedTableName(referencedTableName: string, schema?: string): string;
alterTable(diff: TableDifference, safe?: boolean): string[];
private getAlterTempTableSQL;
}