Free, simple, and intuitive online database diagram editor and SQL generator.
JavaScript databasedatabase-designdatabase-diagramdatabase-schemadbmldiagram-editoreditorer-diagramerderdiagramindexeddbmariadbmcporacle-databaseoracle-dbpostgresqlschema-designsqlsql-serversqlite
Change randomUUID to uuidv4 (#1062)
1ilit52abcfb2e786
diff --git a/package-lock.json b/package-lock.jsonindex 9e0e4f43..fa13f737 100644--- a/package-lock.json+++ b/package-lock.json@@ -38,8 +38,9 @@"react-hotkeys-hook": "^4.4.1","react-i18next": "^14.1.1","react-router-dom": "^6.30.4",- "react-tweet": "^3.2.1",- "usehooks-ts": "^3.1.0"+ "react-tweet": "^3.3.1",+ "usehooks-ts": "^3.1.0",+ "uuid": "^14.0.1"},"devDependencies": {"@tailwindcss/postcss": "^4.0.14",@@ -992,9 +993,6 @@"arm64"],"dev": true,- "libc": [- "glibc"- ],"license": "MIT","optional": true,"os": [@@ -1012,9 +1010,6 @@"arm64"],"dev": true,- "libc": [- "musl"- ],"license": "MIT","optional": true,"os": [@@ -1032,9 +1027,6 @@"ppc64"],"dev": true,- "libc": [- "glibc"- ],"license": "MIT","optional": true,"os": [@@ -1052,9 +1044,6 @@"s390x"],"dev": true,- "libc": [- "glibc"- ],"license": "MIT","optional": true,"os": [@@ -1072,9 +1061,6 @@"x64"],"dev": true,- "libc": [- "glibc"- ],"license": "MIT","optional": true,"os": [@@ -1092,9 +1078,6 @@"x64"],"dev": true,- "libc": [- "musl"- ],"license": "MIT","optional": true,"os": [@@ -7993,6 +7976,19 @@"base64-arraybuffer": "^1.0.2"}},+ "node_modules/uuid": {+ "version": "14.0.1",+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.1.tgz",+ "integrity": "sha512-6ZxzVpzDXDa3bJWaHilVayA+BH/1zmxCJoVgvmqJnid/gPoKHxUrS/aC/T6LGQtNHT+XHG9fXPJB4d+IrU30Ew==",+ "funding": [+ "https://github.com/sponsors/broofa",+ "https://github.com/sponsors/ctavan"+ ],+ "license": "MIT",+ "bin": {+ "uuid": "dist-node/bin/uuid"+ }+ },"node_modules/vfile": {"version": "6.0.3","resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz",@@ -8221,9 +8217,6 @@"arm64"],"dev": true,- "libc": [- "glibc"- ],"license": "MPL-2.0","optional": true,"os": [@@ -8245,9 +8238,6 @@"arm64"],"dev": true,- "libc": [- "musl"- ],"license": "MPL-2.0","optional": true,"os": [@@ -8269,9 +8259,6 @@"x64"],"dev": true,- "libc": [- "glibc"- ],"license": "MPL-2.0","optional": true,"os": [@@ -8293,9 +8280,6 @@"x64"],"dev": true,- "libc": [- "musl"- ],"license": "MPL-2.0","optional": true,"os": [diff --git a/package.json b/package.jsonindex 7969537d..7857c010 100644--- a/package.json+++ b/package.json@@ -39,9 +39,10 @@"react-dom": "^18.2.0","react-hotkeys-hook": "^4.4.1","react-i18next": "^14.1.1",- "react-tweet": "^3.3.1","react-router-dom": "^6.30.4",- "usehooks-ts": "^3.1.0"+ "react-tweet": "^3.3.1",+ "usehooks-ts": "^3.1.0",+ "uuid": "^14.0.1"},"devDependencies": {"@tailwindcss/postcss": "^4.0.14",diff --git a/src/components/EditorHeader/ControlPanel.jsx b/src/components/EditorHeader/ControlPanel.jsxindex 864e05f6..65b328e2 100644--- a/src/components/EditorHeader/ControlPanel.jsx+++ b/src/components/EditorHeader/ControlPanel.jsx@@ -1,4 +1,5 @@import { useContext, useEffect, useState } from "react";+import { v4 as uuidv4 } from "uuid";import { Slot, useExtensions } from "../../context/ExtensionsContext";import { createPortal } from "react-dom";import {@@ -828,7 +829,7 @@ export default function ControlPanel({if (typeof extensions.cloudSave === "function") {// TODO: dont have blank here have nullconst isNew = diagramId === 'blank';- const newId = isNew ? crypto.randomUUID() : diagramId;+ const newId = isNew ? uuidv4() : diagramId;const diagramData = {diagramId: newId,database,@@ -940,7 +941,7 @@ export default function ControlPanel({notes: notes,subjectAreas: areas,custom: 1,- templateId: crypto.randomUUID(),+ templateId: uuidv4(),...(databases[database].hasEnums && { enums: enums }),...(databases[database].hasTypes && { types: types }),})diff --git a/src/components/Workspace.jsx b/src/components/Workspace.jsxindex fd9beb80..c8546932 100644--- a/src/components/Workspace.jsx+++ b/src/components/Workspace.jsx@@ -7,6 +7,7 @@ import {createContext,useContext,} from "react";+import { v4 as uuidv4 } from "uuid";import ControlPanel from "./EditorHeader/ControlPanel";import ExtensionsContext, { Slot } from "../context/ExtensionsContext";import Canvas from "./EditorCanvas/Canvas";@@ -110,7 +111,7 @@ export default function WorkSpace({ forcedDiagramId } = {}) {if (cloudOnly) {const isNew = !loadedDiagramId || isTemplate;const targetId = isNew- ? (pendingNewIdRef.current ??= crypto.randomUUID())+ ? (pendingNewIdRef.current ??= uuidv4()): loadedDiagramId;const cloudPayload = {diagramId: targetId,@@ -148,7 +149,7 @@ export default function WorkSpace({ forcedDiagramId } = {}) {}if (isTemplate || (!loadedDiagramId && !isTemplate && !isDiagram)) {- const diagramId = crypto.randomUUID();+ const diagramId = uuidv4();await db.diagrams.add({diagramId,diff --git a/src/data/db.js b/src/data/db.jsindex be65138b..a5e6a298 100644--- a/src/data/db.js+++ b/src/data/db.js@@ -1,4 +1,5 @@import Dexie from "dexie";+import { v4 as uuidv4 } from "uuid";import { templateSeeds } from "./seeds";export const db = new Dexie("drawDB");@@ -11,12 +12,12 @@ db.version(67).upgrade(async (tx) => {await tx.diagrams.toCollection().modify((diagram) => {if (!diagram.diagramId) {- diagram.diagramId = crypto.randomUUID();+ diagram.diagramId = uuidv4();}});await tx.templates.toCollection().modify((template) => {if (!template.templateId) {- template.templateId = crypto.randomUUID();+ template.templateId = uuidv4();}});});diff --git a/src/templates/template1.js b/src/templates/template1.jsindex c2166a3c..a5f59f54 100644--- a/src/templates/template1.js+++ b/src/templates/template1.js@@ -1,3 +1,4 @@+import { v4 as uuidv4 } from "uuid";import { Cardinality } from "../data/constants";export const template1 = {@@ -348,5 +349,5 @@ export const template1 = {description:"A blog database including tables such as posts, users, comments, and tags to facilitate the storage and retrieval of blog-related information.",custom: 0,- templateId: crypto.randomUUID(),+ templateId: uuidv4(),};diff --git a/src/templates/template2.js b/src/templates/template2.jsindex de7f3108..15aedab9 100644--- a/src/templates/template2.js+++ b/src/templates/template2.js@@ -1,3 +1,4 @@+import { v4 as uuidv4 } from "uuid";import { Cardinality } from "../data/constants";export const template2 = {@@ -352,5 +353,5 @@ export const template2 = {description:"A Human Resources (HR) schema designed to manage employee and project related information within an organization.",custom: 0,- templateId: crypto.randomUUID(),+ templateId: uuidv4(),};diff --git a/src/templates/template3.js b/src/templates/template3.jsindex a768bf32..fa8ce68e 100644--- a/src/templates/template3.js+++ b/src/templates/template3.js@@ -1,3 +1,4 @@+import { v4 as uuidv4 } from "uuid";import { Cardinality } from "../data/constants";export const template3 = {@@ -424,5 +425,5 @@ export const template3 = {description:"An e-commerce schema designed to manage various aspects of an online store, including products, orders, and customers.",custom: 0,- templateId: crypto.randomUUID(),+ templateId: uuidv4(),};diff --git a/src/templates/template4.js b/src/templates/template4.jsindex 4b5eadbf..0bee84d6 100644--- a/src/templates/template4.js+++ b/src/templates/template4.js@@ -1,3 +1,4 @@+import { v4 as uuidv4 } from "uuid";import { Cardinality } from "../data/constants";export const template4 = {@@ -364,5 +365,5 @@ export const template4 = {description:"A library schema designed to manage the books, genres, reservations, and other aspects of a library system",custom: 0,- templateId: crypto.randomUUID(),+ templateId: uuidv4(),};diff --git a/src/templates/template5.js b/src/templates/template5.jsindex 17c701e1..5c34b977 100644--- a/src/templates/template5.js+++ b/src/templates/template5.js@@ -1,3 +1,4 @@+import { v4 as uuidv4 } from "uuid";import { Cardinality } from "../data/constants";export const template5 = {@@ -635,5 +636,5 @@ export const template5 = {description:"A financial schema designed to manage financial transactions, accounts, customers, and other aspects of financial data.",custom: 0,- templateId: crypto.randomUUID(),+ templateId: uuidv4(),};diff --git a/src/templates/template6.js b/src/templates/template6.jsindex bc9c3254..664853b2 100644--- a/src/templates/template6.js+++ b/src/templates/template6.js@@ -1,3 +1,4 @@+import { v4 as uuidv4 } from "uuid";import { Cardinality } from "../data/constants";export const template6 = {@@ -459,5 +460,5 @@ export const template6 = {description:"A university schema designed to manage information about students, courses, instructors, and other aspects of university-related data.",custom: 0,- templateId: crypto.randomUUID(),+ templateId: uuidv4(),};