/** * Table Operations Module * Handles table creation, dropping, and comparison logic */ import type { ILegacySyncOptions, TArray, TNullable } from '../../types'; import { type SyncDbSide } from '../syncClient'; import type { Client } from 'pg'; interface ITableRow { table_name: string; } interface IColumnRow { column_name: string; data_type: string; resolved_type?: string; character_maximum_length: TNullable; is_nullable: 'YES' | 'NO'; column_default: TNullable; ordinal_position: number; } export declare class TableOperations { private sourceClient; private targetClient; private options; constructor(sourceClient: Client, targetClient: Client, options: ILegacySyncOptions); /** * Get all tables from a schema on the given database (source vs target). */ getTables(side: SyncDbSide): Promise>; /** * Get table definition from schema on the given database. */ getTableDefinition(side: SyncDbSide, tableName: string): Promise>; /** * Convert IColumnRow to ColumnInfo format expected by Utils */ private convertToColumnInfo; /** * Generate CREATE TABLE statement */ generateCreateTableStatement(tableName: string, columns: TArray): string | null; /** * Handle creation of missing tables */ handleMissingTables(missingTables: ITableRow[], alterStatements: string[]): Promise; /** * FK edges among tables slated for removal (child table_name → parent referenced). */ private getIntraRemovalForeignKeyRefs; sortTablesToDropForCascadeAsync(tablesToDrop: TArray): Promise; /** * Rename-first preservation for removed tables (non-destructive policy). */ handleTablesToDropWithPreserveRename(tablesToDrop: TArray, alterStatements: TArray): void; /** * DROP TABLE ... CASCADE for tables removed from desired schema (FK-safe order). */ handleTablesToDropWithCascade(tablesToDrop: TArray, alterStatements: TArray): void; /** * Tables present on target but absent from source (removed from desired schema). */ getTablesToDrop(): Promise>; /** * Create tables that exist in source but not target. * Removed-table handling runs in `generateRemovedTableOperations` (final section). */ generateTableOperations(): Promise; private resolveTablesPendingRemoval; /** * Final section: CASCADE drops (default) or rename-first preservation. */ generateRemovedTableOperations(): Promise; /** @deprecated Use `generateRemovedTableOperations` */ generateRemovedTableCascadeDrops(): Promise; } export {}; //# sourceMappingURL=tables.d.ts.map