fix(oceanbase): preserve partition DDL and toggle storage options

This commit is contained in:
efeire authored and GitHub committed 2026-09-18 01:59:42 +08:00
1 parent 8eba12ea2f
commit fe0dd02f2b
36 files changed
+870 -125

No files matched your search

@@ -115,6 +115,24 @@ describe("connectionStore Xugu table child metadata", () => {
expect(childTypes).toEqual(["group-columns", "group-fkeys", "group-triggers", "group-indexes"]);
});
it("loads OceanBase Oracle partitions and subpartitions through the metadata tree", async () => {
const partition = { name: "P1", position: 1, value: "100", partition_type: "RANGE", partition_key: '"ID"' };
const subpartition = { name: "P1_E", position: 1, value: "'east'", partition_type: "LIST", partition_key: '"REGION"' };
const { api, config, store, tableId } = await setup("oceanbase-oracle", {
listPartitions: vi.fn().mockResolvedValue([partition]),
listSubpartitions: vi.fn().mockResolvedValue([subpartition]),
});
const partitions = findNode(store.treeNodes, `${tableId}:__table-partitions`)!;
const subpartitions = findNode(store.treeNodes, `${tableId}:__table-subpartitions`)!;
expect(partitions).toBeDefined();
expect(subpartitions).toBeDefined();
await store.loadTreeNodeChildren(partitions);
await store.loadTreeNodeChildren(subpartitions);
expect(api.listPartitions).toHaveBeenCalledWith(config.id, "SHOP_DEMO", "SYSDBA", "SHOP_ORDERS", undefined);
expect(partitions.children?.[0]).toMatchObject({ label: "P1 (RANGE: 100)", meta: partition });
expect(subpartitions.children?.[0]).toMatchObject({ label: "P1_E (LIST: 'east')", meta: subpartition });
});
it("routes Xugu child groups to their dedicated metadata calls, including empty results", async () => {
const listConstraints = vi.fn().mockResolvedValue([
{
+28 -28
View File
@@ -6608,34 +6608,34 @@ export const useConnectionStore = defineStore("connection", () => {
children: [],
});
}
if (supportsXuguChildMetadata) {
children.push(
{
id: `${parentId}:__table-partitions`,
label: "tree.partitions",
type: "group-table-partitions",
connectionId,
database,
schema,
catalog,
tableName: table,
isExpanded: false,
children: [],
},
{
id: `${parentId}:__table-subpartitions`,
label: "tree.subpartitions",
type: "group-table-subpartitions",
connectionId,
database,
schema,
catalog,
tableName: table,
isExpanded: false,
children: [],
},
);
}
}
if (supportsXuguChildMetadata || effectiveDbType === "oceanbase-oracle") {
children.push(
{
id: `${parentId}:__table-partitions`,
label: "tree.partitions",
type: "group-table-partitions",
connectionId,
database,
schema,
catalog,
tableName: table,
isExpanded: false,
children: [],
},
{
id: `${parentId}:__table-subpartitions`,
label: "tree.subpartitions",
type: "group-table-subpartitions",
connectionId,
database,
schema,
catalog,
tableName: table,
isExpanded: false,
children: [],
},
);
}
}
+4
View File
@@ -775,6 +775,7 @@ export interface EditorSettings {
wordWrap: boolean;
tableDdlWordWrap: boolean;
refreshDdlOnOpen: boolean;
excludeDdlStorage: boolean;
vimModeEnabled: boolean;
autoCloseBrackets: boolean;
sqlSemanticDiagnosticsMode: SqlSemanticDiagnosticsMode;
@@ -1019,6 +1020,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
wordWrap: false,
tableDdlWordWrap: true,
refreshDdlOnOpen: false,
excludeDdlStorage: true,
vimModeEnabled: false,
autoCloseBrackets: true,
sqlSemanticDiagnosticsMode: "auto",
@@ -1501,6 +1503,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
selectFirstCompletionOnOpen: typeof settings.selectFirstCompletionOnOpen === "boolean" ? settings.selectFirstCompletionOnOpen : DEFAULT_EDITOR_SETTINGS.selectFirstCompletionOnOpen,
wordWrap: settings.wordWrap ?? DEFAULT_EDITOR_SETTINGS.wordWrap,
tableDdlWordWrap: typeof settings.tableDdlWordWrap === "boolean" ? settings.tableDdlWordWrap : DEFAULT_EDITOR_SETTINGS.tableDdlWordWrap,
excludeDdlStorage: typeof settings.excludeDdlStorage === "boolean" ? settings.excludeDdlStorage : DEFAULT_EDITOR_SETTINGS.excludeDdlStorage,
refreshDdlOnOpen: typeof settings.refreshDdlOnOpen === "boolean" ? settings.refreshDdlOnOpen : DEFAULT_EDITOR_SETTINGS.refreshDdlOnOpen,
vimModeEnabled: typeof settings.vimModeEnabled === "boolean" ? settings.vimModeEnabled : DEFAULT_EDITOR_SETTINGS.vimModeEnabled,
autoCloseBrackets: typeof settings.autoCloseBrackets === "boolean" ? settings.autoCloseBrackets : DEFAULT_EDITOR_SETTINGS.autoCloseBrackets,
@@ -2264,6 +2267,7 @@ export const useSettingsStore = defineStore("settings", () => {
if (partial.selectFirstCompletionOnOpen !== undefined) editorSettings.value.selectFirstCompletionOnOpen = partial.selectFirstCompletionOnOpen === true;
if (partial.wordWrap !== undefined) editorSettings.value.wordWrap = partial.wordWrap;
if (partial.tableDdlWordWrap !== undefined) editorSettings.value.tableDdlWordWrap = partial.tableDdlWordWrap === true;
if (partial.excludeDdlStorage !== undefined) editorSettings.value.excludeDdlStorage = partial.excludeDdlStorage === true;
if (partial.refreshDdlOnOpen !== undefined) editorSettings.value.refreshDdlOnOpen = partial.refreshDdlOnOpen === true;
if (partial.vimModeEnabled !== undefined) editorSettings.value.vimModeEnabled = partial.vimModeEnabled === true;
if (partial.autoCloseBrackets !== undefined) editorSettings.value.autoCloseBrackets = partial.autoCloseBrackets === true;