mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-19 16:16:45 +00:00
fix(sidebar): dedupe MySQL table objects
This commit is contained in:
@@ -193,3 +193,26 @@ test("mergeTableInfosIntoObjects restores views missing from object metadata", (
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
test("mergeTableInfosIntoObjects dedupes MySQL tables when object metadata carries database as schema", () => {
|
||||
const merged = mergeTableInfosIntoObjects(
|
||||
[
|
||||
{
|
||||
name: "orders",
|
||||
object_type: "TABLE",
|
||||
schema: "app",
|
||||
comment: null,
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
parent_schema: null,
|
||||
parent_name: null,
|
||||
},
|
||||
],
|
||||
[table("orders")],
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
merged.map((item) => ({ name: item.name, type: item.object_type, schema: item.schema })),
|
||||
[{ name: "orders", type: "TABLE", schema: "app" }],
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user