feat: add ER diagram and enhance TableStructure with FK details, triggers, comments
- Add interactive ER diagram with ReactFlow + dagre auto-layout, accessible via right-click context menu on schema nodes in the sidebar - Enhance TableStructure: column comments, FK referenced table/columns, ON UPDATE/DELETE rules, new Triggers tab - Backend: rewrite get_table_constraints using pg_constraint for proper composite FK support, add get_table_triggers and get_schema_erd commands Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -56,12 +56,18 @@ export interface ColumnInfo {
|
||||
ordinal_position: number;
|
||||
character_maximum_length: number | null;
|
||||
is_primary_key: boolean;
|
||||
comment: string | null;
|
||||
}
|
||||
|
||||
export interface ConstraintInfo {
|
||||
name: string;
|
||||
constraint_type: string;
|
||||
columns: string[];
|
||||
referenced_schema: string | null;
|
||||
referenced_table: string | null;
|
||||
referenced_columns: string[] | null;
|
||||
update_rule: string | null;
|
||||
delete_rule: string | null;
|
||||
}
|
||||
|
||||
export interface IndexInfo {
|
||||
@@ -223,8 +229,13 @@ export interface SavedQuery {
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export type AiProvider = "ollama" | "openai" | "anthropic";
|
||||
|
||||
export interface AiSettings {
|
||||
provider: AiProvider;
|
||||
ollama_url: string;
|
||||
openai_api_key?: string;
|
||||
anthropic_api_key?: string;
|
||||
model: string;
|
||||
}
|
||||
|
||||
@@ -272,7 +283,47 @@ export interface LookupProgress {
|
||||
total: number;
|
||||
}
|
||||
|
||||
export type TabType = "query" | "table" | "structure" | "roles" | "sessions" | "lookup";
|
||||
export interface TriggerInfo {
|
||||
name: string;
|
||||
event: string;
|
||||
timing: string;
|
||||
orientation: string;
|
||||
function_name: string;
|
||||
is_enabled: boolean;
|
||||
definition: string;
|
||||
}
|
||||
|
||||
export interface ErdColumn {
|
||||
name: string;
|
||||
data_type: string;
|
||||
is_nullable: boolean;
|
||||
is_primary_key: boolean;
|
||||
}
|
||||
|
||||
export interface ErdTable {
|
||||
schema: string;
|
||||
name: string;
|
||||
columns: ErdColumn[];
|
||||
}
|
||||
|
||||
export interface ErdRelationship {
|
||||
constraint_name: string;
|
||||
source_schema: string;
|
||||
source_table: string;
|
||||
source_columns: string[];
|
||||
target_schema: string;
|
||||
target_table: string;
|
||||
target_columns: string[];
|
||||
update_rule: string;
|
||||
delete_rule: string;
|
||||
}
|
||||
|
||||
export interface ErdData {
|
||||
tables: ErdTable[];
|
||||
relationships: ErdRelationship[];
|
||||
}
|
||||
|
||||
export type TabType = "query" | "table" | "structure" | "roles" | "sessions" | "lookup" | "erd";
|
||||
|
||||
export interface Tab {
|
||||
id: string;
|
||||
|
||||
Reference in New Issue
Block a user