Database diagrams editor that allows you to visualize and design your DB with a single query.
TypeScript databasedbdb-migrationeditorerdmariadbmssqlmysqlpostgresqlreactreact-flowschema-migrationssqlsqlitetypescriptvisualizationxyflow
add visual novel db template (#307)
Jonathan Fishner9ac26dbf7a24
diff --git a/src/assets/templates/visual-novel-db-dark.png b/src/assets/templates/visual-novel-db-dark.pngnew file mode 100644index 00000000..5fdc203aBinary files /dev/null and b/src/assets/templates/visual-novel-db-dark.png differdiff --git a/src/assets/templates/visual-novel-db.png b/src/assets/templates/visual-novel-db.pngnew file mode 100644index 00000000..0622cde7Binary files /dev/null and b/src/assets/templates/visual-novel-db.png differdiff --git a/src/pages/template-page/template-page.tsx b/src/pages/template-page/template-page.tsxindex 10b84f33..0b6e2218 100644--- a/src/pages/template-page/template-page.tsx+++ b/src/pages/template-page/template-page.tsx@@ -195,7 +195,7 @@ const TemplatePageComponent: React.FC = () => {{template.tags.map((tag) => (<Badgevariant="outline"- key={`${template.id}_${tag}`}+ key={`${template.slug}_${tag}`}>{tag}</Badge>diff --git a/src/pages/templates-page/template-card/template-card.tsx b/src/pages/templates-page/template-card/template-card.tsxindex 85fb6304..b1a8df1c 100644--- a/src/pages/templates-page/template-card/template-card.tsx+++ b/src/pages/templates-page/template-card/template-card.tsx@@ -71,7 +71,10 @@ export const TemplateCard: React.FC<TemplateCardProps> = ({ template }) => {</div><div className="flex flex-wrap gap-1 p-2">{template.tags.map((tag) => (- <Badge variant="outline" key={`${template.id}_${tag}`}>+ <Badge+ variant="outline"+ key={`${template.slug}_${tag}`}+ >{tag}</Badge>))}diff --git a/src/pages/templates-page/templates-page.tsx b/src/pages/templates-page/templates-page.tsxindex b860bae9..c5d0f8c7 100644--- a/src/pages/templates-page/templates-page.tsx+++ b/src/pages/templates-page/templates-page.tsx@@ -133,7 +133,7 @@ const TemplatesPageComponent: React.FC = () => {<div className="grid flex-1 grid-flow-row grid-cols-1 gap-6 md:grid-cols-1 lg:grid-cols-2 xl:grid-cols-4">{templates.map((template) => (<TemplateCard- key={`${template.id}`}+ key={`${template.slug}`}template={template}/>))}diff --git a/src/templates-data/templates-data.ts b/src/templates-data/templates-data.tsindex f43f772a..07caa1c8 100644--- a/src/templates-data/templates-data.ts+++ b/src/templates-data/templates-data.ts@@ -1,8 +1,8 @@import type { Diagram } from '@/lib/domain/diagram';import { employeeDb } from './templates/employee-db';+import { visualNovelDb } from './templates/visual-novel-db';export interface Template {- id: string;slug: string;name: string;shortDescription: string;@@ -11,7 +11,9 @@ export interface Template {imageDark: string;diagram: Diagram;tags: string[];+ keywords: string[];featured: boolean;+ url?: string;}-export const templates: Template[] = [employeeDb];+export const templates: Template[] = [employeeDb, visualNovelDb];diff --git a/src/templates-data/templates/employee-db.ts b/src/templates-data/templates/employee-db.tsindex 0f3e6477..9a332cff 100644--- a/src/templates-data/templates/employee-db.ts+++ b/src/templates-data/templates/employee-db.ts@@ -4,7 +4,6 @@ import image from '@/assets/templates/employeedb.png';import imageDark from '@/assets/templates/employeedb-dark.png';export const employeeDb: Template = {- id: '1',slug: 'employees-db',name: 'Employees schema',shortDescription: 'Employees, departments, and salaries',@@ -13,6 +12,18 @@ export const employeeDb: Template = {image,imageDark,tags: ['mysql'],+ keywords: [+ 'Employees database schema',+ 'Employees database template',+ 'database schema visualization',+ 'Employees database design',+ 'ChartDB',+ 'Employees schema diagram',+ 'relational database structure',+ 'Employees development',+ 'Employees tables',+ 'database template for Employees',+ ],featured: true,diagram: {id: 'diagramexample01',diff --git a/src/templates-data/templates/visual-novel-db.ts b/src/templates-data/templates/visual-novel-db.tsnew file mode 100644index 00000000..1bd2329f--- /dev/null+++ b/src/templates-data/templates/visual-novel-db.ts@@ -0,0 +1,630 @@+import { DatabaseType } from '@/lib/domain/database-type';+import type { Template } from '../templates-data';+import image from '@/assets/templates/visual-novel-db.png';+import imageDark from '@/assets/templates/visual-novel-db-dark.png';++export const visualNovelDb: Template = {+ slug: 'visual-novel-db',+ name: 'The Visual Novel Database | vndb',+ shortDescription: 'The Visual Novel Database | vndb',+ description: 'A comprehensive database for information about visual novels',+ image,+ imageDark,+ tags: ['postgres'],+ keywords: [+ 'VNDB',+ 'visual novel database schema',+ 'visual novel database template',+ 'database schema visualization',+ 'visual novel database design',+ 'ChartDB',+ 'VNDB schema diagram',+ 'relational database structure',+ 'VNDB development',+ 'VNDB tables',+ 'database template for VNDB',+ ],+ featured: true,+ url: 'https://vndb.org',+ diagram: {+ id: 'visual_novel_db',+ name: 'visual-novel-db',+ createdAt: new Date(),+ updatedAt: new Date(),+ databaseType: DatabaseType.POSTGRESQL,+ tables: [+ {+ id: '6e70s6dhdfnve9xljbih6bo7x',+ name: 'departments',+ x: 488.2056573620456,+ y: -116.26128764468365,+ fields: [+ {+ id: 'gaj3scrtaz46ezfmc162ingxf',+ name: 'dept_no',+ type: { id: 'char', name: 'chat' },+ primaryKey: true,+ unique: true,+ nullable: false,+ characterMaximumLength: '4',+ collation: 'utf8mb4_general_ci',+ createdAt: Date.now(),+ },+ {+ id: 'pb0j4xvevy9dics5euelx7ay9',+ name: 'dept_name',+ type: { id: 'varchar', name: '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,+ isMaterializedView: false,+ createdAt: Date.now(),+ },+ {+ id: 'rkc38w1yqrvhz2pmveunp6nsw',+ name: 'dept_emp',+ x: 809.6786878331093,+ y: 13.918352368775231,+ fields: [+ {+ id: 'wcgycjif09xrq0ly3txkq6ocu',+ name: 'emp_no',+ type: { id: 'int', name: 'int' },+ primaryKey: true,+ unique: true,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: 'jdw1yrh9xf1i7927gzs9pob2p',+ name: 'dept_no',+ type: { id: 'char', name: 'chat' },+ primaryKey: true,+ unique: true,+ nullable: false,+ characterMaximumLength: '4',+ collation: 'utf8mb4_general_ci',+ createdAt: Date.now(),+ },+ {+ id: 'm3zu12iy2jmfraliisks0rqcv',+ name: 'from_date',+ type: { id: 'date', name: 'date' },+ primaryKey: false,+ unique: false,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: 'yq4k0bqt39aap0956aejicud4',+ name: 'to_date',+ type: { id: 'date', name: '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,+ isMaterializedView: false,+ createdAt: Date.now(),+ },+ {+ id: 'd2xqiqlffjfsg3kgsmpck5xay',+ name: 'dept_manager',+ x: -248.93599999999998,+ y: -84.16474999999997,+ fields: [+ {+ id: 'ecx2zbzdc5o54e04aeg7tlg54',+ name: 'emp_no',+ type: { id: 'int', name: 'int' },+ primaryKey: true,+ unique: true,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: 'v8plj7wq1cly03y178bysft2f',+ name: 'dept_no',+ type: { id: 'char', name: 'chat' },+ primaryKey: true,+ unique: true,+ nullable: false,+ characterMaximumLength: '4',+ collation: 'utf8mb4_general_ci',+ createdAt: Date.now(),+ },+ {+ id: '3u0rfkvw0yokndqhfqx0nuzpi',+ name: 'from_date',+ type: { id: 'date', name: 'date' },+ primaryKey: false,+ unique: false,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: 'xrcw2488t50shssn4vn3n6vad',+ name: 'to_date',+ type: { id: 'date', name: '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,+ isMaterializedView: false,+ createdAt: Date.now(),+ },+ {+ id: '1c03hu41ko98myywerwbazeli',+ name: 'employees',+ x: 82.72000000000003,+ y: 98.27199999999999,+ fields: [+ {+ id: '04csyx8ds9t3rh93txiqs4dm4',+ name: 'emp_no',+ type: { id: 'int', name: 'int' },+ primaryKey: true,+ unique: true,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: 'gnvcnj2i5jgktg7vauhveaorb',+ name: 'birth_date',+ type: { id: 'date', name: 'date' },+ primaryKey: false,+ unique: false,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: '8savn7ht0fogo4odxdhekrret',+ name: 'first_name',+ type: { id: 'varchar', name: 'varchar' },+ primaryKey: false,+ unique: false,+ nullable: false,+ characterMaximumLength: '14',+ collation: 'utf8mb4_general_ci',+ createdAt: Date.now(),+ },+ {+ id: 'ol8kezsspmjx25avlf2dvic5q',+ name: 'last_name',+ type: { id: 'varchar', name: 'varchar' },+ primaryKey: false,+ unique: false,+ nullable: false,+ characterMaximumLength: '16',+ collation: 'utf8mb4_general_ci',+ createdAt: Date.now(),+ },+ {+ id: 'jga5lfkkoxueqslcljj2vng9q',+ name: 'gender',+ type: { id: 'enum', name: 'enum' },+ primaryKey: false,+ unique: false,+ nullable: false,+ characterMaximumLength: '1',+ collation: 'utf8mb4_general_ci',+ createdAt: Date.now(),+ },+ {+ id: 'i0kgsun3nzrjpaz8ykwjgogyb',+ name: 'hire_date',+ type: { id: 'date', name: '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,+ isMaterializedView: false,+ createdAt: Date.now(),+ },+ {+ id: 'u97myqcs1osilg7x0v263qpzd',+ name: 'salaries',+ x: 493.50755288021537,+ y: 227.8719999999999,+ fields: [+ {+ id: 'b8c9v5vtpbnt5tjzcd3iat85f',+ name: 'emp_no',+ type: { id: 'int', name: 'int' },+ primaryKey: true,+ unique: true,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: 'n654h28i8yeeadznzht9mjc8f',+ name: 'salary',+ type: { id: 'int', name: 'int' },+ primaryKey: false,+ unique: false,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: '0s10erufqpl6y3hpqmvbcneol',+ name: 'from_date',+ type: { id: 'date', name: 'date' },+ primaryKey: true,+ unique: true,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: 'bwohji7dj67xpa6p5diyy6pis',+ name: 'to_date',+ type: { id: 'date', name: 'date' },+ primaryKey: false,+ unique: false,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: 'orkgizf8qbmtly3rw5cbxtc2i',+ name: 'price',+ type: { id: 'decimal', name: '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,+ isMaterializedView: false,+ createdAt: Date.now(),+ },+ {+ id: 'fa0ozznyrckx572fqztyw3w4z',+ name: 'titles',+ x: -251.04799999999966,+ y: 220.9599999999999,+ fields: [+ {+ id: 'hr2gdoc0wtwvs4pfqo6m0fwc3',+ name: 'emp_no',+ type: { id: 'int', name: 'int' },+ primaryKey: true,+ unique: true,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: '5evr59tury66sayiu59esoc61',+ name: 'title',+ type: { id: 'varchar', name: 'varchar' },+ primaryKey: true,+ unique: true,+ nullable: false,+ characterMaximumLength: '50',+ collation: 'utf8mb4_general_ci',+ createdAt: Date.now(),+ },+ {+ id: '0vs1nqvrb6t53niz5ns2eskre',+ name: 'from_date',+ type: { id: 'date', name: 'date' },+ primaryKey: true,+ unique: true,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: 'n6csxwmdm60y920p5jovlx4c6',+ name: 'to_date',+ type: { id: 'date', name: '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,+ isMaterializedView: false,+ createdAt: Date.now(),+ },+ {+ id: 'gq5r3cuh74h1xzgzjmiu26t1e',+ name: 'current_dept_emp',+ x: 393.01599999999996,+ y: 488.65600000000006,+ fields: [+ {+ id: '8tz9jdtfrbbl4c0e7nthrj90g',+ name: 'emp_no',+ type: { id: 'int', name: 'int' },+ primaryKey: false,+ unique: false,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: 'fv7o6txqvmy2349aq3pg0hnkm',+ name: 'dept_no',+ type: { id: 'char', name: 'chat' },+ primaryKey: false,+ unique: false,+ nullable: false,+ characterMaximumLength: '4',+ collation: 'utf8mb4_general_ci',+ createdAt: Date.now(),+ },+ {+ id: 'hneqjqobdvcumv91ymvqhv42a',+ name: 'from_date',+ type: { id: 'date', name: 'date' },+ primaryKey: false,+ unique: false,+ nullable: true,+ createdAt: Date.now(),+ },+ {+ id: 'n9yj0xtw6uu0aqn2ankvniuat',+ name: 'to_date',+ type: { id: 'date', name: 'date' },+ primaryKey: false,+ unique: false,+ nullable: true,+ createdAt: Date.now(),+ },+ ],+ indexes: [],+ color: '#b0b0b0',+ isView: true,+ isMaterializedView: false,+ createdAt: Date.now(),+ },+ {+ id: 'q248uisjcid20tdqfnbj5qec6',+ name: 'dept_emp_latest_date',+ x: 70.62399999999991,+ y: 469.6479999999999,+ fields: [+ {+ id: 'q3oiwd0p27bipsy4kg5dkxri0',+ name: 'emp_no',+ type: { id: 'int', name: 'int' },+ primaryKey: false,+ unique: false,+ nullable: false,+ createdAt: Date.now(),+ },+ {+ id: 'dxhqoscu6zk87ob7sfvxo7if4',+ name: 'from_date',+ type: { id: 'date', name: 'date' },+ primaryKey: false,+ unique: false,+ nullable: true,+ createdAt: Date.now(),+ },+ {+ id: 'ys76pzey5i9twf13g2g0taju7',+ name: 'to_date',+ type: { id: 'date', name: 'date' },+ primaryKey: false,+ unique: false,+ nullable: true,+ createdAt: Date.now(),+ },+ ],+ indexes: [],+ color: '#b0b0b0',+ isView: true,+ isMaterializedView: false,+ createdAt: Date.now(),+ },+ ],+ relationships: [+ {+ id: 'cciaonuhfnjdvntl9gv4lrsbk',+ name: 'dept_emp_ibfk_1',+ sourceTableId: 'rkc38w1yqrvhz2pmveunp6nsw',+ targetTableId: '1c03hu41ko98myywerwbazeli',+ sourceFieldId: 'wcgycjif09xrq0ly3txkq6ocu',+ targetFieldId: '04csyx8ds9t3rh93txiqs4dm4',++ sourceCardinality: 'many',+ targetCardinality: 'one',+ createdAt: Date.now(),+ },+ {+ id: 'b9y9q200df95qtzdi4lkeiw2w',+ name: 'dept_emp_ibfk_2',+ sourceTableId: 'rkc38w1yqrvhz2pmveunp6nsw',+ targetTableId: '6e70s6dhdfnve9xljbih6bo7x',+ sourceFieldId: 'jdw1yrh9xf1i7927gzs9pob2p',+ targetFieldId: 'gaj3scrtaz46ezfmc162ingxf',++ sourceCardinality: 'many',+ targetCardinality: 'one',+ createdAt: Date.now(),+ },+ {+ id: 'tt4jz3plk26zz3p8hvu3e4m27',+ name: 'dept_manager_ibfk_1',+ sourceTableId: 'd2xqiqlffjfsg3kgsmpck5xay',+ targetTableId: '1c03hu41ko98myywerwbazeli',+ sourceFieldId: 'ecx2zbzdc5o54e04aeg7tlg54',+ targetFieldId: '04csyx8ds9t3rh93txiqs4dm4',++ sourceCardinality: 'many',+ targetCardinality: 'one',+ createdAt: Date.now(),+ },+ {+ id: 'y3p9kp0rcfle3ivoe2owx7tu3',+ name: 'dept_manager_ibfk_2',+ sourceTableId: 'd2xqiqlffjfsg3kgsmpck5xay',+ targetTableId: '6e70s6dhdfnve9xljbih6bo7x',+ sourceFieldId: 'v8plj7wq1cly03y178bysft2f',+ targetFieldId: 'gaj3scrtaz46ezfmc162ingxf',++ sourceCardinality: 'many',+ targetCardinality: 'one',+ createdAt: Date.now(),+ },+ {+ id: 'imavnkr77bjlanlaxj3og9fh6',+ name: 'salaries_ibfk_1',+ sourceTableId: 'u97myqcs1osilg7x0v263qpzd',+ targetTableId: '1c03hu41ko98myywerwbazeli',+ sourceFieldId: 'b8c9v5vtpbnt5tjzcd3iat85f',+ targetFieldId: '04csyx8ds9t3rh93txiqs4dm4',++ sourceCardinality: 'many',+ targetCardinality: 'one',+ createdAt: Date.now(),+ },+ {+ id: 'x4m88eqis6owszjfozerntmzt',+ name: 'titles_ibfk_1',+ sourceTableId: 'fa0ozznyrckx572fqztyw3w4z',+ targetTableId: '1c03hu41ko98myywerwbazeli',+ sourceFieldId: 'hr2gdoc0wtwvs4pfqo6m0fwc3',+ targetFieldId: '04csyx8ds9t3rh93txiqs4dm4',++ sourceCardinality: 'many',+ targetCardinality: 'one',+ createdAt: Date.now(),+ },+ ],+ },+};