import { RelationalDiagram } from 'ts-prorm-orm';
const svg = new RelationalDiagram({
title: 'Blog cardinality',
entities: [
{ name: 'User', columns: [
{ name: 'id', type: 'INTEGER', primaryKey: true },
{ name: 'email', type: 'VARCHAR(255)' },
] },
{ name: 'Post', columns: [
{ name: 'id', type: 'INTEGER', primaryKey: true },
{ name: 'title', type: 'VARCHAR(200)' },
{ name: 'authorId', type: 'INTEGER', foreignKey: true },
] },
{ name: 'Tag', columns: [
{ name: 'id', type: 'INTEGER', primaryKey: true },
{ name: 'slug', type: 'VARCHAR(60)' },
] },
],
relationships: [
{ from: 'User', to: 'Post', type: 'one-to-many' },
{ from: 'Post', to: 'Tag', type: 'many-to-many' },
],
}).generate();