Skip to content

Free, simple, and intuitive online database diagram editor and SQL generator.

Seed templates

1ilit141b303e50b8
diff --git a/src/components/Table.jsx b/src/components/Table.jsx
index 0ce26e38..ab3d433a 100644
--- a/src/components/Table.jsx
+++ b/src/components/Table.jsx
@@ -95,12 +95,12 @@ export default function Table(props) {
>
<div className="px-3">
{isHovered
- ? props.tableData.name.length < 10
+ ? props.tableData.name.length <= 10
? props.tableData.name
: `${props.tableData.name.substring(0, 10)}...`
- : props.tableData.name.length < 16
+ : props.tableData.name.length <= 18
? props.tableData.name
- : `${props.tableData.name.substring(0, 16)}...`}
+ : `${props.tableData.name.substring(0, 19)}...`}
</div>
{isHovered && (
<div className="flex justify-end items-center mx-2">
@@ -1275,9 +1275,9 @@ export default function Table(props) {
}));
}}
></button>
- {fieldData.name.length < 10
+ {fieldData.name.length <= 11
? fieldData.name
- : fieldData.name.substring(0, 10)}
+ : fieldData.name.substring(0, 11)}
</div>
<div className="text-zinc-400">
{hoveredField === index ? (
diff --git a/src/components/Thumbnail.jsx b/src/components/Thumbnail.jsx
index 60a8f0c2..c3fa5ad3 100644
--- a/src/components/Thumbnail.jsx
+++ b/src/components/Thumbnail.jsx
@@ -125,7 +125,7 @@ export function Thumbnail({ diagram, i, zoom }) {
)}
fill="none"
strokeWidth={1}
- stroke="gray"
+ stroke="#ddd"
/>
))}
{diagram.notes?.map((n) => {
diff --git a/src/data/seeds.js b/src/data/seeds.js
index 3069e7cf..67af9455 100644
--- a/src/data/seeds.js
+++ b/src/data/seeds.js
@@ -4,8 +4,6 @@ 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 templateSeeds = [
template1,
@@ -14,8 +12,6 @@ const templateSeeds = [
template4,
template5,
template6,
- template7,
- template8,
];
export { templateSeeds };
diff --git a/src/pages/Editor.jsx b/src/pages/Editor.jsx
index 4ef778cf..bcd56c31 100644
--- a/src/pages/Editor.jsx
+++ b/src/pages/Editor.jsx
@@ -640,8 +640,8 @@ export default function Editor() {
setNotes(diagram.notes);
setSettings((prev) => ({
...prev,
- pan: diagram.pan,
- zoom: diagram.zoom,
+ pan: {x: 0, y: 0},
+ zoom: 1,
}));
setUndoStack([]);
setRedoStack([]);
diff --git a/src/templates/template1.js b/src/templates/template1.js
index 4904b1ca..6069546d 100644
--- a/src/templates/template1.js
+++ b/src/templates/template1.js
@@ -2,9 +2,9 @@ export const template1 = {
tables: [
{
id: 0,
- name: "table_0",
- x: 23,
- y: 26,
+ name: "users",
+ x: 114.92525,
+ y: 281.2977500000002,
fields: [
{
name: "id",
@@ -19,7 +19,7 @@ export const template1 = {
id: 0,
},
{
- name: "name",
+ name: "username",
type: "VARCHAR",
default: "",
check: "",
@@ -31,16 +31,56 @@ export const template1 = {
id: 1,
size: 255,
},
+ {
+ name: "password",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ size: 255,
+ },
+ {
+ name: "email",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: 255,
+ },
+ {
+ name: "last_login",
+ type: "TIMESTAMP",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: "",
+ values: [],
+ },
],
comment: "",
indices: [],
- color: "#175e7a",
+ color: "#6360f7",
},
{
id: 1,
- name: "table_1",
- x: 301,
- y: 167,
+ name: "blog_posts",
+ x: 277.57925,
+ y: 19.206750000000113,
fields: [
{
name: "id",
@@ -55,7 +95,7 @@ export const template1 = {
id: 0,
},
{
- name: "age",
+ name: "user_id",
type: "INT",
default: "",
check: "",
@@ -67,8 +107,8 @@ export const template1 = {
id: 1,
},
{
- name: "t_id",
- type: "INT",
+ name: "title",
+ type: "VARCHAR",
default: "",
check: "",
primary: false,
@@ -77,17 +117,44 @@ export const template1 = {
increment: false,
comment: "",
id: 2,
+ size: 255,
+ },
+ {
+ name: "content",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: 255,
+ },
+ {
+ name: "cover",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: 255,
},
],
comment: "",
indices: [],
- color: "#175e7a",
+ color: "#bc49c4",
},
{
id: 2,
- name: "table_2",
- x: 594,
- y: 232,
+ name: "comments",
+ x: 505.62112500000035,
+ y: 341.6078750000002,
fields: [
{
name: "id",
@@ -101,55 +168,207 @@ export const template1 = {
comment: "",
id: 0,
},
+ {
+ name: "blog_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 1,
+ },
+ {
+ name: "user_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ },
+ {
+ name: "content",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: 255,
+ },
],
comment: "",
indices: [],
- color: "#175e7a",
+ color: "#3cde7d",
+ },
+ {
+ id: 3,
+ name: "tags",
+ x: 743.2832500000009,
+ y: 318.1841250000001,
+ 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: "#7d9dff",
+ },
+ {
+ id: 4,
+ name: "blog_tag",
+ x: 812.1175000000004,
+ y: 131.55062500000008,
+ fields: [
+ {
+ name: "blog_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: true,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 0,
+ },
+ {
+ name: "tag_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: true,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 1,
+ },
+ ],
+ comment: "",
+ indices: [],
+ color: "#ffe159",
},
],
relationships: [
{
startTableId: 1,
- startFieldId: 2,
+ startFieldId: 1,
endTableId: 0,
endFieldId: 0,
- startX: 316,
- startY: 308,
- endX: 38,
- endY: 95,
- name: "table_1_t_id_fk",
- cardinality: "One to one",
+ startX: 292.57925,
+ startY: 124.20675000000011,
+ endX: 129.92525,
+ endY: 350.2977500000002,
+ name: "blog_posts_user_id_fk",
+ cardinality: "Many 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,
+ startTableId: 2,
+ startFieldId: 1,
+ endTableId: 1,
+ endFieldId: 0,
+ startX: 520.6211250000003,
+ startY: 446.6078750000002,
+ endX: 292.57925,
+ endY: 88.20675000000011,
+ name: "comments_blog_id_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 1,
},
- ],
- subjectAreas: [
{
- id: 0,
- name: "area_0",
- x: 0,
- y: 0,
- width: 562,
- height: 390,
- color: "#175e7a",
+ startTableId: 2,
+ startFieldId: 2,
+ endTableId: 0,
+ endFieldId: 0,
+ startX: 520.6211250000003,
+ startY: 482.6078750000002,
+ endX: 129.92525,
+ endY: 350.2977500000002,
+ name: "comments_user_id_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 2,
+ },
+ {
+ startTableId: 4,
+ startFieldId: 1,
+ endTableId: 3,
+ endFieldId: 0,
+ startX: 827.1175000000004,
+ startY: 236.55062500000008,
+ endX: 758.2832500000009,
+ endY: 387.1841250000001,
+ name: "blog_tag_tag_id_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 3,
+ },
+ {
+ startTableId: 4,
+ startFieldId: 0,
+ endTableId: 1,
+ endFieldId: 0,
+ startX: 827.1175000000004,
+ startY: 200.55062500000008,
+ endX: 292.57925,
+ endY: 88.20675000000011,
+ name: "blog_tag_blog_id_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 4,
},
],
+ notes: [],
+ subjectAreas: [],
types: [],
- title: "Template 1",
+ title: "Blog database schema",
description:
- "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.",
+ "A blog database including tables such as posts, users, comments, and tags to facilitate the storage and retrieval of blog-related information.",
custom: 0,
};
diff --git a/src/templates/template2.js b/src/templates/template2.js
index 0960a2d8..91a040e0 100644
--- a/src/templates/template2.js
+++ b/src/templates/template2.js
@@ -2,9 +2,9 @@ export const template2 = {
tables: [
{
id: 0,
- name: "table_0",
- x: 23,
- y: 26,
+ name: "employees",
+ x: 365,
+ y: 20,
fields: [
{
name: "id",
@@ -19,7 +19,7 @@ export const template2 = {
id: 0,
},
{
- name: "name",
+ name: "first_name",
type: "VARCHAR",
default: "",
check: "",
@@ -31,16 +31,67 @@ export const template2 = {
id: 1,
size: 255,
},
+ {
+ name: "last_name",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ size: 255,
+ },
+ {
+ name: "dob",
+ type: "DATE",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: "",
+ values: [],
+ },
+ {
+ name: "dep_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ },
+ {
+ name: "pos_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 5,
+ },
],
comment: "",
indices: [],
- color: "#3cde7d",
+ color: "#a751e8",
},
{
id: 1,
- name: "table_1",
- x: 30,
- y: 178,
+ name: "department",
+ x: 41,
+ y: 59,
fields: [
{
name: "id",
@@ -55,39 +106,154 @@ export const template2 = {
id: 0,
},
{
- name: "age",
+ name: "name",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 1,
+ size: 255,
+ },
+ ],
+ comment: "",
+ indices: [],
+ color: "#6360f7",
+ },
+ {
+ id: 2,
+ name: "positions",
+ x: 37,
+ y: 284,
+ 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,
},
{
- name: "t_id",
+ name: "salary",
+ type: "DOUBLE",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ size: "",
+ },
+ ],
+ comment: "",
+ indices: [],
+ color: "#3cde7d",
+ },
+ {
+ id: 3,
+ name: "projects",
+ x: 668,
+ y: 28,
+ 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,
+ },
+ {
+ name: "description",
+ type: "TEXT",
+ default: "",
+ check: "",
primary: false,
unique: false,
notNull: false,
increment: false,
comment: "",
id: 2,
+ size: 65535,
+ },
+ {
+ name: "start_date",
+ type: "DATE",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: "",
+ values: [],
+ },
+ {
+ name: "end_date",
+ type: "DATE",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: "",
+ values: [],
},
],
comment: "",
indices: [],
- color: "#ffe159",
+ color: "#7d9dff",
},
{
- id: 2,
- name: "table_2",
- x: 336,
- y: 118,
+ id: 4,
+ name: "project_assignment",
+ x: 684,
+ y: 295,
fields: [
{
name: "id",
@@ -101,64 +267,107 @@ export const template2 = {
comment: "",
id: 0,
},
+ {
+ name: "project_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 1,
+ },
+ {
+ name: "employee_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ },
],
comment: "",
indices: [],
- color: "#7c4af0",
+ color: "#32c9b0",
},
],
relationships: [
{
- startTableId: 1,
- startFieldId: 2,
- endTableId: 0,
+ startTableId: 0,
+ startFieldId: 4,
+ endTableId: 1,
endFieldId: 0,
- startX: 45,
- startY: 319,
- endX: 38,
- endY: 95,
- name: "table_1_t_id_fk",
- cardinality: "One to one",
+ startX: 380,
+ startY: 233,
+ endX: 56,
+ endY: 128,
+ name: "employees_dep_id_fk",
+ cardinality: "Many 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,
+ startTableId: 0,
+ startFieldId: 5,
+ endTableId: 2,
+ endFieldId: 0,
+ startX: 380,
+ startY: 269,
+ endX: 52,
+ endY: 353,
+ name: "employees_pos_id_fk",
+ cardinality: "One to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 1,
},
{
- id: 1,
- x: 577,
- y: 254,
- title: "note_1",
- content: "",
- color: "#c7d2ff",
- height: 88,
+ startTableId: 4,
+ startFieldId: 1,
+ endTableId: 3,
+ endFieldId: 0,
+ startX: 699,
+ startY: 400,
+ endX: 683,
+ endY: 97,
+ name: "project_assignment_project_id_fk",
+ cardinality: "One to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 2,
},
- ],
- subjectAreas: [
{
- id: 0,
- name: "area_0",
- x: -10,
- y: -22,
- width: 562,
- height: 390,
- color: "#7c4af0",
+ startTableId: 4,
+ startFieldId: 2,
+ endTableId: 0,
+ endFieldId: 0,
+ startX: 699,
+ startY: 436,
+ endX: 380,
+ endY: 89,
+ name: "project_assignment_employee_id_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 3,
},
],
+ notes: [],
+ subjectAreas: [],
types: [],
- title: "Template 2",
+ title: "Human resources schema",
description:
- "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.",
+ "A Human Resources (HR) schema designed to manage employee and project related information within an organization.",
custom: 0,
};
diff --git a/src/templates/template3.js b/src/templates/template3.js
index 75f6d343..9734c221 100644
--- a/src/templates/template3.js
+++ b/src/templates/template3.js
@@ -2,9 +2,9 @@ export const template3 = {
tables: [
{
id: 0,
- name: "table_0",
- x: 23,
- y: 26,
+ name: "products",
+ x: 331,
+ y: 300,
fields: [
{
name: "id",
@@ -31,16 +31,54 @@ export const template3 = {
id: 1,
size: 255,
},
+ {
+ name: "description",
+ type: "TEXT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ size: 65535,
+ },
+ {
+ name: "price",
+ type: "DOUBLE",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: "",
+ },
+ {
+ name: "category_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ },
],
comment: "",
indices: [],
- color: "#3cde7d",
+ color: "#32c9b0",
},
{
id: 1,
- name: "table_1",
- x: 354,
- y: 144,
+ name: "categories",
+ x: 649,
+ y: 391,
fields: [
{
name: "id",
@@ -55,8 +93,8 @@ export const template3 = {
id: 0,
},
{
- name: "age",
- type: "INT",
+ name: "name",
+ type: "VARCHAR",
default: "",
check: "",
primary: false,
@@ -65,29 +103,18 @@ export const template3 = {
increment: false,
comment: "",
id: 1,
- },
- {
- name: "t_id",
- type: "INT",
- default: "",
- check: "",
- primary: false,
- unique: false,
- notNull: false,
- increment: false,
- comment: "",
- id: 2,
+ size: 255,
},
],
comment: "",
indices: [],
- color: "#ffe159",
+ color: "#89e667",
},
{
id: 2,
- name: "table_2",
- x: 25,
- y: 171,
+ name: "orders",
+ x: 756,
+ y: 47,
fields: [
{
name: "id",
@@ -101,16 +128,79 @@ export const template3 = {
comment: "",
id: 0,
},
+ {
+ name: "date",
+ type: "DATETIME",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 1,
+ size: "",
+ values: [],
+ },
+ {
+ name: "customer_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ },
+ {
+ name: "amount",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ },
+ {
+ name: "status",
+ type: "ENUM",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ values: ["delivered", "recieved", "processing"],
+ },
+ {
+ name: "product_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 5,
+ },
],
comment: "",
indices: [],
- color: "#7c4af0",
+ color: "#6360f7",
},
{
id: 3,
- name: "table_3",
- x: 356,
- y: 30,
+ name: "reviews",
+ x: 33,
+ y: 93,
fields: [
{
name: "id",
@@ -124,16 +214,79 @@ export const template3 = {
comment: "",
id: 0,
},
+ {
+ name: "customer_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 1,
+ },
+ {
+ name: "product_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ },
+ {
+ name: "rating",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ },
+ {
+ name: "content",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: 255,
+ },
+ {
+ name: "date",
+ type: "DATETIME",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 5,
+ size: "",
+ values: [],
+ },
],
comment: "",
indices: [],
- color: "#175e7a",
+ color: "#ffe159",
},
{
id: 4,
- name: "table_4",
- x: 628,
- y: 6,
+ name: "customers",
+ x: 402,
+ y: 16,
fields: [
{
name: "id",
@@ -148,8 +301,8 @@ export const template3 = {
id: 0,
},
{
- name: "quantity",
- type: "INT",
+ name: "name",
+ type: "VARCHAR",
default: "",
check: "",
primary: false,
@@ -158,74 +311,140 @@ export const template3 = {
increment: false,
comment: "",
id: 1,
+ size: 255,
+ },
+ {
+ name: "address",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ size: 255,
+ },
+ {
+ name: "email",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: 255,
+ },
+ {
+ name: "phone",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: 255,
},
],
comment: "",
indices: [],
- color: "#175e7a",
+ color: "#ff4f81",
},
],
relationships: [
{
- startTableId: 1,
- startFieldId: 2,
+ startTableId: 2,
+ startFieldId: 5,
endTableId: 0,
endFieldId: 0,
- startX: 369,
- startY: 285,
- endX: 38,
- endY: 95,
- name: "table_1_t_id_fk",
+ startX: 771,
+ startY: 296,
+ endX: 346,
+ endY: 369,
+ name: "order_product_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,
+ startTableId: 0,
+ startFieldId: 4,
+ endTableId: 1,
+ endFieldId: 0,
+ startX: 346,
+ startY: 513,
+ endX: 664,
+ endY: 460,
+ name: "products_category_id_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 1,
},
{
- id: 1,
- x: 635,
- y: 260,
- title: "note_1",
- content: "",
- color: "#c7d2ff",
- height: 88,
+ startTableId: 3,
+ startFieldId: 1,
+ endTableId: 4,
+ endFieldId: 0,
+ startX: 48,
+ startY: 198,
+ endX: 417,
+ endY: 85,
+ name: "reviews_customer_id_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 2,
},
- ],
- subjectAreas: [
{
- id: 0,
- name: "area_0",
- x: -10,
- y: -22,
- width: 264,
- height: 365,
- color: "#7c4af0",
+ startTableId: 3,
+ startFieldId: 2,
+ endTableId: 0,
+ endFieldId: 0,
+ startX: 48,
+ startY: 234,
+ endX: 346,
+ endY: 369,
+ name: "reviews_product_id_fk",
+ cardinality: "One to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 3,
},
{
- id: 1,
- name: "area_1",
- x: 289,
- y: -18,
- width: 303,
- height: 392,
- color: "#175e7a",
+ startTableId: 2,
+ startFieldId: 2,
+ endTableId: 4,
+ endFieldId: 0,
+ startX: 771,
+ startY: 188,
+ endX: 417,
+ endY: 85,
+ name: "orders_customer_id_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 4,
},
],
+ notes: [],
+ subjectAreas: [],
types: [],
- title: "Template 3",
+ title: "E-commerce schema",
description:
- "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.",
+ "An e-commerce schema designed to manage various aspects of an online store, including products, orders, and customers.",
custom: 0,
};
diff --git a/src/templates/template4.js b/src/templates/template4.js
index d2780eb5..7290859d 100644
--- a/src/templates/template4.js
+++ b/src/templates/template4.js
@@ -2,9 +2,9 @@ export const template4 = {
tables: [
{
id: 0,
- name: "table_0",
- x: 23,
- y: 26,
+ name: "books",
+ x: 167,
+ y: 88,
fields: [
{
name: "id",
@@ -19,7 +19,7 @@ export const template4 = {
id: 0,
},
{
- name: "name",
+ name: "title",
type: "VARCHAR",
default: "",
check: "",
@@ -31,31 +31,21 @@ export const template4 = {
id: 1,
size: 255,
},
- ],
- comment: "",
- indices: [],
- color: "#3cde7d",
- },
- {
- id: 1,
- name: "table_1",
- x: 21,
- y: 281,
- fields: [
{
- name: "id",
- type: "INT",
+ name: "isbn",
+ type: "VARCHAR",
default: "",
check: "",
- primary: true,
- unique: true,
- notNull: true,
- increment: true,
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
comment: "",
- id: 0,
+ id: 2,
+ size: 255,
},
{
- name: "age",
+ name: "author_id",
type: "INT",
default: "",
check: "",
@@ -64,10 +54,10 @@ export const template4 = {
notNull: false,
increment: false,
comment: "",
- id: 1,
+ id: 3,
},
{
- name: "t_id",
+ name: "genre_id",
type: "INT",
default: "",
check: "",
@@ -76,18 +66,18 @@ export const template4 = {
notNull: false,
increment: false,
comment: "",
- id: 2,
+ id: 4,
},
],
comment: "",
indices: [],
- color: "#ffe159",
+ color: "#6360f7",
},
{
- id: 2,
- name: "table_2",
- x: 25,
- y: 171,
+ id: 1,
+ name: "genres",
+ x: 78,
+ y: 379,
fields: [
{
name: "id",
@@ -101,16 +91,29 @@ export const template4 = {
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: "#7c4af0",
+ color: "#bc49c4",
},
{
- id: 3,
- name: "table_3",
- x: 258,
- y: 28,
+ id: 2,
+ name: "authors",
+ x: 475,
+ y: 342,
fields: [
{
name: "id",
@@ -124,16 +127,56 @@ export const template4 = {
comment: "",
id: 0,
},
+ {
+ name: "name",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 1,
+ size: 255,
+ },
+ {
+ name: "birthday",
+ type: "DATE",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ size: "",
+ values: [],
+ },
+ {
+ name: "nationality",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: 255,
+ },
],
comment: "",
indices: [],
- color: "#175e7a",
+ color: "#ffe159",
},
{
- id: 4,
- name: "table_4",
- x: 262,
- y: 140,
+ id: 3,
+ name: "reservations",
+ x: 501,
+ y: 14,
fields: [
{
name: "id",
@@ -148,7 +191,7 @@ export const template4 = {
id: 0,
},
{
- name: "quantity",
+ name: "book_id",
type: "INT",
default: "",
check: "",
@@ -159,39 +202,55 @@ export const template4 = {
comment: "",
id: 1,
},
- ],
- comment: "",
- indices: [],
- color: "#175e7a",
- },
- {
- id: 5,
- name: "table_5",
- x: 552,
- y: 333,
- fields: [
{
- name: "id",
+ name: "patron_id",
type: "INT",
default: "",
check: "",
- primary: true,
- unique: true,
- notNull: true,
- increment: true,
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
comment: "",
- id: 0,
+ id: 2,
+ },
+ {
+ name: "date",
+ type: "DATE",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: "",
+ values: [],
+ },
+ {
+ name: "email",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: 255,
},
],
comment: "",
indices: [],
- color: "#7d9dff",
+ color: "#89e667",
},
{
- id: 6,
- name: "table_6",
- x: 553,
- y: 127,
+ id: 4,
+ name: "patrons",
+ x: 780,
+ y: 220,
fields: [
{
name: "id",
@@ -206,7 +265,7 @@ export const template4 = {
id: 0,
},
{
- name: "field",
+ name: "name",
type: "VARCHAR",
default: "",
check: "",
@@ -219,8 +278,8 @@ export const template4 = {
size: 255,
},
{
- name: "type",
- type: "ENUM",
+ name: "email",
+ type: "VARCHAR",
default: "",
check: "",
primary: false,
@@ -229,83 +288,98 @@ export const template4 = {
increment: false,
comment: "",
id: 2,
- size: "",
- values: ["hi", "hello"],
+ size: 255,
+ },
+ {
+ name: "phone",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: 255,
},
],
comment: "",
indices: [],
- color: "#a751e8",
+ color: "#ff9159",
},
],
relationships: [
{
- startTableId: 1,
- startFieldId: 2,
- endTableId: 0,
+ startTableId: 0,
+ startFieldId: 3,
+ endTableId: 2,
endFieldId: 0,
- startX: 36,
- startY: 422,
- endX: 38,
- endY: 95,
- name: "table_1_t_id_fk",
- cardinality: "One to one",
+ startX: 182,
+ startY: 265,
+ endX: 490,
+ endY: 411,
+ name: "books_author_id_fk",
+ cardinality: "Many to one",
updateConstraint: "No action",
deleteConstraint: "No action",
mandatory: false,
id: 0,
},
{
- startTableId: 4,
- startFieldId: 0,
- endTableId: 5,
+ startTableId: 3,
+ startFieldId: 1,
+ endTableId: 0,
endFieldId: 0,
- startX: 277,
- startY: 209,
- endX: 567,
- endY: 402,
- name: "table_4_id_fk",
+ startX: 516,
+ startY: 119,
+ endX: 182,
+ endY: 157,
+ name: "reservations_book_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,
+ startTableId: 3,
+ startFieldId: 2,
+ endTableId: 4,
+ endFieldId: 0,
+ startX: 516,
+ startY: 155,
+ endX: 795,
+ endY: 289,
+ name: "reservations_patron_id_fk",
+ cardinality: "One to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 2,
},
- ],
- subjectAreas: [
{
- id: 0,
- name: "area_0",
- x: -10,
- y: -9,
- width: 855,
- height: 471,
- color: "#7d9dff",
+ startTableId: 0,
+ startFieldId: 4,
+ endTableId: 1,
+ endFieldId: 0,
+ startX: 182,
+ startY: 301,
+ endX: 93,
+ endY: 448,
+ name: "books_genre_id_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 3,
},
],
+ notes: [],
+ subjectAreas: [],
types: [],
- title: "Template 4",
+ title: "Library schema",
description:
- "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.",
+ "A library schema designed to manage the books, genres, reservations, and other aspects of a library system",
custom: 0,
};
diff --git a/src/templates/template5.js b/src/templates/template5.js
index e7275f94..d0b7c5da 100644
--- a/src/templates/template5.js
+++ b/src/templates/template5.js
@@ -2,9 +2,9 @@ export const template5 = {
tables: [
{
id: 0,
- name: "table_0",
- x: 55,
- y: 51,
+ name: "accounts",
+ x: 129,
+ y: 92,
fields: [
{
name: "id",
@@ -19,8 +19,8 @@ export const template5 = {
id: 0,
},
{
- name: "name",
- type: "VARCHAR",
+ name: "customer_id",
+ type: "INT",
default: "",
check: "",
primary: false,
@@ -29,18 +29,55 @@ export const template5 = {
increment: false,
comment: "",
id: 1,
- size: 255,
+ },
+ {
+ name: "type",
+ type: "ENUM",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ values: ["checking", "savings"],
+ },
+ {
+ name: "number",
+ type: "BIGINT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ },
+ {
+ name: "balance",
+ type: "FLOAT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: "",
},
],
comment: "",
indices: [],
- color: "#3cde7d",
+ color: "#7d9dff",
},
{
id: 1,
- name: "table_1",
- x: 325,
- y: 57,
+ name: "customers",
+ x: 384,
+ y: 315,
fields: [
{
name: "id",
@@ -55,8 +92,8 @@ export const template5 = {
id: 0,
},
{
- name: "age",
- type: "INT",
+ name: "first_name",
+ type: "VARCHAR",
default: "",
check: "",
primary: false,
@@ -65,10 +102,11 @@ export const template5 = {
increment: false,
comment: "",
id: 1,
+ size: 255,
},
{
- name: "t_id",
- type: "INT",
+ name: "last_name",
+ type: "VARCHAR",
default: "",
check: "",
primary: false,
@@ -77,17 +115,44 @@ export const template5 = {
increment: false,
comment: "",
id: 2,
+ size: 255,
+ },
+ {
+ name: "phone",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: 255,
+ },
+ {
+ name: "address",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: 255,
},
],
comment: "",
indices: [],
- color: "#ffe159",
+ color: "#32c9b0",
},
{
id: 2,
- name: "table_2",
- x: 52,
- y: 191,
+ name: "transactions",
+ x: 431,
+ y: 4,
fields: [
{
name: "id",
@@ -101,16 +166,68 @@ export const template5 = {
comment: "",
id: 0,
},
+ {
+ name: "account_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 1,
+ },
+ {
+ name: "time",
+ type: "DATETIME",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ size: "",
+ values: [],
+ },
+ {
+ name: "type",
+ type: "ENUM",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ values: ["withdrawal", "deposit"],
+ },
+ {
+ name: "amount",
+ type: "FLOAT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: "",
+ },
],
comment: "",
indices: [],
- color: "#7c4af0",
+ color: "#3cde7d",
},
{
id: 3,
- name: "table_4",
- x: 582,
- y: 11,
+ name: "transfers",
+ x: 112,
+ y: 358,
fields: [
{
name: "id",
@@ -125,7 +242,7 @@ export const template5 = {
id: 0,
},
{
- name: "quantity",
+ name: "from",
type: "INT",
default: "",
check: "",
@@ -136,16 +253,55 @@ export const template5 = {
comment: "",
id: 1,
},
+ {
+ name: "to",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ },
+ {
+ name: "time",
+ type: "DATETIME",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: "",
+ values: [],
+ },
+ {
+ name: "amount",
+ type: "FLOAT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: "",
+ },
],
comment: "",
indices: [],
- color: "#175e7a",
+ color: "#89e667",
},
{
id: 4,
- name: "table_5",
- x: 584,
- y: 337,
+ name: "cards",
+ x: 772,
+ y: 29,
fields: [
{
name: "id",
@@ -159,16 +315,66 @@ export const template5 = {
comment: "",
id: 0,
},
+ {
+ name: "type",
+ type: "ENUM",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 1,
+ values: ["visa", "master"],
+ },
+ {
+ name: "customer_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ },
+ {
+ name: "number",
+ type: "BIGINT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ },
+ {
+ name: "limit",
+ type: "FLOAT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: "",
+ },
],
comment: "",
indices: [],
- color: "#7d9dff",
+ color: "#ffe159",
},
{
id: 5,
- name: "table_6",
- x: 579,
- y: 153,
+ name: "loans",
+ x: 919,
+ y: 281,
fields: [
{
name: "id",
@@ -183,8 +389,96 @@ export const template5 = {
id: 0,
},
{
- name: "field",
- type: "VARCHAR",
+ name: "customer_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 1,
+ },
+ {
+ name: "amount",
+ type: "FLOAT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ size: "",
+ },
+ {
+ name: "rate",
+ type: "FLOAT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: "",
+ },
+ {
+ name: "term",
+ type: "DATE",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: "",
+ values: [],
+ },
+ {
+ name: "status",
+ type: "ENUM",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 5,
+ values: ["paid", "approved"],
+ },
+ ],
+ comment: "",
+ indices: [],
+ color: "#ff9159",
+ },
+ {
+ id: 6,
+ name: "investments",
+ x: 664,
+ y: 395,
+ fields: [
+ {
+ name: "id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: true,
+ unique: true,
+ notNull: true,
+ increment: true,
+ comment: "",
+ id: 0,
+ },
+ {
+ name: "customer_id",
+ type: "INT",
default: "",
check: "",
primary: false,
@@ -193,7 +487,6 @@ export const template5 = {
increment: false,
comment: "",
id: 1,
- size: 255,
},
{
name: "type",
@@ -206,27 +499,66 @@ export const template5 = {
increment: false,
comment: "",
id: 2,
+ values: ["mutual-fund", "stock"],
+ },
+ {
+ name: "amount",
+ type: "FLOAT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: "",
+ },
+ {
+ name: "date",
+ type: "DATE",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: "",
+ values: [],
+ },
+ {
+ name: "current_val",
+ type: "FLOAT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 5,
size: "",
- values: ["hi", "hello"],
},
],
comment: "",
indices: [],
- color: "#a751e8",
+ color: "#f03c3c",
},
],
relationships: [
{
- startTableId: 1,
- startFieldId: 2,
- endTableId: 0,
+ startTableId: 0,
+ startFieldId: 1,
+ endTableId: 1,
endFieldId: 0,
- startX: 340,
- startY: 198,
- endX: 70,
- endY: 120,
- name: "table_1_t_id_fk",
- cardinality: "One to one",
+ startX: 144,
+ startY: 197,
+ endX: 399,
+ endY: 384,
+ name: "accounts_customer_id_fk",
+ cardinality: "Many to one",
updateConstraint: "No action",
deleteConstraint: "No action",
mandatory: false,
@@ -234,36 +566,106 @@ export const template5 = {
},
{
startTableId: 4,
- startFieldId: 0,
- endTableId: 5,
+ startFieldId: 2,
+ endTableId: 1,
endFieldId: 0,
- startX: 599,
- startY: 406,
- endX: 594,
- endY: 222,
- name: "table_4_id_fk",
- cardinality: "One to one",
+ startX: 787,
+ startY: 170,
+ endX: 399,
+ endY: 384,
+ name: "cards_customer_id_fk",
+ cardinality: "Many 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",
+ startTableId: 5,
+ startFieldId: 1,
+ endTableId: 1,
+ endFieldId: 0,
+ startX: 934,
+ startY: 386,
+ endX: 399,
+ endY: 384,
+ name: "loans_customer_id_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 2,
+ },
+ {
+ startTableId: 6,
+ startFieldId: 1,
+ endTableId: 1,
+ endFieldId: 0,
+ startX: 679,
+ startY: 500,
+ endX: 399,
+ endY: 384,
+ name: "investments_customer_id_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 3,
+ },
+ {
+ startTableId: 2,
+ startFieldId: 1,
+ endTableId: 0,
+ endFieldId: 0,
+ startX: 446,
+ startY: 109,
+ endX: 144,
+ endY: 161,
+ name: "transactions_account_id_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 4,
+ },
+ {
+ startTableId: 3,
+ startFieldId: 2,
+ endTableId: 0,
+ endFieldId: 0,
+ startX: 127,
+ startY: 499,
+ endX: 144,
+ endY: 161,
+ name: "transfers_to_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 5,
+ },
+ {
+ startTableId: 3,
+ startFieldId: 1,
+ endTableId: 0,
+ endFieldId: 0,
+ startX: 127,
+ startY: 463,
+ endX: 144,
+ endY: 161,
+ name: "transfers_from_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 6,
},
],
+ notes: [],
+ subjectAreas: [],
types: [],
- title: "Template 5",
+ title: "Bank schema",
description:
- "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.",
+ "A financial schema designed to manage financial transactions, accounts, customers, and other aspects of financial data.",
custom: 0,
};
diff --git a/src/templates/template6.js b/src/templates/template6.js
index d4426a17..046cd6be 100644
--- a/src/templates/template6.js
+++ b/src/templates/template6.js
@@ -2,9 +2,9 @@ export const template6 = {
tables: [
{
id: 0,
- name: "table_0",
- x: 55,
- y: 23,
+ name: "students",
+ x: 200,
+ y: 10,
fields: [
{
name: "id",
@@ -19,7 +19,7 @@ export const template6 = {
id: 0,
},
{
- name: "name",
+ name: "first_name",
type: "VARCHAR",
default: "",
check: "",
@@ -31,16 +31,94 @@ export const template6 = {
id: 1,
size: 255,
},
+ {
+ name: "last_name",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ size: 255,
+ },
+ {
+ name: "email",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: 255,
+ },
+ {
+ name: "phone",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 4,
+ size: 255,
+ },
+ {
+ name: "address",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 5,
+ size: 255,
+ },
+ {
+ name: "dob",
+ type: "DATE",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 6,
+ size: "",
+ values: [],
+ },
+ {
+ name: "major_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 7,
+ },
],
comment: "",
indices: [],
- color: "#3cde7d",
+ color: "#ff4f81",
},
{
id: 1,
- name: "table_1",
- x: 322,
- y: 145,
+ name: "courses",
+ x: 477,
+ y: 354,
fields: [
{
name: "id",
@@ -55,8 +133,8 @@ export const template6 = {
id: 0,
},
{
- name: "age",
- type: "INT",
+ name: "name",
+ type: "VARCHAR",
default: "",
check: "",
primary: false,
@@ -65,9 +143,10 @@ export const template6 = {
increment: false,
comment: "",
id: 1,
+ size: 255,
},
{
- name: "t_id",
+ name: "dep_id",
type: "INT",
default: "",
check: "",
@@ -78,16 +157,28 @@ export const template6 = {
comment: "",
id: 2,
},
+ {
+ name: "credits",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ },
],
comment: "",
indices: [],
- color: "#ffe159",
+ color: "#bc49c4",
},
{
id: 2,
- name: "table_2",
- x: 59,
- y: 171,
+ name: "enrollment",
+ x: 81,
+ y: 377,
fields: [
{
name: "id",
@@ -101,6 +192,43 @@ export const template6 = {
comment: "",
id: 0,
},
+ {
+ name: "course_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 1,
+ },
+ {
+ name: "student_id",
+ type: "INT",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ },
+ {
+ name: "term",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: 255,
+ },
],
comment: "",
indices: [],
@@ -108,9 +236,9 @@ export const template6 = {
},
{
id: 3,
- name: "table_4",
- x: 580,
- y: 28,
+ name: "instructors",
+ x: 771,
+ y: 50,
fields: [
{
name: "id",
@@ -125,8 +253,8 @@ export const template6 = {
id: 0,
},
{
- name: "quantity",
- type: "INT",
+ name: "first_name",
+ type: "VARCHAR",
default: "",
check: "",
primary: false,
@@ -135,29 +263,45 @@ export const template6 = {
increment: false,
comment: "",
id: 1,
+ size: 255,
},
- ],
- comment: "",
- indices: [],
- color: "#175e7a",
- },
- {
- id: 4,
- name: "table_5",
- x: 324,
- y: 338,
- fields: [
{
- name: "id",
+ name: "last_name",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 2,
+ size: 255,
+ },
+ {
+ name: "email",
+ type: "VARCHAR",
+ default: "",
+ check: "",
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
+ comment: "",
+ id: 3,
+ size: 255,
+ },
+ {
+ name: "dep_id",
type: "INT",
default: "",
check: "",
- primary: true,
- unique: true,
- notNull: true,
- increment: true,
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
comment: "",
- id: 0,
+ id: 4,
},
],
comment: "",
@@ -165,10 +309,10 @@ export const template6 = {
color: "#7d9dff",
},
{
- id: 5,
- name: "table_6",
- x: 62,
- y: 287,
+ id: 4,
+ name: "departments",
+ x: 785,
+ y: 338,
fields: [
{
name: "id",
@@ -183,7 +327,7 @@ export const template6 = {
id: 0,
},
{
- name: "field",
+ name: "name",
type: "VARCHAR",
default: "",
check: "",
@@ -196,8 +340,8 @@ export const template6 = {
size: 255,
},
{
- name: "type",
- type: "ENUM",
+ name: "chairperson",
+ type: "INT",
default: "",
check: "",
primary: false,
@@ -206,19 +350,17 @@ export const template6 = {
increment: false,
comment: "",
id: 2,
- size: "",
- values: ["hi", "hello"],
},
],
comment: "",
indices: [],
- color: "#a751e8",
+ color: "#32c9b0",
},
{
- id: 6,
- name: "table_6",
- x: 580,
- y: 182,
+ id: 5,
+ name: "major",
+ x: 495,
+ y: 78,
fields: [
{
name: "id",
@@ -232,74 +374,112 @@ export const template6 = {
comment: "",
id: 0,
},
- ],
- comment: "",
- indices: [],
- color: "#175e7a",
- },
- {
- id: 7,
- name: "table_7",
- x: 321,
- y: 25,
- fields: [
{
- name: "id",
- type: "INT",
+ name: "name",
+ type: "VARCHAR",
default: "",
check: "",
- primary: true,
- unique: true,
- notNull: true,
- increment: true,
+ primary: false,
+ unique: false,
+ notNull: false,
+ increment: false,
comment: "",
- id: 0,
+ id: 1,
+ size: 255,
},
],
comment: "",
indices: [],
- color: "#175e7a",
+ color: "#ffe159",
},
],
relationships: [
{
- startTableId: 1,
+ startTableId: 2,
startFieldId: 2,
endTableId: 0,
endFieldId: 0,
- startX: 337,
- startY: 286,
- endX: 70,
- endY: 92,
- name: "table_1_t_id_fk",
- cardinality: "One to one",
+ startX: 96,
+ startY: 518,
+ endX: 215,
+ endY: 79,
+ name: "enrollment_student_id_fk",
+ cardinality: "Many to one",
updateConstraint: "No action",
deleteConstraint: "No action",
mandatory: false,
id: 0,
},
{
- startTableId: 4,
- startFieldId: 0,
- endTableId: 5,
+ startTableId: 2,
+ startFieldId: 1,
+ endTableId: 1,
endFieldId: 0,
- startX: 339,
- startY: 407,
- endX: 77,
- endY: 356,
- name: "table_4_id_fk",
- cardinality: "One to one",
+ startX: 96,
+ startY: 482,
+ endX: 492,
+ endY: 423,
+ name: "enrollment_course_id_fk",
+ cardinality: "Many to one",
updateConstraint: "No action",
deleteConstraint: "No action",
mandatory: false,
id: 1,
},
+ {
+ startTableId: 3,
+ startFieldId: 4,
+ endTableId: 4,
+ endFieldId: 0,
+ startX: 786,
+ startY: 263,
+ endX: 800,
+ endY: 407,
+ name: "instructors_dep_id_fk",
+ cardinality: "One to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 2,
+ },
+ {
+ startTableId: 1,
+ startFieldId: 2,
+ endTableId: 4,
+ endFieldId: 0,
+ startX: 492,
+ startY: 495,
+ endX: 800,
+ endY: 407,
+ name: "courses_dep_id_fk",
+ cardinality: "One to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 3,
+ },
+ {
+ startTableId: 0,
+ startFieldId: 7,
+ endTableId: 5,
+ endFieldId: 0,
+ startX: 215,
+ startY: 331,
+ endX: 510,
+ endY: 147,
+ name: "students_major_id_fk",
+ cardinality: "Many to one",
+ updateConstraint: "No action",
+ deleteConstraint: "No action",
+ mandatory: false,
+ id: 4,
+ },
],
notes: [],
subjectAreas: [],
types: [],
- title: "Template 6",
+ title: "University schema",
description:
- "Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam nulla illo pariatur nostrum.",
+ "A university schema designed to manage information about students, courses, instructors, and other aspects of university-related data.",
custom: 0,
};
diff --git a/src/templates/template7.js b/src/templates/template7.js
deleted file mode 100644
index bcff0aa4..00000000
--- a/src/templates/template7.js
+++ /dev/null
@@ -1,315 +0,0 @@
-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.",
- custom: 0,
-};
diff --git a/src/templates/template8.js b/src/templates/template8.js
deleted file mode 100644
index b4fb9393..00000000
--- a/src/templates/template8.js
+++ /dev/null
@@ -1,370 +0,0 @@
-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.",
- custom: 0,
-};