feat(oracle): show table constraints in structure editor
This commit is contained in:
1 parent
76b8f2f54b
commit
f9c4f290f5
19 files changed
+413
-20
No files matched your search
+13
-7
@@ -3,11 +3,12 @@ import { hasTableStructureRefreshWork, unloadedTableStructureRefreshScope, visib
|
||||
|
||||
describe("table structure metadata loading", () => {
|
||||
it.each([
|
||||
["columns", { columns: true, indexes: false, foreignKeys: false, triggers: false, tableComment: true }],
|
||||
["indexes", { columns: true, indexes: true, foreignKeys: false, triggers: false, tableComment: true }],
|
||||
["foreignKeys", { columns: true, indexes: false, foreignKeys: true, triggers: false, tableComment: true }],
|
||||
["triggers", { columns: false, indexes: false, foreignKeys: false, triggers: true, tableComment: true }],
|
||||
["ddl", { columns: false, indexes: false, foreignKeys: false, triggers: false, tableComment: false }],
|
||||
["columns", { columns: true, indexes: false, foreignKeys: false, constraints: false, triggers: false, tableComment: true }],
|
||||
["indexes", { columns: true, indexes: true, foreignKeys: false, constraints: false, triggers: false, tableComment: true }],
|
||||
["foreignKeys", { columns: true, indexes: false, foreignKeys: true, constraints: false, triggers: false, tableComment: true }],
|
||||
["constraints", { columns: false, indexes: false, foreignKeys: false, constraints: true, triggers: false, tableComment: true }],
|
||||
["triggers", { columns: false, indexes: false, foreignKeys: false, constraints: false, triggers: true, tableComment: true }],
|
||||
["ddl", { columns: false, indexes: false, foreignKeys: false, constraints: false, triggers: false, tableComment: false }],
|
||||
] as const)("requests only the metadata required by the %s tab", (tab, expected) => {
|
||||
expect(visibleTableStructureRefreshScope(tab)).toEqual(expected);
|
||||
});
|
||||
@@ -15,13 +16,18 @@ describe("table structure metadata loading", () => {
|
||||
it("requests only index metadata after columns and comments are already loaded", () => {
|
||||
const scope = unloadedTableStructureRefreshScope("indexes", new Set(["columns", "comment"]));
|
||||
|
||||
expect(scope).toEqual({ columns: false, indexes: true, foreignKeys: false, triggers: false, tableComment: false });
|
||||
expect(scope).toEqual({ columns: false, indexes: true, foreignKeys: false, constraints: false, triggers: false, tableComment: false });
|
||||
expect(hasTableStructureRefreshWork(scope)).toBe(true);
|
||||
expect(hasTableStructureRefreshWork(unloadedTableStructureRefreshScope("indexes", new Set(["columns", "indexes", "comment"])))).toBe(false);
|
||||
});
|
||||
|
||||
it("requests trigger metadata only until that facet is loaded", () => {
|
||||
expect(unloadedTableStructureRefreshScope("triggers", new Set(["comment"]))).toEqual({ columns: false, indexes: false, foreignKeys: false, triggers: true, tableComment: false });
|
||||
expect(unloadedTableStructureRefreshScope("triggers", new Set(["comment"]))).toEqual({ columns: false, indexes: false, foreignKeys: false, constraints: false, triggers: true, tableComment: false });
|
||||
expect(hasTableStructureRefreshWork(unloadedTableStructureRefreshScope("triggers", new Set(["triggers", "comment"])))).toBe(false);
|
||||
});
|
||||
|
||||
it("requests constraint metadata only until that facet is loaded", () => {
|
||||
expect(unloadedTableStructureRefreshScope("constraints", new Set(["comment"]))).toEqual({ columns: false, indexes: false, foreignKeys: false, constraints: true, triggers: false, tableComment: false });
|
||||
expect(hasTableStructureRefreshWork(unloadedTableStructureRefreshScope("constraints", new Set(["constraints", "comment"])))).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user