Skip to content

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

add examples

Guy Ben-Aharona37a36889a6d
diff --git a/src/assets/examples/bike_stores_example.png b/src/assets/examples/bike_stores_example.png
new file mode 100644
index 00000000..eef49acc
Binary files /dev/null and b/src/assets/examples/bike_stores_example.png differ
diff --git a/src/assets/examples/dvd_rental_example.png b/src/assets/examples/dvd_rental_example.png
new file mode 100644
index 00000000..fc44a2e5
Binary files /dev/null and b/src/assets/examples/dvd_rental_example.png differ
diff --git a/src/assets/examples/employees_example.png b/src/assets/examples/employees_example.png
new file mode 100644
index 00000000..d628782e
Binary files /dev/null and b/src/assets/examples/employees_example.png differ
diff --git a/src/context/chartdb-context/chartdb-provider.tsx b/src/context/chartdb-context/chartdb-provider.tsx
index 4bd9bbca..482ea75d 100644
--- a/src/context/chartdb-context/chartdb-provider.tsx
+++ b/src/context/chartdb-context/chartdb-provider.tsx
@@ -52,6 +52,8 @@ export const ChartDBProvider: React.FC<React.PropsWithChildren> = ({
]
);
+ console.log(JSON.stringify(currentDiagram));
+
const clearDiagramData: ChartDBContext['clearDiagramData'] =
useCallback(async () => {
const updatedAt = new Date();
diff --git a/src/pages/examples-page/example-card.tsx b/src/pages/examples-page/example-card.tsx
new file mode 100644
index 00000000..6b0fa05d
--- /dev/null
+++ b/src/pages/examples-page/example-card.tsx
@@ -0,0 +1,96 @@
+import React, { useCallback } from 'react';
+import { Example } from './examples-data/examples-data';
+import { randomColor } from '@/lib/colors';
+import { Import } from 'lucide-react';
+import { Label } from '@/components/label/label';
+import { Button } from '@/components/button/button';
+import {
+ databaseSecondaryLogoMap,
+ databaseTypeToLabelMap,
+} from '@/lib/databases';
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@/components/tooltip/tooltip';
+import { useStorage } from '@/hooks/use-storage';
+import { Diagram } from '@/lib/domain/diagram';
+import { useNavigate } from 'react-router-dom';
+
+export interface ExampleCardProps {
+ example: Example;
+}
+
+export const ExampleCard: React.FC<ExampleCardProps> = ({ example }) => {
+ const navigate = useNavigate();
+ const { addDiagram, deleteDiagram } = useStorage();
+ const { diagram } = example;
+ const utilizeExample = useCallback(async () => {
+ const { id } = diagram;
+
+ await deleteDiagram(id);
+
+ const now = new Date();
+ const diagramToAdd: Diagram = {
+ ...diagram,
+ createdAt: now,
+ updatedAt: now,
+ };
+
+ await addDiagram({ diagram: diagramToAdd });
+ navigate(`/diagrams/${id}`);
+ }, [addDiagram, diagram, navigate, deleteDiagram]);
+ return (
+ <div
+ onClick={utilizeExample}
+ className="h-96 rounded-xl flex flex-col w-full bg-slate-50 border-2 border-slate-500 hover:border-pink-600 shadow-sm cursor-pointer transition ease-in-out duration-300 hover:scale-[102%]"
+ >
+ <div
+ className="h-4 rounded-t-xl"
+ style={{ backgroundColor: randomColor() }}
+ ></div>
+ <div className="flex items-center h-12 bg-slate-200 px-2 justify-between">
+ <div className="flex items-center gap-2">
+ <Tooltip>
+ <TooltipTrigger className="mr-1">
+ <img
+ src={
+ databaseSecondaryLogoMap[
+ example.diagram.databaseType
+ ]
+ }
+ className="h-5 max-w-fit"
+ alt="database"
+ />
+ </TooltipTrigger>
+ <TooltipContent>
+ {
+ databaseTypeToLabelMap[
+ example.diagram.databaseType
+ ]
+ }
+ </TooltipContent>
+ </Tooltip>
+ <Label className="text-md font-bold cursor-pointer">
+ {example.name}
+ </Label>
+ </div>
+ <div className="flex-row flex">
+ <Button
+ variant="ghost"
+ className="hover:bg-primary-foreground p-0 w-9 h-9 text-slate-500 hover:text-slate-700"
+ // onClick={openTableInEditor}
+ >
+ <Import className="h-5 w-5" />
+ </Button>
+ </div>
+ </div>
+ <img
+ src={example.image}
+ alt={example.name}
+ className="w-fit border-b"
+ />
+ <div className="flex p-2 text-md">{example.description}</div>
+ </div>
+ );
+};
diff --git a/src/pages/examples-page/examples-data/examples-data.ts b/src/pages/examples-page/examples-data/examples-data.ts
new file mode 100644
index 00000000..1eb82ec8
--- /dev/null
+++ b/src/pages/examples-page/examples-data/examples-data.ts
@@ -0,0 +1,2885 @@
+import { Diagram } from '@/lib/domain/diagram';
+import EmployeeExample from '../../../assets/examples/employees_example.png';
+import BikeStoresExample from '../../../assets/examples/bike_stores_example.png';
+import DVDRentalExample from '../../../assets/examples/dvd_rental_example.png';
+import { DatabaseType } from '@/lib/domain/database-type';
+
+export interface Example {
+ id: string;
+ name: string;
+ description: string;
+ image: string;
+ diagram: Diagram;
+}
+
+export const examples: Example[] = [
+ {
+ id: '1',
+ name: 'Employees schema',
+ description:
+ 'A schema for database of employees, departments, and salaries.',
+ image: EmployeeExample,
+ diagram: {
+ id: 'diagramexample01',
+ name: 'employees-db',
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ databaseType: DatabaseType.MYSQL,
+ tables: [
+ {
+ id: '6e70s6dhdfnve9xljbih6bo7x',
+ name: 'departments',
+ x: 488.2056573620456,
+ y: -116.26128764468365,
+ fields: [
+ {
+ id: 'gaj3scrtaz46ezfmc162ingxf',
+ name: 'dept_no',
+ type: 'char',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ characterMaximumLength: '4',
+ collation: 'utf8mb4_general_ci',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'pb0j4xvevy9dics5euelx7ay9',
+ name: 'dept_name',
+ type: 'varchar',
+ primaryKey: false,
+ unique: true,
+ nullable: false,
+ characterMaximumLength: '40',
+ collation: 'utf8mb4_general_ci',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: '87iu197demih0wymjooqm9dmh',
+ name: 'PRIMARY',
+ unique: true,
+ fieldIds: ['gaj3scrtaz46ezfmc162ingxf'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ltt6su8loqpf29ok7okzqblg2',
+ name: 'dept_name',
+ unique: true,
+ fieldIds: ['pb0j4xvevy9dics5euelx7ay9'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#b067e9',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'rkc38w1yqrvhz2pmveunp6nsw',
+ name: 'dept_emp',
+ x: 809.6786878331093,
+ y: 13.918352368775231,
+ fields: [
+ {
+ id: 'wcgycjif09xrq0ly3txkq6ocu',
+ name: 'emp_no',
+ type: 'int',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'jdw1yrh9xf1i7927gzs9pob2p',
+ name: 'dept_no',
+ type: 'char',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ characterMaximumLength: '4',
+ collation: 'utf8mb4_general_ci',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'm3zu12iy2jmfraliisks0rqcv',
+ name: 'from_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'yq4k0bqt39aap0956aejicud4',
+ name: 'to_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'rqb91465yc51xpvd54o5a8d0l',
+ name: 'PRIMARY',
+ unique: true,
+ fieldIds: ['wcgycjif09xrq0ly3txkq6ocu'],
+ createdAt: Date.now(),
+ },
+ {
+ id: '8wh6op49abv143qdfjzm211xj',
+ name: 'PRIMARY',
+ unique: true,
+ fieldIds: ['jdw1yrh9xf1i7927gzs9pob2p'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'iw9hjbmuchq0jisgd8zb13qy6',
+ name: 'dept_no',
+ unique: false,
+ fieldIds: ['jdw1yrh9xf1i7927gzs9pob2p'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#8a61f5',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'd2xqiqlffjfsg3kgsmpck5xay',
+ name: 'dept_manager',
+ x: -248.93599999999998,
+ y: -84.16474999999997,
+ fields: [
+ {
+ id: 'ecx2zbzdc5o54e04aeg7tlg54',
+ name: 'emp_no',
+ type: 'int',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'v8plj7wq1cly03y178bysft2f',
+ name: 'dept_no',
+ type: 'char',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ characterMaximumLength: '4',
+ collation: 'utf8mb4_general_ci',
+ createdAt: Date.now(),
+ },
+ {
+ id: '3u0rfkvw0yokndqhfqx0nuzpi',
+ name: 'from_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'xrcw2488t50shssn4vn3n6vad',
+ name: 'to_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'cbahnbrxaaj7cg29act50izy4',
+ name: 'PRIMARY',
+ unique: true,
+ fieldIds: ['ecx2zbzdc5o54e04aeg7tlg54'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'vgxv8rkf4890yf659o2oklffv',
+ name: 'PRIMARY',
+ unique: true,
+ fieldIds: ['v8plj7wq1cly03y178bysft2f'],
+ createdAt: Date.now(),
+ },
+ {
+ id: '60gtoaq9vnwwbii97ks47ph82',
+ name: 'dept_no',
+ unique: false,
+ fieldIds: ['v8plj7wq1cly03y178bysft2f'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#ff6363',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '1c03hu41ko98myywerwbazeli',
+ name: 'employees',
+ x: 82.72000000000003,
+ y: 98.27199999999999,
+ fields: [
+ {
+ id: '04csyx8ds9t3rh93txiqs4dm4',
+ name: 'emp_no',
+ type: 'int',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'gnvcnj2i5jgktg7vauhveaorb',
+ name: 'birth_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '8savn7ht0fogo4odxdhekrret',
+ name: 'first_name',
+ type: 'varchar',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '14',
+ collation: 'utf8mb4_general_ci',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ol8kezsspmjx25avlf2dvic5q',
+ name: 'last_name',
+ type: 'varchar',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '16',
+ collation: 'utf8mb4_general_ci',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'jga5lfkkoxueqslcljj2vng9q',
+ name: 'gender',
+ type: 'enum',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '1',
+ collation: 'utf8mb4_general_ci',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'i0kgsun3nzrjpaz8ykwjgogyb',
+ name: 'hire_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: '8zg1ccoj4jb4kv6eleih38ni5',
+ name: 'PRIMARY',
+ unique: true,
+ fieldIds: ['04csyx8ds9t3rh93txiqs4dm4'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#4dee8a',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'u97myqcs1osilg7x0v263qpzd',
+ name: 'salaries',
+ x: 493.50755288021537,
+ y: 227.8719999999999,
+ fields: [
+ {
+ id: 'b8c9v5vtpbnt5tjzcd3iat85f',
+ name: 'emp_no',
+ type: 'int',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'n654h28i8yeeadznzht9mjc8f',
+ name: 'salary',
+ type: 'int',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '0s10erufqpl6y3hpqmvbcneol',
+ name: 'from_date',
+ type: 'date',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'bwohji7dj67xpa6p5diyy6pis',
+ name: 'to_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'orkgizf8qbmtly3rw5cbxtc2i',
+ name: 'price',
+ type: 'decimal',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ precision: 10,
+ scale: 2,
+ default: '13.21',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'nky2wepp8yr5g6rzvnbta1hxb',
+ name: 'PRIMARY',
+ unique: true,
+ fieldIds: ['b8c9v5vtpbnt5tjzcd3iat85f'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'w40nnsrsnlz7z7vycs4yf0s8d',
+ name: 'PRIMARY',
+ unique: true,
+ fieldIds: ['0s10erufqpl6y3hpqmvbcneol'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#ff6b8a',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'fa0ozznyrckx572fqztyw3w4z',
+ name: 'titles',
+ x: -251.04799999999966,
+ y: 220.9599999999999,
+ fields: [
+ {
+ id: 'hr2gdoc0wtwvs4pfqo6m0fwc3',
+ name: 'emp_no',
+ type: 'int',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '5evr59tury66sayiu59esoc61',
+ name: 'title',
+ type: 'varchar',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ characterMaximumLength: '50',
+ collation: 'utf8mb4_general_ci',
+ createdAt: Date.now(),
+ },
+ {
+ id: '0vs1nqvrb6t53niz5ns2eskre',
+ name: 'from_date',
+ type: 'date',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'n6csxwmdm60y920p5jovlx4c6',
+ name: 'to_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ default: 'NULL',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'ijhmb7tq6i4fd72ndvotnwo45',
+ name: 'PRIMARY',
+ unique: true,
+ fieldIds: ['hr2gdoc0wtwvs4pfqo6m0fwc3'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'wgneqfte0nq7d5vzed2hcqie6',
+ name: 'PRIMARY',
+ unique: true,
+ fieldIds: ['5evr59tury66sayiu59esoc61'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'jbe9t9adhluqy8d3i7w1vgygd',
+ name: 'PRIMARY',
+ unique: true,
+ fieldIds: ['0vs1nqvrb6t53niz5ns2eskre'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#b067e9',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'gq5r3cuh74h1xzgzjmiu26t1e',
+ name: 'current_dept_emp',
+ x: 393.01599999999996,
+ y: 488.65600000000006,
+ fields: [
+ {
+ id: '8tz9jdtfrbbl4c0e7nthrj90g',
+ name: 'emp_no',
+ type: 'int',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'fv7o6txqvmy2349aq3pg0hnkm',
+ name: 'dept_no',
+ type: 'char',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '4',
+ collation: 'utf8mb4_general_ci',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'hneqjqobdvcumv91ymvqhv42a',
+ name: 'from_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'n9yj0xtw6uu0aqn2ankvniuat',
+ name: 'to_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [],
+ color: '#b0b0b0',
+ isView: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'q248uisjcid20tdqfnbj5qec6',
+ name: 'dept_emp_latest_date',
+ x: 70.62399999999991,
+ y: 469.6479999999999,
+ fields: [
+ {
+ id: 'q3oiwd0p27bipsy4kg5dkxri0',
+ name: 'emp_no',
+ type: 'int',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'dxhqoscu6zk87ob7sfvxo7if4',
+ name: 'from_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ys76pzey5i9twf13g2g0taju7',
+ name: 'to_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [],
+ color: '#b0b0b0',
+ isView: true,
+ createdAt: Date.now(),
+ },
+ ],
+ relationships: [
+ {
+ id: 'cciaonuhfnjdvntl9gv4lrsbk',
+ name: 'dept_emp_ibfk_1',
+ sourceTableId: 'rkc38w1yqrvhz2pmveunp6nsw',
+ targetTableId: '1c03hu41ko98myywerwbazeli',
+ sourceFieldId: 'wcgycjif09xrq0ly3txkq6ocu',
+ targetFieldId: '04csyx8ds9t3rh93txiqs4dm4',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'b9y9q200df95qtzdi4lkeiw2w',
+ name: 'dept_emp_ibfk_2',
+ sourceTableId: 'rkc38w1yqrvhz2pmveunp6nsw',
+ targetTableId: '6e70s6dhdfnve9xljbih6bo7x',
+ sourceFieldId: 'jdw1yrh9xf1i7927gzs9pob2p',
+ targetFieldId: 'gaj3scrtaz46ezfmc162ingxf',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'tt4jz3plk26zz3p8hvu3e4m27',
+ name: 'dept_manager_ibfk_1',
+ sourceTableId: 'd2xqiqlffjfsg3kgsmpck5xay',
+ targetTableId: '1c03hu41ko98myywerwbazeli',
+ sourceFieldId: 'ecx2zbzdc5o54e04aeg7tlg54',
+ targetFieldId: '04csyx8ds9t3rh93txiqs4dm4',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'y3p9kp0rcfle3ivoe2owx7tu3',
+ name: 'dept_manager_ibfk_2',
+ sourceTableId: 'd2xqiqlffjfsg3kgsmpck5xay',
+ targetTableId: '6e70s6dhdfnve9xljbih6bo7x',
+ sourceFieldId: 'v8plj7wq1cly03y178bysft2f',
+ targetFieldId: 'gaj3scrtaz46ezfmc162ingxf',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'imavnkr77bjlanlaxj3og9fh6',
+ name: 'salaries_ibfk_1',
+ sourceTableId: 'u97myqcs1osilg7x0v263qpzd',
+ targetTableId: '1c03hu41ko98myywerwbazeli',
+ sourceFieldId: 'b8c9v5vtpbnt5tjzcd3iat85f',
+ targetFieldId: '04csyx8ds9t3rh93txiqs4dm4',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'x4m88eqis6owszjfozerntmzt',
+ name: 'titles_ibfk_1',
+ sourceTableId: 'fa0ozznyrckx572fqztyw3w4z',
+ targetTableId: '1c03hu41ko98myywerwbazeli',
+ sourceFieldId: 'hr2gdoc0wtwvs4pfqo6m0fwc3',
+ targetFieldId: '04csyx8ds9t3rh93txiqs4dm4',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ ],
+ },
+ },
+ {
+ id: '2',
+ name: 'Bike stores schema',
+ description:
+ 'A schema for database of bike stores, brands, categories, and customers.',
+ image: BikeStoresExample,
+ diagram: {
+ id: 'diagramexample02',
+ name: 'bike_stores-db',
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ databaseType: DatabaseType.POSTGRESQL,
+ tables: [
+ {
+ id: 'meqq3ly4klrjs9fc1d9s66msd',
+ name: 'brands',
+ x: 668.008,
+ y: 260.704,
+ fields: [
+ {
+ id: '8vuje8jgqclyypvmeyud3ouq4',
+ name: 'brand_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'flh5ctnexia9lyglbkuyhxh95',
+ name: 'brand_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'krb2wq85kdq15ln5wuc8995l5',
+ name: 'brands_pkey',
+ unique: true,
+ fieldIds: ['8vuje8jgqclyypvmeyud3ouq4'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#8a61f5',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'gkpmaqlbh1ye2eiob45hfqcs9',
+ name: 'categories',
+ x: 182.79187747914773,
+ y: 348.4095927710844,
+ fields: [
+ {
+ id: '3y6v954bmnmrhsu88pegssisz',
+ name: 'category_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'vl9ulvujbutscyg2infgmglzt',
+ name: 'category_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: '76pk9qk9vjcrzatysu5ejlvyf',
+ name: 'categories_pkey',
+ unique: true,
+ fieldIds: ['3y6v954bmnmrhsu88pegssisz'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#4dee8a',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ejeh9q8ea25j1g4ud9io5nsnx',
+ name: 'customers',
+ x: -133.71975495829474,
+ y: 728.4726929796104,
+ fields: [
+ {
+ id: 'dtz6h71bnnnqqmc0gj4m7s4b2',
+ name: 'customer_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'fq6c72nmetvt5seuk8jgk05wn',
+ name: 'first_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'mfdk4z37kl5xbmfit19jo4dt8',
+ name: 'last_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'jki8n3ceyee7a5b54j59cis1p',
+ name: 'phone',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ph08cg4s7kcr039ktrrvnd5vh',
+ name: 'email',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'kpg23k5h19ylb44nyjb6dk0f1',
+ name: 'street',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'xh1z8wlq5u956ymncg6076csu',
+ name: 'city',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'agxluhav42vjegabvqqmqj3ns',
+ name: 'state',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: '3fbdl91memmf72k4lcd18jp5z',
+ name: 'zip_code',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: '1dvnhyc6lm8xnb0ehewsi5ywh',
+ name: 'customers_pkey',
+ unique: true,
+ fieldIds: ['dtz6h71bnnnqqmc0gj4m7s4b2'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#7175fa',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '755skfah1xvh833uo843e071u',
+ name: 'order_items',
+ x: 847.4799999999998,
+ y: 804.2781249999998,
+ fields: [
+ {
+ id: 'rwt3l7vgvcn2wez9z78xrne2e',
+ name: 'order_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'vdet5tj4183tka3hjsk509a2u',
+ name: 'item_id',
+ type: 'integer',
+ primaryKey: false,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'axsoc31dhpdmwcpqhqhasv3cp',
+ name: 'product_id',
+ type: 'integer',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: '074hvs58ube2jqfq0jwgsvewh',
+ name: 'quantity',
+ type: 'integer',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'rym2i78wnwo269remsx7l0d8j',
+ name: 'list_price',
+ type: 'numeric',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ precision: 10,
+ scale: 2,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ddki77nrt4273hzl0cxfb7866',
+ name: 'discount',
+ type: 'numeric',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ precision: 4,
+ scale: 2,
+ default: '0',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 's68ky41dut4yp64ycqh9i492h',
+ name: 'order_items_pkey',
+ unique: true,
+ fieldIds: ['rwt3l7vgvcn2wez9z78xrne2e'],
+ createdAt: Date.now(),
+ },
+ {
+ id: '0rccnjdvlhj9pngn0vetmyzgr',
+ name: 'order_items_pkey',
+ unique: true,
+ fieldIds: ['vdet5tj4183tka3hjsk509a2u'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#9ef07a',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'yu2ncqamkaipx5h6sl9fxfm92',
+ name: 'orders',
+ x: 258.9759999999999,
+ y: 803.0563749999998,
+ fields: [
+ {
+ id: 'tp12zsqygr6q3di3iie5c69q4',
+ name: 'order_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'hlpqy2hgujo7pnjthvz3hlp8l',
+ name: 'customer_id',
+ type: 'integer',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'oa8h0um6s0tve41xtm6m5jy3i',
+ name: 'order_status',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'sfyzron57mn04r93jbmaw9wrq',
+ name: 'order_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'btv75he9gspes785kt2u50bid',
+ name: 'required_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ne3lgf7ye5xp01udfolax63bc',
+ name: 'shipped_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'imvdw14raks3bmruzrom2m60a',
+ name: 'store_id',
+ type: 'integer',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: '18qplj4qqrdm7gamk6dzo4jqj',
+ name: 'staff_id',
+ type: 'integer',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'odesldwon2bx6pe1w1d4p9gvc',
+ name: 'orders_pkey',
+ unique: true,
+ fieldIds: ['tp12zsqygr6q3di3iie5c69q4'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#4dee8a',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'bne5dz6bso1vq001e5up9ga8h',
+ name: 'products',
+ x: 1107.6639999999998,
+ y: 350.98524999999995,
+ fields: [
+ {
+ id: 'cb7jt8iz26dtyiepk55irq4wj',
+ name: 'product_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'l9m1kia46un788eih3rwvqyd8',
+ name: 'product_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: '59bad3ogjluo7tr50id8m1s6n',
+ name: 'brand_id',
+ type: 'integer',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'mo9o3q3fouk14i2095p381boh',
+ name: 'category_id',
+ type: 'integer',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: '21x76j5hy9pjcqu69l8sxma7c',
+ name: 'model_year',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: '9jjg1cdqk1ve28ycubjzl77pr',
+ name: 'list_price',
+ type: 'numeric',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ precision: 10,
+ scale: 2,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: '74m0fax501235tpmcbj89me05',
+ name: 'products_pkey',
+ unique: true,
+ fieldIds: ['cb7jt8iz26dtyiepk55irq4wj'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#4dee8a',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '96pa90b6estjx7i0edgu8nqe1',
+ name: 'staffs',
+ x: 599.08,
+ y: 512.8480000000001,
+ fields: [
+ {
+ id: 'e7kfdzkympiu6zdvpeurqxu6r',
+ name: 'staff_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'wlupay9dk1uiacpaban7o715i',
+ name: 'first_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'fnp0z3ra5vxgb4wzquipq6nc4',
+ name: 'last_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'jbwdykfugbb1ds76q1rrdns06',
+ name: 'email',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'nai29esllni2z8scno83v42hj',
+ name: 'phone',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: '4lcsj6izwjoeu818c8thr7evv',
+ name: 'active',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: '34hmbf7inkgziqht8m369759i',
+ name: 'store_id',
+ type: 'integer',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'c3escvz9sc03nczds7mlg9orc',
+ name: 'manager_id',
+ type: 'integer',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: '6ecq3ky7s4lp1kyymf7q27lk9',
+ name: 'staffs_pkey',
+ unique: true,
+ fieldIds: ['e7kfdzkympiu6zdvpeurqxu6r'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#7175fa',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '2hwntdtm83wqk9wbwjteo4n4a',
+ name: 'stocks',
+ x: -146.94658498609795,
+ y: 240.26239518072288,
+ fields: [
+ {
+ id: 'd40dt5g1thzuzndldviri2jxj',
+ name: 'store_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'bmyqo12d6gdgsn1239atxb4qn',
+ name: 'product_id',
+ type: 'integer',
+ primaryKey: false,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'dv8vw0cx3czqzrwnh6ltc8m81',
+ name: 'quantity',
+ type: 'integer',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'lyded2yia3fdz4l4m4jyj24tg',
+ name: 'stocks_pkey',
+ unique: true,
+ fieldIds: ['d40dt5g1thzuzndldviri2jxj'],
+ createdAt: Date.now(),
+ },
+ {
+ id: '7vvg7fnhy9vbpmj8w05n2f3ry',
+ name: 'stocks_pkey',
+ unique: true,
+ fieldIds: ['bmyqo12d6gdgsn1239atxb4qn'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#c05dcf',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ttye5mdap1hl200egtjuwzl9m',
+ name: 'stores',
+ x: -132.385320111214,
+ y: 412.5383278962002,
+ fields: [
+ {
+ id: 'dsout0pmyihlkq72108vs6655',
+ name: 'store_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'evev1yq7p094mrn4falm4f0qt',
+ name: 'store_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'vfzwzq6x6lju968kypx4kma6d',
+ name: 'phone',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'nusy1gx426u5pkw87ct9fd6rf',
+ name: 'email',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'svg0ztdsgldnj03oa4nji73yv',
+ name: 'street',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'svrzlmenxv4rjrd5t1v73xxg9',
+ name: 'city',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'v7ve5x0r5kphv84ylo5z14t2f',
+ name: 'state',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: '2yk0ys92lzg21ywec5loo41f6',
+ name: 'zip_code',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'ndkrq0rue952nok9i8vlyrycj',
+ name: 'stores_pkey',
+ unique: true,
+ fieldIds: ['dsout0pmyihlkq72108vs6655'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#ff9f74',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ ],
+ relationships: [
+ {
+ id: 'vzelxec065qirwq76ux2mbgno',
+ name: 'fk__order_ite__order__4ca06362',
+ sourceTableId: '755skfah1xvh833uo843e071u',
+ targetTableId: 'yu2ncqamkaipx5h6sl9fxfm92',
+ sourceFieldId: 'rwt3l7vgvcn2wez9z78xrne2e',
+ targetFieldId: 'tp12zsqygr6q3di3iie5c69q4',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'gr08kpn2z9w9szy6vwaaqg9f0',
+ name: 'fk__order_ite__produ__4d94879b',
+ sourceTableId: '755skfah1xvh833uo843e071u',
+ targetTableId: 'bne5dz6bso1vq001e5up9ga8h',
+ sourceFieldId: 'axsoc31dhpdmwcpqhqhasv3cp',
+ targetFieldId: 'cb7jt8iz26dtyiepk55irq4wj',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'pvlw5lf7dz69bf1v8izcpm3s5',
+ name: 'fk__orders__customer__46e78a0c',
+ sourceTableId: 'yu2ncqamkaipx5h6sl9fxfm92',
+ targetTableId: 'ejeh9q8ea25j1g4ud9io5nsnx',
+ sourceFieldId: 'hlpqy2hgujo7pnjthvz3hlp8l',
+ targetFieldId: 'dtz6h71bnnnqqmc0gj4m7s4b2',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'qxy305cjiahdf55uewls0ur1u',
+ name: 'fk__orders__staff_id__48cfd27e',
+ sourceTableId: 'yu2ncqamkaipx5h6sl9fxfm92',
+ targetTableId: '96pa90b6estjx7i0edgu8nqe1',
+ sourceFieldId: '18qplj4qqrdm7gamk6dzo4jqj',
+ targetFieldId: 'e7kfdzkympiu6zdvpeurqxu6r',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'i29tgq7wb2onv8szgrdjv8mu0',
+ name: 'fk__orders__store_id__47dbae45',
+ sourceTableId: 'yu2ncqamkaipx5h6sl9fxfm92',
+ targetTableId: 'ttye5mdap1hl200egtjuwzl9m',
+ sourceFieldId: 'imvdw14raks3bmruzrom2m60a',
+ targetFieldId: 'dsout0pmyihlkq72108vs6655',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'idrrrigmlz783wikpu0krugmx',
+ name: 'fk__products__brand___3b75d760',
+ sourceTableId: 'bne5dz6bso1vq001e5up9ga8h',
+ targetTableId: 'meqq3ly4klrjs9fc1d9s66msd',
+ sourceFieldId: '59bad3ogjluo7tr50id8m1s6n',
+ targetFieldId: '8vuje8jgqclyypvmeyud3ouq4',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ebageobv2ip826p00g9isje8i',
+ name: 'fk__products__catego__3a81b327',
+ sourceTableId: 'bne5dz6bso1vq001e5up9ga8h',
+ targetTableId: 'gkpmaqlbh1ye2eiob45hfqcs9',
+ sourceFieldId: 'mo9o3q3fouk14i2095p381boh',
+ targetFieldId: '3y6v954bmnmrhsu88pegssisz',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'kk3bm81cmxpwvrx04np6tqgml',
+ name: 'fk__staffs__store_id__4316f928',
+ sourceTableId: '96pa90b6estjx7i0edgu8nqe1',
+ targetTableId: 'ttye5mdap1hl200egtjuwzl9m',
+ sourceFieldId: '34hmbf7inkgziqht8m369759i',
+ targetFieldId: 'dsout0pmyihlkq72108vs6655',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'rh3m4hs1tdyvid7s4g1aqklxi',
+ name: 'fk__stocks__product___5165187f',
+ sourceTableId: '2hwntdtm83wqk9wbwjteo4n4a',
+ targetTableId: 'bne5dz6bso1vq001e5up9ga8h',
+ sourceFieldId: 'bmyqo12d6gdgsn1239atxb4qn',
+ targetFieldId: 'cb7jt8iz26dtyiepk55irq4wj',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'zjjce43idrgqv3jamapvkxpfp',
+ name: 'fk__stocks__store_id__5070f446',
+ sourceTableId: '2hwntdtm83wqk9wbwjteo4n4a',
+ targetTableId: 'ttye5mdap1hl200egtjuwzl9m',
+ sourceFieldId: 'd40dt5g1thzuzndldviri2jxj',
+ targetFieldId: 'dsout0pmyihlkq72108vs6655',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ ],
+ },
+ },
+ {
+ id: '3',
+ name: 'DVD Rental schema',
+ image: DVDRentalExample,
+ description:
+ 'A schema for database of a DVD rental store, including customers, films, actors, staff, and stores.',
+ diagram: {
+ id: 'diagramexample03',
+ name: 'dvdrental-db',
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ databaseType: DatabaseType.POSTGRESQL,
+ tables: [
+ {
+ id: 'fsqbyg9qles1fl937pizwve95',
+ name: 'actor',
+ x: -230.40983939824048,
+ y: 479.3344610354799,
+ fields: [
+ {
+ id: 'xqx13khvb9m0vzfepcycizcai',
+ name: 'actor_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ default: "nextval('actor_actor_id_seq'::regclass)",
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ik43za355bfu8v4f675ghg6rh',
+ name: 'first_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '45',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'klzwtogtkw2vdwyx8t6kjfiw3',
+ name: 'last_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '45',
+ createdAt: Date.now(),
+ },
+ {
+ id: '8imotb3e7k9ad9bdm1q3yt1j7',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'fs2vnbd6p7arn8rwt4nnnzfo9',
+ name: 'idx_actor_last_name',
+ unique: false,
+ fieldIds: ['klzwtogtkw2vdwyx8t6kjfiw3'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ht48c80me7h425g278v63w2wz',
+ name: 'actor_pkey',
+ unique: true,
+ fieldIds: ['xqx13khvb9m0vzfepcycizcai'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#4dee8a',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '6zd90tcbey5t4s8robbviqus8',
+ name: 'address',
+ x: 95.60771046641412,
+ y: 378.91038538270215,
+ fields: [
+ {
+ id: 'b0iylw1gbvp09vtpxdcs8d3zn',
+ name: 'address_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ default:
+ "nextval('address_address_id_seq'::regclass)",
+ createdAt: Date.now(),
+ },
+ {
+ id: 'cldpviw1aa57zal77agjfum71',
+ name: 'address',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '50',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'gzj8gb1css76cmxcb60evcymq',
+ name: 'address2',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ characterMaximumLength: '50',
+ createdAt: Date.now(),
+ },
+ {
+ id: '4neowl7rc20n7nriu09izvqqc',
+ name: 'district',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '20',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'qjibly41tvbgo8icl3hndguwv',
+ name: 'city_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '7pc5yulufvcsuacmptq4qdd53',
+ name: 'postal_code',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ characterMaximumLength: '10',
+ createdAt: Date.now(),
+ },
+ {
+ id: '3ls3f1bxs4rv54lskwe7n2nnv',
+ name: 'phone',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '20',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'v83ii1uivhk0n4p88nihbjv5b',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'xsmxjk5vk4e26e46ypt9o3j59',
+ name: 'address_pkey',
+ unique: true,
+ fieldIds: ['b0iylw1gbvp09vtpxdcs8d3zn'],
+ createdAt: Date.now(),
+ },
+ {
+ id: '7tk36ne2exp1dwrt1zj5052fx',
+ name: 'idx_fk_city_id',
+ unique: false,
+ fieldIds: ['qjibly41tvbgo8icl3hndguwv'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#8a61f5',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '4pxqynu5v3vugzy12sfh4ozvu',
+ name: 'category',
+ x: 971.7954244648793,
+ y: 676.4289805326614,
+ fields: [
+ {
+ id: 'dhacvdae20ms5wc3inljozrz2',
+ name: 'category_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ default:
+ "nextval('category_category_id_seq'::regclass)",
+ createdAt: Date.now(),
+ },
+ {
+ id: 'sm5uluh5x4787xoko5q6mmhdp',
+ name: 'name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '25',
+ createdAt: Date.now(),
+ },
+ {
+ id: '65vp8zp821127857yezwio7jq',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: '1dqpjhhupzz6w8ith5sje6s5h',
+ name: 'category_pkey',
+ unique: true,
+ fieldIds: ['dhacvdae20ms5wc3inljozrz2'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#8eb7ff',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'l908eu1k0odh5u4mq6ge61udi',
+ name: 'city',
+ x: 447.23808020530305,
+ y: 843.0068735482081,
+ fields: [
+ {
+ id: 'ozcebtrmnoar9spk7jq4b2gfz',
+ name: 'city_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ default: "nextval('city_city_id_seq'::regclass)",
+ createdAt: Date.now(),
+ },
+ {
+ id: 'trxo61qtmeooaad55kyxnisqm',
+ name: 'city',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '50',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'lup9lgn5haghenay268urdr2v',
+ name: 'country_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'mr8xwe32ytcbqkh5ujc5mq7o8',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'p3oqwg5xmam3env0spfii3ayj',
+ name: 'idx_fk_country_id',
+ unique: false,
+ fieldIds: ['lup9lgn5haghenay268urdr2v'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'mqmsium8yab2yl4veo0g3myh5',
+ name: 'city_pkey',
+ unique: true,
+ fieldIds: ['ozcebtrmnoar9spk7jq4b2gfz'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#42e0c0',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '1tzllhzmb8tkgafbmcguqf5vn',
+ name: 'country',
+ x: 862.6623456852019,
+ y: 906.4240231670566,
+ fields: [
+ {
+ id: 'jh3rnowvtvmu4qwbjn8s2wjnv',
+ name: 'country_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ default:
+ "nextval('country_country_id_seq'::regclass)",
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ttugkudyxkpkg2frv2zd0dp7h',
+ name: 'country',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '50',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'rrz88qc7tcunmvhephk32lp9x',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'xay09hwtgeuehf0bhpo4bk5uh',
+ name: 'country_pkey',
+ unique: true,
+ fieldIds: ['jh3rnowvtvmu4qwbjn8s2wjnv'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#c05dcf',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'v5c8d2z2r7czjjb6yqfhrzca7',
+ name: 'customer',
+ x: -222.69179435527712,
+ y: -133.6900980855134,
+ fields: [
+ {
+ id: '5as8lm61s6t2u9chbixfeyrmd',
+ name: 'customer_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ default:
+ "nextval('customer_customer_id_seq'::regclass)",
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ech331glim64ped91syweyley',
+ name: 'store_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'zn000ibftpvgu19ri5mbaip9u',
+ name: 'first_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '45',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'qe33c9dizsmkfzw8y4pzz19gp',
+ name: 'last_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '45',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'cirbtorx4rxki2ivi7seiolls',
+ name: 'email',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ characterMaximumLength: '50',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'clgb7yp0y3r7v2bs9vvz2i1g8',
+ name: 'address_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '86tvy4ffhbb5pd0e4id6h6j4a',
+ name: 'activebool',
+ type: 'boolean',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'true',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'xpnedj3gh30ve8w61yp9j9q08',
+ name: 'create_date',
+ type: 'date',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: "('now'::text)::date",
+ createdAt: Date.now(),
+ },
+ {
+ id: '3sev3dleonsle0jy2vjca8fsv',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'qgdyz8n4mzdgd4e337q0rl8ib',
+ name: 'active',
+ type: 'integer',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'l6e8hwg0443hz7azwgtbk74fu',
+ name: 'idx_fk_store_id',
+ unique: false,
+ fieldIds: ['ech331glim64ped91syweyley'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ra7o1c43nvgly9ptc7a15ard2',
+ name: 'customer_pkey',
+ unique: true,
+ fieldIds: ['5as8lm61s6t2u9chbixfeyrmd'],
+ createdAt: Date.now(),
+ },
+ {
+ id: '242d0nfw3fxebye3nvryeh7k4',
+ name: 'idx_last_name',
+ unique: false,
+ fieldIds: ['qe33c9dizsmkfzw8y4pzz19gp'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'war2i43ysqjdzpjufhhgay6x7',
+ name: 'idx_fk_address_id',
+ unique: false,
+ fieldIds: ['clgb7yp0y3r7v2bs9vvz2i1g8'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#8a61f5',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'e31vevdt598z8mpv13egvkjnj',
+ name: 'film',
+ x: 566.8187258202024,
+ y: 314.30426726271173,
+ fields: [
+ {
+ id: '9p7plypt0h2pi24sd1maglln2',
+ name: 'film_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ default: "nextval('film_film_id_seq'::regclass)",
+ createdAt: Date.now(),
+ },
+ {
+ id: 'xou2sc3iqfl1dgd4st13vc7sg',
+ name: 'title',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '255',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'abziwxx42f2vrqpdad0elu7o1',
+ name: 'description',
+ type: 'text',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: '3ajcx2r2oiow6kwho1way2128',
+ name: 'release_year',
+ type: 'integer',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: '6f0itpcv12zrs47p7ipwokear',
+ name: 'language_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ag5jstimbr5u5g1ldv2hl6x0g',
+ name: 'rental_duration',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: '3',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ne3v1atnvtg0893em3pixtpa6',
+ name: 'rental_rate',
+ type: 'numeric',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ precision: 4,
+ scale: 2,
+ default: '4.99',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'tz8mggxsxu3hehscd5qm1qsrj',
+ name: 'length',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'e57b7z15iro655qi5omyr6f5k',
+ name: 'replacement_cost',
+ type: 'numeric',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ precision: 5,
+ scale: 2,
+ default: '19.99',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'kx70sye1cc8t19vy17nherzf3',
+ name: 'rating',
+ type: 'user-defined',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ default: "'G'::mpaa_rating",
+ createdAt: Date.now(),
+ },
+ {
+ id: 'a1oiiu5xtebzcmzcrfoyw86jf',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'tckkm3gb2n0zmayt2qjarbg5x',
+ name: 'special_features',
+ type: 'array',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'eob427jyflq7za8ntjhjn1fln',
+ name: 'fulltext',
+ type: 'tsvector',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: '3t6ppliwdyqz5ydgrj681bcs1',
+ name: 'film_pkey',
+ unique: true,
+ fieldIds: ['9p7plypt0h2pi24sd1maglln2'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'lj5tqyuqhohxalfzrv79tz6bg',
+ name: 'idx_fk_language_id',
+ unique: false,
+ fieldIds: ['6f0itpcv12zrs47p7ipwokear'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'vkjne04om2a7weddbk1iei5un',
+ name: 'idx_title',
+ unique: false,
+ fieldIds: ['xou2sc3iqfl1dgd4st13vc7sg'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'v3v0408fmmx48ju9ruj2hbmyt',
+ name: 'film_fulltext_idx',
+ unique: false,
+ fieldIds: ['eob427jyflq7za8ntjhjn1fln'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#7175fa',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '6736uomo5tw3w40tiqa85aruk',
+ name: 'film_actor',
+ x: -231.61785978573243,
+ y: 268.50456342335843,
+ fields: [
+ {
+ id: 'h3ugzzz8kx4tjvx3vpnk271gx',
+ name: 'actor_id',
+ type: 'smallint',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'fr9ql21vmr8s77z1if70ws897',
+ name: 'film_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'jv8jgfxml7m08gjej8h5kjxq8',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'uxaefq5wg5n93xpcn1hvlqpyy',
+ name: 'film_actor_pkey',
+ unique: true,
+ fieldIds: ['h3ugzzz8kx4tjvx3vpnk271gx'],
+ createdAt: Date.now(),
+ },
+ {
+ id: '8zfswqnlebluzqcwre997io5c',
+ name: 'idx_fk_film_id',
+ unique: false,
+ fieldIds: ['fr9ql21vmr8s77z1if70ws897'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'tpiirc0dcv1u5sqyul3iovcpc',
+ name: 'film_actor_pkey',
+ unique: true,
+ fieldIds: ['fr9ql21vmr8s77z1if70ws897'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#8a61f5',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '45cjukmjeidmb2a5hvkh19ecg',
+ name: 'film_category',
+ x: 1367.9870370556057,
+ y: 918.6722604164116,
+ fields: [
+ {
+ id: '0i0bfvjxpfvhadfvmq04nccau',
+ name: 'film_id',
+ type: 'smallint',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'nx6hxsugb6xiirghsp4qzkk8j',
+ name: 'category_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'enh72sktfhadc6jjg667sa8tz',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'pmhv0aa74mhlx767wmccbm2pl',
+ name: 'film_category_pkey',
+ unique: true,
+ fieldIds: ['nx6hxsugb6xiirghsp4qzkk8j'],
+ createdAt: Date.now(),
+ },
+ {
+ id: '0y0uuer2cagpf91to3jdxb7h5',
+ name: 'film_category_pkey',
+ unique: true,
+ fieldIds: ['0i0bfvjxpfvhadfvmq04nccau'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#42e0c0',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '2cjhyrtpinfa705eilfeeurtc',
+ name: 'inventory',
+ x: 837.2463612754104,
+ y: 62.66553896452018,
+ fields: [
+ {
+ id: 'qjhszd97v59kifufel97hj33j',
+ name: 'inventory_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ default:
+ "nextval('inventory_inventory_id_seq'::regclass)",
+ createdAt: Date.now(),
+ },
+ {
+ id: 'hln6zbas448889n2m2ogs81ev',
+ name: 'film_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'jfyqemyo4jockaumlbg6ps19a',
+ name: 'store_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'prclnzgowskz3koq16xl10tj1',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: '03o27kfg8v6gtvkp3f0hw9njt',
+ name: 'idx_store_id_film_id',
+ unique: false,
+ fieldIds: ['jfyqemyo4jockaumlbg6ps19a'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'oc79tabhelehw9jr406dj5ubb',
+ name: 'idx_store_id_film_id',
+ unique: false,
+ fieldIds: ['hln6zbas448889n2m2ogs81ev'],
+ createdAt: Date.now(),
+ },
+ {
+ id: '1v0bjrbpy3x3qfgv6r81yn4ao',
+ name: 'inventory_pkey',
+ unique: true,
+ fieldIds: ['qjhszd97v59kifufel97hj33j'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#b067e9',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'fctm9t2gjxte1920akz69jkqt',
+ name: 'language',
+ x: 1145.4852455715575,
+ y: 482.0414219458479,
+ fields: [
+ {
+ id: 'fp615hegqw52lssi3xnzx05rs',
+ name: 'language_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ default:
+ "nextval('language_language_id_seq'::regclass)",
+ createdAt: Date.now(),
+ },
+ {
+ id: 'lng1oxspuc1hsny8x0sti0o72',
+ name: 'name',
+ type: 'char',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '20',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'sup8f0z7axc1h9idc8d5uqzc7',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'fdh7uz800a5yuwsq3xah3l5lc',
+ name: 'language_pkey',
+ unique: true,
+ fieldIds: ['fp615hegqw52lssi3xnzx05rs'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#7175fa',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'zqkdij60kh33k27ugz11rh244',
+ name: 'payment',
+ x: 499.9297120587544,
+ y: -137.56446222788708,
+ fields: [
+ {
+ id: 'r07b25xp5enas53osnkykhshc',
+ name: 'payment_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ default:
+ "nextval('payment_payment_id_seq'::regclass)",
+ createdAt: Date.now(),
+ },
+ {
+ id: 'lxs0lq5udza79rzkp5ll732z8',
+ name: 'customer_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'bnanwa6rwnbjnfkqrknpk1tqm',
+ name: 'staff_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'rdjpkkl53bc1plf75wt2xtf0m',
+ name: 'rental_id',
+ type: 'integer',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'gup5upslxkcv9nqu5r4qlc41v',
+ name: 'amount',
+ type: 'numeric',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ precision: 5,
+ scale: 2,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'w90qtt65qbwvjik6ayu17r01y',
+ name: 'payment_date',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'lkc8ndsfolib73yg263ybt4a7',
+ name: 'idx_fk_staff_id',
+ unique: false,
+ fieldIds: ['bnanwa6rwnbjnfkqrknpk1tqm'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ugm1o7w392qrmozxrrormoqgk',
+ name: 'payment_pkey',
+ unique: true,
+ fieldIds: ['r07b25xp5enas53osnkykhshc'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'zk83u1oddid41i72aru816h80',
+ name: 'idx_fk_customer_id',
+ unique: false,
+ fieldIds: ['lxs0lq5udza79rzkp5ll732z8'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'doajq8k2zvlna9ig08v7k042s',
+ name: 'idx_fk_rental_id',
+ unique: false,
+ fieldIds: ['rdjpkkl53bc1plf75wt2xtf0m'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#9ef07a',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '08ck6xgxm97m8fr757f3c1u8i',
+ name: 'rental',
+ x: 162.2336746262622,
+ y: 67.05782849810606,
+ fields: [
+ {
+ id: 'up97wwftgf0b7b2td9p0jehjb',
+ name: 'rental_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ default:
+ "nextval('rental_rental_id_seq'::regclass)",
+ createdAt: Date.now(),
+ },
+ {
+ id: '0z6e0xj8p7jze5v4jip4q2xci',
+ name: 'rental_date',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '6v1bgzlqyzzrjksnvtbwk50qt',
+ name: 'inventory_id',
+ type: 'integer',
+ primaryKey: false,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'yxldnw5n7mgk0uz5t1yar2fxb',
+ name: 'customer_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '43nw8h9mxi1jyiznwn28iblgw',
+ name: 'return_date',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ba5gh63xkhulbh90royzndwgy',
+ name: 'staff_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: '9vuky8e8fhrmtqjhz0k1lafbi',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'sp6moud1x6ghpzm7prjo9umfl',
+ name: 'idx_unq_rental_rental_date_inventory_id_customer_id',
+ unique: true,
+ fieldIds: ['6v1bgzlqyzzrjksnvtbwk50qt'],
+ createdAt: Date.now(),
+ },
+ {
+ id: '3uqyqf2nthx5b2uabfbi2sybv',
+ name: 'idx_unq_rental_rental_date_inventory_id_customer_id',
+ unique: true,
+ fieldIds: ['yxldnw5n7mgk0uz5t1yar2fxb'],
+ createdAt: Date.now(),
+ },
+ {
+ id: '1ygsqa88rwhhhupxvaq9ec6zr',
+ name: 'idx_unq_rental_rental_date_inventory_id_customer_id',
+ unique: true,
+ fieldIds: ['0z6e0xj8p7jze5v4jip4q2xci'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'w3bmoghte4qzaip75kxojno32',
+ name: 'rental_pkey',
+ unique: true,
+ fieldIds: ['up97wwftgf0b7b2td9p0jehjb'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'iiffskh0x60pmb5a8es4rmf72',
+ name: 'idx_fk_inventory_id',
+ unique: false,
+ fieldIds: ['6v1bgzlqyzzrjksnvtbwk50qt'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#8a61f5',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'xkeb7oj02sbn5oyoo2f66wmnz',
+ name: 'staff',
+ x: 1503.0448885421442,
+ y: 282.1436895892762,
+ fields: [
+ {
+ id: 'vxnoi2w8ap9rcxm8e2jlkbkpa',
+ name: 'staff_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ default: "nextval('staff_staff_id_seq'::regclass)",
+ createdAt: Date.now(),
+ },
+ {
+ id: 'mzcg5j2iq708hxi0sndilef9v',
+ name: 'first_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '45',
+ createdAt: Date.now(),
+ },
+ {
+ id: '27noncs0jf6fxqnjbeod2vdi4',
+ name: 'last_name',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '45',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'gef3s8gky0dx4hnh8u78glpbt',
+ name: 'address_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'rjqlqzc59cnt2v1w0os5ryisz',
+ name: 'email',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ characterMaximumLength: '50',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'y53nwunyujmkitnw75vcodstd',
+ name: 'store_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ef2vi9r49wgwm1ku32mbf67ge',
+ name: 'active',
+ type: 'boolean',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'true',
+ createdAt: Date.now(),
+ },
+ {
+ id: '0jidh7w9ipnf0nddc0mdzljbt',
+ name: 'username',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ characterMaximumLength: '16',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ktwit7owb7p1j3ibqmh6yeomx',
+ name: 'password',
+ type: 'character varying',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ characterMaximumLength: '40',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'q3wl36pn6sa5imtmbsinaahai',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'og6rhsk3jxmgivvdmn9ur4nxg',
+ name: 'picture',
+ type: 'bytea',
+ primaryKey: false,
+ unique: false,
+ nullable: true,
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'fx598g89nmvdj0th64w25dyex',
+ name: 'staff_pkey',
+ unique: true,
+ fieldIds: ['vxnoi2w8ap9rcxm8e2jlkbkpa'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#ff6b8a',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'mdugti4vpfw7ez6v0jfgd7cpv',
+ name: 'store',
+ x: 95.60771046641412,
+ y: 696.1542093282828,
+ fields: [
+ {
+ id: '93r7rr674bo09jhtv2imzdp6v',
+ name: 'store_id',
+ type: 'integer',
+ primaryKey: true,
+ unique: true,
+ nullable: false,
+ default: "nextval('store_store_id_seq'::regclass)",
+ createdAt: Date.now(),
+ },
+ {
+ id: 'jrsmkppymx89sbbeiudkv1bta',
+ name: 'manager_staff_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: true,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'u63mhszue97e96a9efvl8zs38',
+ name: 'address_id',
+ type: 'smallint',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ createdAt: Date.now(),
+ },
+ {
+ id: 'wulhhocqy6al49u1v1eprjws7',
+ name: 'last_update',
+ type: 'timestamp without time zone',
+ primaryKey: false,
+ unique: false,
+ nullable: false,
+ default: 'now()',
+ createdAt: Date.now(),
+ },
+ ],
+ indexes: [
+ {
+ id: 'rboeb1rttgce921zqcdlargln',
+ name: 'idx_unq_manager_staff_id',
+ unique: true,
+ fieldIds: ['jrsmkppymx89sbbeiudkv1bta'],
+ createdAt: Date.now(),
+ },
+ {
+ id: 'bhcxmfa97t2tibscwxt1454zp',
+ name: 'store_pkey',
+ unique: true,
+ fieldIds: ['93r7rr674bo09jhtv2imzdp6v'],
+ createdAt: Date.now(),
+ },
+ ],
+ color: '#8eb7ff',
+ isView: false,
+ createdAt: Date.now(),
+ },
+ ],
+ relationships: [
+ {
+ id: '1gve6ks3y6nrqt44f1lnxzh90',
+ name: 'customer_address_id_fkey',
+ sourceTableId: 'v5c8d2z2r7czjjb6yqfhrzca7',
+ targetTableId: '6zd90tcbey5t4s8robbviqus8',
+ sourceFieldId: 'clgb7yp0y3r7v2bs9vvz2i1g8',
+ targetFieldId: 'b0iylw1gbvp09vtpxdcs8d3zn',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'd91monmss0svv9wxy0824crpc',
+ name: 'film_actor_actor_id_fkey',
+ sourceTableId: '6736uomo5tw3w40tiqa85aruk',
+ targetTableId: 'fsqbyg9qles1fl937pizwve95',
+ sourceFieldId: 'h3ugzzz8kx4tjvx3vpnk271gx',
+ targetFieldId: 'xqx13khvb9m0vzfepcycizcai',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'pv7vlqioc00ms620dmcdmgg70',
+ name: 'film_actor_film_id_fkey',
+ sourceTableId: '6736uomo5tw3w40tiqa85aruk',
+ targetTableId: 'e31vevdt598z8mpv13egvkjnj',
+ sourceFieldId: 'fr9ql21vmr8s77z1if70ws897',
+ targetFieldId: '9p7plypt0h2pi24sd1maglln2',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'lqslle7l8xnh0aldxdum9tj2w',
+ name: 'film_category_category_id_fkey',
+ sourceTableId: '45cjukmjeidmb2a5hvkh19ecg',
+ targetTableId: '4pxqynu5v3vugzy12sfh4ozvu',
+ sourceFieldId: 'nx6hxsugb6xiirghsp4qzkk8j',
+ targetFieldId: 'dhacvdae20ms5wc3inljozrz2',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ybf06o8yozvtd6lm0k8t7c430',
+ name: 'film_category_film_id_fkey',
+ sourceTableId: '45cjukmjeidmb2a5hvkh19ecg',
+ targetTableId: 'e31vevdt598z8mpv13egvkjnj',
+ sourceFieldId: '0i0bfvjxpfvhadfvmq04nccau',
+ targetFieldId: '9p7plypt0h2pi24sd1maglln2',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'uxlbezj3s4x2asdtbhqilcv2j',
+ name: 'film_language_id_fkey',
+ sourceTableId: 'e31vevdt598z8mpv13egvkjnj',
+ targetTableId: 'fctm9t2gjxte1920akz69jkqt',
+ sourceFieldId: '6f0itpcv12zrs47p7ipwokear',
+ targetFieldId: 'fp615hegqw52lssi3xnzx05rs',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'j0ua1y7df5ixcueoh0pd5tz7e',
+ name: 'fk_address_city',
+ sourceTableId: '6zd90tcbey5t4s8robbviqus8',
+ targetTableId: 'l908eu1k0odh5u4mq6ge61udi',
+ sourceFieldId: 'qjibly41tvbgo8icl3hndguwv',
+ targetFieldId: 'ozcebtrmnoar9spk7jq4b2gfz',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'oirm5lo84mlwzjwxt3ovdj5mg',
+ name: 'fk_city',
+ sourceTableId: 'l908eu1k0odh5u4mq6ge61udi',
+ targetTableId: '1tzllhzmb8tkgafbmcguqf5vn',
+ sourceFieldId: 'lup9lgn5haghenay268urdr2v',
+ targetFieldId: 'jh3rnowvtvmu4qwbjn8s2wjnv',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'mxahuy1mglwxjxlpyown790hb',
+ name: 'inventory_film_id_fkey',
+ sourceTableId: '2cjhyrtpinfa705eilfeeurtc',
+ targetTableId: 'e31vevdt598z8mpv13egvkjnj',
+ sourceFieldId: 'hln6zbas448889n2m2ogs81ev',
+ targetFieldId: '9p7plypt0h2pi24sd1maglln2',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'qfdb97v9ji2d5amt42vvb2b4m',
+ name: 'payment_customer_id_fkey',
+ sourceTableId: 'zqkdij60kh33k27ugz11rh244',
+ targetTableId: 'v5c8d2z2r7czjjb6yqfhrzca7',
+ sourceFieldId: 'lxs0lq5udza79rzkp5ll732z8',
+ targetFieldId: '5as8lm61s6t2u9chbixfeyrmd',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ffl6rmrvc9uu1k5k65u1pe081',
+ name: 'payment_rental_id_fkey',
+ sourceTableId: 'zqkdij60kh33k27ugz11rh244',
+ targetTableId: '08ck6xgxm97m8fr757f3c1u8i',
+ sourceFieldId: 'rdjpkkl53bc1plf75wt2xtf0m',
+ targetFieldId: 'up97wwftgf0b7b2td9p0jehjb',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'zmk8p06up7tm63acu0aigzm7e',
+ name: 'payment_staff_id_fkey',
+ sourceTableId: 'zqkdij60kh33k27ugz11rh244',
+ targetTableId: 'xkeb7oj02sbn5oyoo2f66wmnz',
+ sourceFieldId: 'bnanwa6rwnbjnfkqrknpk1tqm',
+ targetFieldId: 'vxnoi2w8ap9rcxm8e2jlkbkpa',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'n9olwy5ahcfmwxgv4k82p2p4o',
+ name: 'rental_customer_id_fkey',
+ sourceTableId: '08ck6xgxm97m8fr757f3c1u8i',
+ targetTableId: 'v5c8d2z2r7czjjb6yqfhrzca7',
+ sourceFieldId: 'yxldnw5n7mgk0uz5t1yar2fxb',
+ targetFieldId: '5as8lm61s6t2u9chbixfeyrmd',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ctpuu27arc67ilc494rfygn8i',
+ name: 'rental_inventory_id_fkey',
+ sourceTableId: '08ck6xgxm97m8fr757f3c1u8i',
+ targetTableId: '2cjhyrtpinfa705eilfeeurtc',
+ sourceFieldId: '6v1bgzlqyzzrjksnvtbwk50qt',
+ targetFieldId: 'qjhszd97v59kifufel97hj33j',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'ndd5pkrkzqlnaugt960vpbea3',
+ name: 'rental_staff_id_key',
+ sourceTableId: '08ck6xgxm97m8fr757f3c1u8i',
+ targetTableId: 'xkeb7oj02sbn5oyoo2f66wmnz',
+ sourceFieldId: 'ba5gh63xkhulbh90royzndwgy',
+ targetFieldId: 'vxnoi2w8ap9rcxm8e2jlkbkpa',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'w1wezoqdfhzrpvrdzrluatdaj',
+ name: 'staff_address_id_fkey',
+ sourceTableId: 'xkeb7oj02sbn5oyoo2f66wmnz',
+ targetTableId: '6zd90tcbey5t4s8robbviqus8',
+ sourceFieldId: 'gef3s8gky0dx4hnh8u78glpbt',
+ targetFieldId: 'b0iylw1gbvp09vtpxdcs8d3zn',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'lzbdtwcpijch4b825otub9acp',
+ name: 'store_address_id_fkey',
+ sourceTableId: 'mdugti4vpfw7ez6v0jfgd7cpv',
+ targetTableId: '6zd90tcbey5t4s8robbviqus8',
+ sourceFieldId: 'u63mhszue97e96a9efvl8zs38',
+ targetFieldId: 'b0iylw1gbvp09vtpxdcs8d3zn',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ {
+ id: 'mg7omw1e5ec3ma4kvwu9mzocn',
+ name: 'store_manager_staff_id_fkey',
+ sourceTableId: 'mdugti4vpfw7ez6v0jfgd7cpv',
+ targetTableId: 'xkeb7oj02sbn5oyoo2f66wmnz',
+ sourceFieldId: 'jrsmkppymx89sbbeiudkv1bta',
+ targetFieldId: 'vxnoi2w8ap9rcxm8e2jlkbkpa',
+ type: 'many_to_one',
+ createdAt: Date.now(),
+ },
+ ],
+ },
+ },
+];
diff --git a/src/pages/examples-page/examples-page.tsx b/src/pages/examples-page/examples-page.tsx
new file mode 100644
index 00000000..77c05bcc
--- /dev/null
+++ b/src/pages/examples-page/examples-page.tsx
@@ -0,0 +1,42 @@
+import React from 'react';
+import ChartDBLogo from '@/assets/logo.png';
+import { examples } from './examples-data/examples-data';
+import { ExampleCard } from './example-card';
+
+export const ExamplesPage: React.FC = () => {
+ return (
+ <section className="bg-background w-screen flex flex-col">
+ <nav className="flex flex-row items-center justify-between px-4 h-12 border-b">
+ <div className="flex flex-1 justify-start gap-x-3">
+ <div className="flex font-primary items-center">
+ <a
+ href="https://chartdb.io"
+ className="cursor-pointer"
+ rel="noreferrer"
+ >
+ <img
+ src={ChartDBLogo}
+ alt="chartDB"
+ className="h-4 max-w-fit"
+ />
+ </a>
+ </div>
+ </div>
+ <div className="flex flex-row flex-1 justify-center items-center group"></div>
+ <div className="hidden flex-1 justify-end sm:flex"></div>
+ </nav>
+ <div className="flex flex-col px-28 pt-3">
+ <div className="text-2xl font-bold font-primary">Examples</div>
+ <div className="text-md font-primary mt-1 text-muted-foreground">
+ A collection of examples to help you get started with
+ ChartDB.
+ </div>
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 grid-flow-row gap-6 mt-6">
+ {examples.map((example) => (
+ <ExampleCard key={example.id} example={example} />
+ ))}
+ </div>
+ </div>
+ </section>
+ );
+};
diff --git a/src/router.tsx b/src/router.tsx
index 980c810f..e1f54e96 100644
--- a/src/router.tsx
+++ b/src/router.tsx
@@ -12,6 +12,7 @@ import { LayoutProvider } from './context/layout-context/layout-provider';
import { DialogProvider } from './context/dialog-context/dialog-provider';
import { ExportImageProvider } from './context/export-image-context/export-image-provider';
import { FullScreenLoaderProvider } from './context/full-screen-spinner-context/full-screen-spinner-provider';
+import { ExamplesPage } from './pages/examples-page/examples-page';
const routes: RouteObject[] = [
...['', 'diagrams/:diagramId'].map((path) => ({
@@ -40,6 +41,14 @@ const routes: RouteObject[] = [
</FullScreenLoaderProvider>
),
})),
+ {
+ path: 'examples',
+ element: (
+ <StorageProvider>
+ <ExamplesPage />
+ </StorageProvider>
+ ),
+ },
{
path: '*',
element: <NotFoundPage />,