feat: compare_schemas command + diff staging into the changes queue (Task 15)
This commit is contained in:
@@ -2,6 +2,7 @@ import { invoke } from "@tauri-apps/api/core";
|
||||
import type { Connection, ConnectionInput, ConnectionTestResult, Folder, FolderInput, Tag, TagInput, Settings, ImportResult, TableInfo, QueryResult, BackupOptions, RestoreOptions, SyncOptions, PgToolStatus, MySqlToolStatus, MySqlBackupOptions, MySqlRestoreOptions, SqliteBackupOptions, SqliteRestoreOptions, FunctionInfo, TriggerInfo, SequenceInfo, EnumInfo, ExtensionInfo, SchemaGraph, IndexInfo, ConstraintInfo, RecentConnection, ObjectSearchHit, DependencyInfo, RoleInfo, PrivilegeEntry, RebuildReadiness, MaintenanceResult, TablespaceInfo, ColumnInfo, HypertableListResponse, MultiQueryResult } from "./types";
|
||||
import type { FilterRule, SortRule } from "../stores/dbViewerStore";
|
||||
import type { ChangePayload } from "./changePayload";
|
||||
import type { DiffReport } from "./types";
|
||||
import { buildObjectDdl as buildObjectDdlImpl, type ObjectKind, type DdlParams } from "./objectCrud";
|
||||
|
||||
export { type ObjectKind, type DdlParams };
|
||||
@@ -418,4 +419,14 @@ export async function getTablespaces(connectionId: string): Promise<TablespaceIn
|
||||
}
|
||||
export async function buildRebuildScript<C extends { name: string; type: string; nullable: boolean; default: string | null; is_pk: boolean }[]>(connectionId: string, schema: string, table: string, newColumns: C): Promise<string> {
|
||||
return invoke<string>("build_rebuild_script", { connectionId, schema, table, newColumns });
|
||||
}
|
||||
}
|
||||
export async function compareSchemas(
|
||||
sourceConnectionId: string,
|
||||
sourceSchema: string,
|
||||
targetConnectionId: string,
|
||||
targetSchema: string,
|
||||
): Promise<DiffReport> {
|
||||
return invoke<DiffReport>("compare_schemas", {
|
||||
sourceConnectionId, sourceSchema, targetConnectionId, targetSchema,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -506,4 +506,25 @@ export interface Relationship {
|
||||
export interface SchemaGraph {
|
||||
tables: TableNode[];
|
||||
relationships: Relationship[];
|
||||
}
|
||||
}
|
||||
export interface DiffDetailLine {
|
||||
label: string;
|
||||
old: string;
|
||||
new: string;
|
||||
}
|
||||
|
||||
export interface DiffItem {
|
||||
object_type: string;
|
||||
name: string;
|
||||
kind: "added" | "removed" | "changed";
|
||||
detail: DiffDetailLine[];
|
||||
sync_sql: string[];
|
||||
destructive: boolean;
|
||||
}
|
||||
|
||||
export interface DiffReport {
|
||||
items: DiffItem[];
|
||||
source_label: string;
|
||||
target_label: string;
|
||||
truncated: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user