feat(oracle): show table constraints in structure editor

This commit is contained in:
Melody Ruch authored and GitHub committed 2026-08-15 23:28:53 +08:00
1 parent 76b8f2f54b
commit f9c4f290f5
19 files changed
+413 -20

No files matched your search

@@ -5,6 +5,7 @@ export interface TableStructureRefreshScope {
columns: boolean;
indexes: boolean;
foreignKeys: boolean;
constraints: boolean;
triggers: boolean;
tableComment: boolean;
}
@@ -12,15 +13,17 @@ export interface TableStructureRefreshScope {
export function visibleTableStructureRefreshScope(activeTab: TableInfoTab): TableStructureRefreshScope {
switch (activeTab) {
case "columns":
return { columns: true, indexes: false, foreignKeys: false, triggers: false, tableComment: true };
return { columns: true, indexes: false, foreignKeys: false, constraints: false, triggers: false, tableComment: true };
case "indexes":
return { columns: true, indexes: true, foreignKeys: false, triggers: false, tableComment: true };
return { columns: true, indexes: true, foreignKeys: false, constraints: false, triggers: false, tableComment: true };
case "foreignKeys":
return { columns: true, indexes: false, foreignKeys: true, triggers: false, tableComment: true };
return { columns: true, indexes: false, foreignKeys: true, constraints: false, triggers: false, tableComment: true };
case "constraints":
return { columns: false, indexes: false, foreignKeys: false, constraints: true, triggers: false, tableComment: true };
case "triggers":
return { columns: false, indexes: false, foreignKeys: false, triggers: true, tableComment: true };
return { columns: false, indexes: false, foreignKeys: false, constraints: false, triggers: true, tableComment: true };
case "ddl":
return { columns: false, indexes: false, foreignKeys: false, triggers: false, tableComment: false };
return { columns: false, indexes: false, foreignKeys: false, constraints: false, triggers: false, tableComment: false };
}
}
@@ -30,11 +33,12 @@ export function unloadedTableStructureRefreshScope(activeTab: TableInfoTab, load
columns: visibleScope.columns && !loadedFacets.has("columns"),
indexes: visibleScope.indexes && !loadedFacets.has("indexes"),
foreignKeys: visibleScope.foreignKeys && !loadedFacets.has("foreign-keys"),
constraints: visibleScope.constraints && !loadedFacets.has("constraints"),
triggers: visibleScope.triggers && !loadedFacets.has("triggers"),
tableComment: visibleScope.tableComment && !loadedFacets.has("comment"),
};
}
export function hasTableStructureRefreshWork(scope: TableStructureRefreshScope): boolean {
return scope.columns || scope.indexes || scope.foreignKeys || scope.triggers || scope.tableComment;
return scope.columns || scope.indexes || scope.foreignKeys || scope.constraints || scope.triggers || scope.tableComment;
}