Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

fix(templates): fix cloned indexes from a template (#398)

Guy Ben-Aharon9f8500fc7e36
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index 39cc64c8..4788e8f0 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -141,6 +141,7 @@ export const cloneDiagram = (
newTable.indexes = table.indexes.map(
(index): DBIndex => ({
...index,
+ fieldIds: index.fieldIds.map((id) => getNewId(id)),
id: getNewId(index.id),
})
);