UNPKG

dbgate-tools

Version:

Auxiliary tools for other DbGate packages.

57 lines (56 loc) 3 kB
import type { ColumnInfo, DatabaseInfo, EngineDriver, SqlObjectInfo, TableInfo } from 'dbgate-types'; import { AlterPlan } from './alterPlan'; type DbDiffSchemaMode = 'strict' | 'ignore' | 'ignoreImplicit'; export interface DbDiffOptions { ignoreCase?: boolean; schemaMode?: DbDiffSchemaMode; leftImplicitSchema?: string; rightImplicitSchema?: string; ignoreConstraintNames?: boolean; noDropTable?: boolean; allowTableRecreate?: boolean; deletedTablePrefix?: string; noDropColumn?: boolean; deletedColumnPrefix?: string; noDropConstraint?: boolean; noDropSqlObject?: boolean; deletedSqlObjectPrefix?: string; noRenameTable?: boolean; noRenameColumn?: boolean; ignoreForeignKeyActions?: boolean; ignoreDataTypes?: boolean; ignoreComments?: boolean; } export declare function generateTablePairingId(table: TableInfo): TableInfo; export declare function removeTablePairingId(table: TableInfo): TableInfo; export declare function generateDbPairingId(db: DatabaseInfo): DatabaseInfo; export declare function hasDeletedPrefix(name: string, opts: DbDiffOptions, deletedPrefix?: string): boolean; export declare function testEqualColumns(a: ColumnInfo, b: ColumnInfo, checkName: boolean, checkDefault: boolean, opts?: DbDiffOptions): boolean; export declare function testEqualTypes(a: ColumnInfo, b: ColumnInfo, opts?: DbDiffOptions): boolean; export declare function testEqualTables(a: TableInfo, b: TableInfo, opts: DbDiffOptions, wholeOldDb: DatabaseInfo, wholeNewDb: DatabaseInfo, driver: EngineDriver): boolean; export declare function testEqualSqlObjects(a: SqlObjectInfo, b: SqlObjectInfo, opts: DbDiffOptions): boolean; export declare function createAlterTablePlan(oldTable: TableInfo, newTable: TableInfo, opts: DbDiffOptions, wholeOldDb: DatabaseInfo, wholeNewDb: DatabaseInfo, driver: EngineDriver): AlterPlan; export declare function createAlterDatabasePlan(oldDb: DatabaseInfo, newDb: DatabaseInfo, opts: DbDiffOptions, wholeOldDb: DatabaseInfo, wholeNewDb: DatabaseInfo, driver: EngineDriver): AlterPlan; export declare function getAlterTableScript(oldTable: TableInfo, newTable: TableInfo, opts: DbDiffOptions, wholeOldDb: DatabaseInfo, wholeNewDb: DatabaseInfo, driver: EngineDriver): { sql: string; recreates: any[]; } | { sql: string; recreates: { tables: number; constraints: number; sqlObjects: number; }; }; export declare function getAlterDatabaseScript(oldDb: DatabaseInfo, newDb: DatabaseInfo, opts: DbDiffOptions, wholeOldDb: DatabaseInfo, wholeNewDb: DatabaseInfo, driver: EngineDriver, transformPlan?: (plan: AlterPlan) => void): { sql: string; recreates: { tables: number; constraints: number; sqlObjects: number; }; isEmpty: boolean; }; export declare function matchPairedObjects(db1: DatabaseInfo, db2: DatabaseInfo, opts: DbDiffOptions): DatabaseInfo; export declare const modelCompareDbDiffOptions: DbDiffOptions; export {};