diff --git a/src/data/seeds.js b/src/data/seeds.js index d27ff4e..3069e7c 100644 --- a/src/data/seeds.js +++ b/src/data/seeds.js @@ -1,335 +1,21 @@ -const t1 = { - tables: [ - { - id: 0, - name: "table_0", - x: 73, - y: 69, - fields: [ - { - name: "id", - type: "INT", - default: "", - check: "", - primary: true, - unique: true, - notNull: true, - increment: true, - comment: "", - id: 0, - }, - ], - comment: "", - indices: [], - color: "#175e7a", - }, - { - id: 1, - name: "table_1", - x: 366, - y: 117, - fields: [ - { - name: "id", - type: "INT", - default: "", - check: "", - primary: true, - unique: true, - notNull: true, - increment: true, - comment: "", - id: 0, - }, - ], - comment: "", - indices: [], - color: "#175e7a", - }, - ], - relationships: [ - { - startTableId: 0, - startFieldId: 0, - endTableId: 1, - endFieldId: 0, - startX: 88, - startY: 138, - endX: 381, - endY: 186, - name: "table_0_id_fk", - cardinality: "One to one", - updateConstraint: "No action", - deleteConstraint: "No action", - mandatory: false, - id: 0, - }, - ], - notes: [ - { - id: 0, - x: 526, - y: 240, - title: "note_0", - content: "hi", - color: "#fcf7ac", - height: 65, - }, - ], - subjectAreas: [ - { - id: 0, - name: "area_0", - x: 43, - y: 28, - width: 558, - height: 206, - color: "#175e7a", - }, - ], - types: [], - title: "Template 1", - description: "Lorem ipsum", -}; +import { template1 } from "../templates/template1"; +import { template2 } from "../templates/template2"; +import { template3 } from "../templates/template3"; +import { template4 } from "../templates/template4"; +import { template5 } from "../templates/template5"; +import { template6 } from "../templates/template6"; +import { template7 } from "../templates/template7"; +import { template8 } from "../templates/template8"; -const t2 = { - tables: [ - { - id: 0, - name: "template_2", - x: 57, - y: 63, - fields: [ - { - name: "id", - type: "INT", - default: "", - check: "", - primary: true, - unique: true, - notNull: true, - increment: true, - comment: "", - id: 0, - }, - ], - comment: "", - indices: [], - color: "#ff4f81", - }, - ], - relationships: [], - notes: [], - subjectAreas: [], - types: [], - title: "Template 2", - description: "Lorem ipsum", -}; - -const t3 = { - tables: [ - { - id: 0, - name: "template_3", - x: 57, - y: 63, - fields: [ - { - name: "id", - type: "INT", - default: "", - check: "", - primary: true, - unique: true, - notNull: true, - increment: true, - comment: "", - id: 0, - }, - ], - comment: "", - indices: [], - color: "#bc49c4", - }, - ], - relationships: [], - notes: [], - subjectAreas: [], - types: [], - title: "Template 3", - description: "Lorem ipsum", -}; - -const t4 = { - tables: [ - { - id: 0, - name: "template_4", - x: 57, - y: 63, - fields: [ - { - name: "id", - type: "INT", - default: "", - check: "", - primary: true, - unique: true, - notNull: true, - increment: true, - comment: "", - id: 0, - }, - ], - comment: "", - indices: [], - color: "#a751e8", - }, - ], - relationships: [], - notes: [], - subjectAreas: [], - types: [], - title: "Template 4", - description: "Lorem ipsum", -}; - -const t5 = { - tables: [ - { - id: 0, - name: "template_5", - x: 57, - y: 63, - fields: [ - { - name: "id", - type: "INT", - default: "", - check: "", - primary: true, - unique: true, - notNull: true, - increment: true, - comment: "", - id: 0, - }, - ], - comment: "", - indices: [], - color: "#7c4af0", - }, - ], - relationships: [], - notes: [], - subjectAreas: [], - types: [], - title: "Template 5", - description: "Lorem ipsum", -}; - -const t6 = { - tables: [ - { - id: 0, - name: "template_6", - x: 57, - y: 63, - fields: [ - { - name: "id", - type: "INT", - default: "", - check: "", - primary: true, - unique: true, - notNull: true, - increment: true, - comment: "", - id: 0, - }, - ], - comment: "", - indices: [], - color: "#6360f7", - }, - ], - relationships: [], - notes: [], - subjectAreas: [], - types: [], - title: "Template 6", - description: "Lorem ipsum", -}; - -const t7 = { - tables: [ - { - id: 0, - name: "template_7", - x: 57, - y: 63, - fields: [ - { - name: "id", - type: "INT", - default: "", - check: "", - primary: true, - unique: true, - notNull: true, - increment: true, - comment: "", - id: 0, - }, - ], - comment: "", - indices: [], - color: "#7d9dff", - }, - ], - relationships: [], - notes: [], - subjectAreas: [], - types: [], - title: "Template 7", - description: "Lorem ipsum", -}; - -const t8 = { - tables: [ - { - id: 0, - name: "template_8", - x: 57, - y: 63, - fields: [ - { - name: "id", - type: "INT", - default: "", - check: "", - primary: true, - unique: true, - notNull: true, - increment: true, - comment: "", - id: 0, - }, - ], - comment: "", - indices: [], - color: "#32c9b0", - }, - ], - relationships: [], - notes: [], - subjectAreas: [], - types: [], - title: "Template 8", - description: "Lorem ipsum", -}; - -const templateSeeds = [t1, t2, t3, t4, t5, t6, t7, t8]; +const templateSeeds = [ + template1, + template2, + template3, + template4, + template5, + template6, + template7, + template8, +]; export { templateSeeds }; diff --git a/src/pages/Templates.jsx b/src/pages/Templates.jsx index 93c158d..19e5fd0 100644 --- a/src/pages/Templates.jsx +++ b/src/pages/Templates.jsx @@ -9,8 +9,8 @@ import { calcPath } from "../utils"; function Thumbnail({ diagram }) { const zoom = 0.3; return ( -
- +
+ {table.fields.map((f, j) => (
@@ -164,56 +166,71 @@ export default function Templates() { return (
-
-
- - logo - -
- Templates +
+
+
+ + logo + +
+ Templates +
+
+
+
+
+ Database schema templates +
+
+ A compilation of database entity relationship diagrams to give you + a quick start or inspire your application's architecture. +
+
+ + Default templates} + itemKey="1" + > +
+ {templates?.map((t, i) => ( +
+ +
+
+
+ {t.title} +
+ +
+
{t.description}
+
+
+ ))} +
+
+ Your templates} + itemKey="2" + > +
Your templates
+
+
+
-
-
-
-
- Database schema templates -
-
- A compilation of database entity relationship diagrams to give you a - quick start or inspire your application's architecture. -
-
- - Default templates} - itemKey="1" - > -
- {templates?.map((t, i) => ( -
- -
{t.title}
-
{t.description}
-
- ))} -
-
- Your templates} - itemKey="2" - > - Your templates - -
+
+
+ © 2024 drawDB - All right reserved.
); diff --git a/src/templates/template1.js b/src/templates/template1.js new file mode 100644 index 0000000..7d8aac7 --- /dev/null +++ b/src/templates/template1.js @@ -0,0 +1,154 @@ +export const template1 = { + tables: [ + { + id: 0, + name: "table_0", + x: 23, + y: 26, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "name", + type: "VARCHAR", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: 255, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + { + id: 1, + name: "table_1", + x: 301, + y: 167, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "age", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + { + name: "t_id", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + { + id: 2, + name: "table_2", + x: 594, + y: 232, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + ], + relationships: [ + { + startTableId: 1, + startFieldId: 2, + endTableId: 0, + endFieldId: 0, + startX: 316, + startY: 308, + endX: 38, + endY: 95, + name: "table_1_t_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 0, + }, + ], + notes: [ + { + id: 0, + x: 352, + y: 22, + title: "note_0", + content: "hi", + color: "#fcf7ac", + height: 65, + }, + ], + subjectAreas: [ + { + id: 0, + name: "area_0", + x: 0, + y: 0, + width: 562, + height: 390, + color: "#175e7a", + }, + ], + types: [], + title: "Template 1", + description: + "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.", +}; diff --git a/src/templates/template2.js b/src/templates/template2.js new file mode 100644 index 0000000..ad588c6 --- /dev/null +++ b/src/templates/template2.js @@ -0,0 +1,163 @@ +export const template2 = { + tables: [ + { + id: 0, + name: "table_0", + x: 23, + y: 26, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "name", + type: "VARCHAR", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: 255, + }, + ], + comment: "", + indices: [], + color: "#3cde7d", + }, + { + id: 1, + name: "table_1", + x: 30, + y: 178, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "age", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + { + name: "t_id", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + }, + ], + comment: "", + indices: [], + color: "#ffe159", + }, + { + id: 2, + name: "table_2", + x: 336, + y: 118, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#7c4af0", + }, + ], + relationships: [ + { + startTableId: 1, + startFieldId: 2, + endTableId: 0, + endFieldId: 0, + startX: 45, + startY: 319, + endX: 38, + endY: 95, + name: "table_1_t_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 0, + }, + ], + notes: [ + { + id: 0, + x: 352, + y: 22, + title: "note_0", + content: "hi", + color: "#fcf7ac", + height: 65, + }, + { + id: 1, + x: 577, + y: 254, + title: "note_1", + content: "", + color: "#c7d2ff", + height: 88, + }, + ], + subjectAreas: [ + { + id: 0, + name: "area_0", + x: -10, + y: -22, + width: 562, + height: 390, + color: "#7c4af0", + }, + ], + types: [], + title: "Template 2", + description: + "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.", +}; diff --git a/src/templates/template3.js b/src/templates/template3.js new file mode 100644 index 0000000..3b1dacb --- /dev/null +++ b/src/templates/template3.js @@ -0,0 +1,230 @@ +export const template3 = { + tables: [ + { + id: 0, + name: "table_0", + x: 23, + y: 26, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "name", + type: "VARCHAR", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: 255, + }, + ], + comment: "", + indices: [], + color: "#3cde7d", + }, + { + id: 1, + name: "table_1", + x: 354, + y: 144, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "age", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + { + name: "t_id", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + }, + ], + comment: "", + indices: [], + color: "#ffe159", + }, + { + id: 2, + name: "table_2", + x: 25, + y: 171, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#7c4af0", + }, + { + id: 3, + name: "table_3", + x: 356, + y: 30, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + { + id: 4, + name: "table_4", + x: 628, + y: 6, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "quantity", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + ], + relationships: [ + { + startTableId: 1, + startFieldId: 2, + endTableId: 0, + endFieldId: 0, + startX: 369, + startY: 285, + endX: 38, + endY: 95, + name: "table_1_t_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 0, + }, + ], + notes: [ + { + id: 0, + x: 630, + y: 164, + title: "note_0", + content: "hi", + color: "#fcf7ac", + height: 65, + }, + { + id: 1, + x: 635, + y: 260, + title: "note_1", + content: "", + color: "#c7d2ff", + height: 88, + }, + ], + subjectAreas: [ + { + id: 0, + name: "area_0", + x: -10, + y: -22, + width: 264, + height: 365, + color: "#7c4af0", + }, + { + id: 1, + name: "area_1", + x: 289, + y: -18, + width: 303, + height: 392, + color: "#175e7a", + }, + ], + types: [], + title: "Template 3", + description: + "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.", +}; diff --git a/src/templates/template4.js b/src/templates/template4.js new file mode 100644 index 0000000..178880a --- /dev/null +++ b/src/templates/template4.js @@ -0,0 +1,310 @@ +export const template4 = { + tables: [ + { + id: 0, + name: "table_0", + x: 23, + y: 26, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "name", + type: "VARCHAR", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: 255, + }, + ], + comment: "", + indices: [], + color: "#3cde7d", + }, + { + id: 1, + name: "table_1", + x: 21, + y: 281, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "age", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + { + name: "t_id", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + }, + ], + comment: "", + indices: [], + color: "#ffe159", + }, + { + id: 2, + name: "table_2", + x: 25, + y: 171, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#7c4af0", + }, + { + id: 3, + name: "table_3", + x: 258, + y: 28, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + { + id: 4, + name: "table_4", + x: 262, + y: 140, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "quantity", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + { + id: 5, + name: "table_5", + x: 552, + y: 333, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#7d9dff", + }, + { + id: 6, + name: "table_6", + x: 553, + y: 127, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "field", + type: "VARCHAR", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: 255, + }, + { + name: "type", + type: "ENUM", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + size: "", + values: ["hi", "hello"], + }, + ], + comment: "", + indices: [], + color: "#a751e8", + }, + ], + relationships: [ + { + startTableId: 1, + startFieldId: 2, + endTableId: 0, + endFieldId: 0, + startX: 36, + startY: 422, + endX: 38, + endY: 95, + name: "table_1_t_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 0, + }, + { + startTableId: 4, + startFieldId: 0, + endTableId: 5, + endFieldId: 0, + startX: 277, + startY: 209, + endX: 567, + endY: 402, + name: "table_4_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 1, + }, + ], + notes: [ + { + id: 0, + x: 558, + y: 21, + title: "note_0", + content: "hi", + color: "#fcf7ac", + height: 65, + }, + { + id: 1, + x: 268, + y: 308, + title: "note_1", + content: "", + color: "#c7d2ff", + height: 88, + }, + ], + subjectAreas: [ + { + id: 0, + name: "area_0", + x: -10, + y: -9, + width: 855, + height: 471, + color: "#7d9dff", + }, + ], + types: [], + title: "Template 4", + description: + "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.", +}; diff --git a/src/templates/template5.js b/src/templates/template5.js new file mode 100644 index 0000000..ba5cb2a --- /dev/null +++ b/src/templates/template5.js @@ -0,0 +1,268 @@ +export const template5 = { + tables: [ + { + id: 0, + name: "table_0", + x: 55, + y: 51, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "name", + type: "VARCHAR", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: 255, + }, + ], + comment: "", + indices: [], + color: "#3cde7d", + }, + { + id: 1, + name: "table_1", + x: 325, + y: 57, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "age", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + { + name: "t_id", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + }, + ], + comment: "", + indices: [], + color: "#ffe159", + }, + { + id: 2, + name: "table_2", + x: 52, + y: 191, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#7c4af0", + }, + { + id: 3, + name: "table_4", + x: 582, + y: 11, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "quantity", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + { + id: 4, + name: "table_5", + x: 584, + y: 337, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#7d9dff", + }, + { + id: 5, + name: "table_6", + x: 579, + y: 153, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "field", + type: "VARCHAR", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: 255, + }, + { + name: "type", + type: "ENUM", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + size: "", + values: ["hi", "hello"], + }, + ], + comment: "", + indices: [], + color: "#a751e8", + }, + ], + relationships: [ + { + startTableId: 1, + startFieldId: 2, + endTableId: 0, + endFieldId: 0, + startX: 340, + startY: 198, + endX: 70, + endY: 120, + name: "table_1_t_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 0, + }, + { + startTableId: 4, + startFieldId: 0, + endTableId: 5, + endFieldId: 0, + startX: 599, + startY: 406, + endX: 594, + endY: 222, + name: "table_4_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 1, + }, + ], + notes: [], + subjectAreas: [ + { + id: 0, + name: "area_0", + x: 24, + y: 10, + width: 533, + height: 291, + color: "#32c9b0", + }, + ], + types: [], + title: "Template 5", + description: + "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.", +}; diff --git a/src/templates/template6.js b/src/templates/template6.js new file mode 100644 index 0000000..ba094cc --- /dev/null +++ b/src/templates/template6.js @@ -0,0 +1,304 @@ +export const template6 = { + tables: [ + { + id: 0, + name: "table_0", + x: 55, + y: 23, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "name", + type: "VARCHAR", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: 255, + }, + ], + comment: "", + indices: [], + color: "#3cde7d", + }, + { + id: 1, + name: "table_1", + x: 322, + y: 145, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "age", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + { + name: "t_id", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + }, + ], + comment: "", + indices: [], + color: "#ffe159", + }, + { + id: 2, + name: "table_2", + x: 59, + y: 171, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#7c4af0", + }, + { + id: 3, + name: "table_4", + x: 580, + y: 28, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "quantity", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + { + id: 4, + name: "table_5", + x: 324, + y: 338, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#7d9dff", + }, + { + id: 5, + name: "table_6", + x: 62, + y: 287, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "field", + type: "VARCHAR", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: 255, + }, + { + name: "type", + type: "ENUM", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + size: "", + values: ["hi", "hello"], + }, + ], + comment: "", + indices: [], + color: "#a751e8", + }, + { + id: 6, + name: "table_6", + x: 580, + y: 182, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + { + id: 7, + name: "table_7", + x: 321, + y: 25, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + ], + relationships: [ + { + startTableId: 1, + startFieldId: 2, + endTableId: 0, + endFieldId: 0, + startX: 337, + startY: 286, + endX: 70, + endY: 92, + name: "table_1_t_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 0, + }, + { + startTableId: 4, + startFieldId: 0, + endTableId: 5, + endFieldId: 0, + startX: 339, + startY: 407, + endX: 77, + endY: 356, + name: "table_4_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 1, + }, + ], + notes: [], + subjectAreas: [], + types: [], + title: "Template 6", + description: + "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.", +}; diff --git a/src/templates/template7.js b/src/templates/template7.js new file mode 100644 index 0000000..1e1e012 --- /dev/null +++ b/src/templates/template7.js @@ -0,0 +1,314 @@ +export const template7 = { + tables: [ + { + id: 0, + name: "table_0", + x: 55, + y: 23, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "name", + type: "VARCHAR", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: 255, + }, + ], + comment: "", + indices: [], + color: "#f03c3c", + }, + { + id: 1, + name: "table_1", + x: 330, + y: 147, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "age", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + { + name: "t_id", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + }, + ], + comment: "", + indices: [], + color: "#3cde7d", + }, + { + id: 2, + name: "table_2", + x: 576, + y: 311, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#7c4af0", + }, + { + id: 3, + name: "table_4", + x: 580, + y: 28, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "quantity", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + ], + comment: "", + indices: [], + color: "#ff9159", + }, + { + id: 4, + name: "table_5", + x: 324, + y: 338, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#7d9dff", + }, + { + id: 5, + name: "table_6", + x: 58, + y: 284, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "field", + type: "VARCHAR", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: 255, + }, + { + name: "type", + type: "ENUM", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + size: "", + values: ["hi", "hello"], + }, + ], + comment: "", + indices: [], + color: "#ff4f81", + }, + { + id: 6, + name: "table_6", + x: 580, + y: 182, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + { + id: 7, + name: "table_7", + x: 324, + y: 26, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + ], + relationships: [ + { + startTableId: 1, + startFieldId: 2, + endTableId: 0, + endFieldId: 0, + startX: 345, + startY: 288, + endX: 70, + endY: 92, + name: "table_1_t_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 0, + }, + { + startTableId: 4, + startFieldId: 0, + endTableId: 5, + endFieldId: 0, + startX: 339, + startY: 407, + endX: 73, + endY: 353, + name: "table_4_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 1, + }, + ], + notes: [ + { + id: 0, + x: 60, + y: 181, + title: "note_0", + content: "bruh", + color: "#fcf7ac", + height: 65, + }, + ], + subjectAreas: [], + types: [], + title: "Template 7", + description: + "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.", +}; diff --git a/src/templates/template8.js b/src/templates/template8.js new file mode 100644 index 0000000..cb8baaa --- /dev/null +++ b/src/templates/template8.js @@ -0,0 +1,369 @@ +export const template8 = { + tables: [ + { + id: 0, + name: "table_0", + x: 55, + y: 23, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "name", + type: "VARCHAR", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: 255, + }, + ], + comment: "", + indices: [], + color: "#f03c3c", + }, + { + id: 1, + name: "table_1", + x: 331, + y: 147, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "age", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + { + name: "t_id", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + }, + ], + comment: "", + indices: [], + color: "#3cde7d", + }, + { + id: 2, + name: "table_2", + x: 57, + y: 171, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#7c4af0", + }, + { + id: 3, + name: "table_4", + x: 580, + y: 28, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "quantity", + type: "INT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + }, + ], + comment: "", + indices: [], + color: "#ff9159", + }, + { + id: 4, + name: "table_5", + x: 324, + y: 338, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#7d9dff", + }, + { + id: 5, + name: "table_6", + x: 58, + y: 284, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "field", + type: "VARCHAR", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: 255, + }, + { + name: "type", + type: "ENUM", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + size: "", + values: ["hi", "hello"], + }, + ], + comment: "", + indices: [], + color: "#ff4f81", + }, + { + id: 6, + name: "table_3", + x: 580, + y: 182, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + { + id: 7, + name: "table_7", + x: 324, + y: 26, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + ], + comment: "", + indices: [], + color: "#175e7a", + }, + { + id: 8, + name: "table_8", + x: 575, + y: 297, + fields: [ + { + name: "id", + type: "INT", + default: "", + check: "", + primary: true, + unique: true, + notNull: true, + increment: true, + comment: "", + id: 0, + }, + { + name: "field1", + type: "FLOAT", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 1, + size: "", + }, + { + name: "field2", + type: "DOUBLE", + default: "", + check: "", + primary: false, + unique: false, + notNull: false, + increment: false, + comment: "", + id: 2, + size: "", + }, + ], + comment: "", + indices: [], + color: "#ffe159", + }, + ], + relationships: [ + { + startTableId: 1, + startFieldId: 2, + endTableId: 0, + endFieldId: 0, + startX: 346, + startY: 288, + endX: 70, + endY: 92, + name: "table_1_t_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 0, + }, + { + startTableId: 4, + startFieldId: 0, + endTableId: 5, + endFieldId: 0, + startX: 339, + startY: 407, + endX: 73, + endY: 353, + name: "table_4_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 1, + }, + { + startTableId: 6, + startFieldId: 0, + endTableId: 8, + endFieldId: 0, + startX: 595, + startY: 251, + endX: 590, + endY: 366, + name: "table_3_id_fk", + cardinality: "One to one", + updateConstraint: "No action", + deleteConstraint: "No action", + mandatory: false, + id: 2, + }, + ], + notes: [], + subjectAreas: [], + types: [], + title: "Template 8", + description: + "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.", +};