Skip to content

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

13.6 KB
Raw Blame
import { DatabaseType } from '@/lib/domain/database-type';
import type { Template } from '../templates-data';
import image from '@/assets/templates/talk-db.png';
import imageDark from '@/assets/templates/talk-db-dark.png';

const now = Date.now();

export const talkDb: Template = {
    slug: 'talk-database',
    name: 'Talk',
    shortDescription: 'Real-time messaging system for Laravel apps',
    description:
        'Real-time user messaging and chatting, enabling easy integration of a complete messaging system into Laravel',
    image,
    imageDark,
    tags: ['MySQL', 'Open Source', 'Laravel', 'PHP'],
    featured: false,
    url: 'https://github.com/nahid/talk',
    diagram: {
        id: 'talk_db',
        name: 'talk-database',
        createdAt: new Date(),
        updatedAt: new Date(),
        databaseType: DatabaseType.MYSQL,
        tables: [
            {
                id: 'c7vc8hqi3g685begamoeynk8d',
                name: 'conversations',
                schema: 't_talk_db',
                x: 100,
                y: 100,
                fields: [
                    {
                        id: 'gjppm3s63owtj652n7pg98ge1',
                        name: 'id',
                        type: {
                            id: 'int',
                            name: 'int',
                        },
                        primaryKey: true,
                        unique: true,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 's7i8ns3s2s90qnwq0f5bhh3os',
                        name: 'user_one',
                        type: {
                            id: 'int',
                            name: 'int',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'ksw3hnnqf8qcbydiyj8mzr62m',
                        name: 'user_two',
                        type: {
                            id: 'int',
                            name: 'int',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'zlv1x0tkmteanxzkr3257c7wc',
                        name: 'status',
                        type: {
                            id: 'tinyint',
                            name: 'tinyint',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'nbdsdsizrfnwonyfxitlv9h6a',
                        name: 'created_at',
                        type: {
                            id: 'datetime',
                            name: 'datetime',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'f154qz15wvtnf5be9y5di0gt5',
                        name: 'updated_at',
                        type: {
                            id: 'datetime',
                            name: 'datetime',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                ],
                indexes: [
                    {
                        id: 'zbze18d7ee2fw29v7ehtcpt2h',
                        name: 'PRIMARY',
                        unique: true,
                        fieldIds: ['gjppm3s63owtj652n7pg98ge1'],
                        createdAt: now,
                    },
                    {
                        id: '3ki3fnfhjcacver3wxpk82wyo',
                        name: 'conversations_user_one_foreign',
                        unique: false,
                        fieldIds: ['s7i8ns3s2s90qnwq0f5bhh3os'],
                        createdAt: now,
                    },
                    {
                        id: '24bjsc5mnqcqx01vidy1hvl3o',
                        name: 'conversations_user_two_foreign',
                        unique: false,
                        fieldIds: ['ksw3hnnqf8qcbydiyj8mzr62m'],
                        createdAt: now,
                    },
                ],
                color: '#ffe374',
                isView: false,
                isMaterializedView: false,
                createdAt: now,
            },
            {
                id: 'hhzhqg75ww5z6hpcclgt744gp',
                name: 'users',
                schema: 't_talk_db',
                x: 452.2341222932548,
                y: 429.1972652762166,
                fields: [
                    {
                        id: '4zee1a93txjpymyykzffgn0yv',
                        name: 'id',
                        type: {
                            id: 'int',
                            name: 'int',
                        },
                        primaryKey: true,
                        unique: true,
                        nullable: false,
                        createdAt: now,
                    },
                ],
                indexes: [
                    {
                        id: 'x5bfcqhwf7z54s3vn13hw3m8u',
                        name: 'PRIMARY',
                        unique: true,
                        fieldIds: ['4zee1a93txjpymyykzffgn0yv'],
                        createdAt: now,
                    },
                ],
                color: '#ff6b8a',
                isView: false,
                isMaterializedView: false,
                createdAt: now,
            },
            {
                id: 'p93y0ksa4riotg9brtg3us955',
                name: 'messages',
                schema: 't_talk_db',
                x: 634.0602484435269,
                y: 7.05018392200941,
                fields: [
                    {
                        id: 'ettweqmom2n5fo0uutyffgnq0',
                        name: 'id',
                        type: {
                            id: 'int',
                            name: 'int',
                        },
                        primaryKey: true,
                        unique: true,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'nm5w9qy0mhqnei6yc1025hwgl',
                        name: 'message',
                        type: {
                            id: 'text',
                            name: 'text',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        collation: 'utf8mb4_0900_ai_ci',
                        createdAt: now,
                    },
                    {
                        id: 'lu21oxdkkmgmhcfmitar7t3cn',
                        name: 'is_seen',
                        type: {
                            id: 'tinyint',
                            name: 'tinyint',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'y2jmvh0bst26ambmvbs8g3jbt',
                        name: 'deleted_from_sender',
                        type: {
                            id: 'tinyint',
                            name: 'tinyint',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'e85i74sgx3shtvtew2eavotpa',
                        name: 'deleted_from_receiver',
                        type: {
                            id: 'tinyint',
                            name: 'tinyint',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: '1xga79r962mnpd944tugdl4op',
                        name: 'user_id',
                        type: {
                            id: 'int',
                            name: 'int',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'chqdcj89fyutwbd3e3t2hsnvf',
                        name: 'conversation_id',
                        type: {
                            id: 'int',
                            name: 'int',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'tk1zdv6msjpuxdo5is0yp66l1',
                        name: 'created_at',
                        type: {
                            id: 'datetime',
                            name: 'datetime',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'qhto8ms1z0lz4o9hztfe1v548',
                        name: 'updated_at',
                        type: {
                            id: 'datetime',
                            name: 'datetime',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                ],
                indexes: [
                    {
                        id: 'zsc4o8e1ipuat9gtvnf763937',
                        name: 'PRIMARY',
                        unique: true,
                        fieldIds: ['ettweqmom2n5fo0uutyffgnq0'],
                        createdAt: now,
                    },
                    {
                        id: '0m73imn1n3n3xcnu8qsm8ibdg',
                        name: 'messages_user_id_foreign',
                        unique: false,
                        fieldIds: ['1xga79r962mnpd944tugdl4op'],
                        createdAt: now,
                    },
                    {
                        id: 'l1rt2wppy72ihb694ogwz01ep',
                        name: 'messages_conversation_id_foreign',
                        unique: false,
                        fieldIds: ['chqdcj89fyutwbd3e3t2hsnvf'],
                        createdAt: now,
                    },
                ],
                color: '#8eb7ff',
                isView: false,
                isMaterializedView: false,
                createdAt: now,
            },
        ],
        relationships: [
            {
                id: '4qbxn9c9guxu4s12o2fut1k2b',
                name: 'conversations_user_two_foreign',
                sourceSchema: 't_talk_db',
                targetSchema: 't_talk_db',
                sourceTableId: 'c7vc8hqi3g685begamoeynk8d',
                targetTableId: 'hhzhqg75ww5z6hpcclgt744gp',
                sourceFieldId: 'ksw3hnnqf8qcbydiyj8mzr62m',
                targetFieldId: '4zee1a93txjpymyykzffgn0yv',
                sourceCardinality: 'many',
                targetCardinality: 'one',
                createdAt: now,
            },
            {
                id: '4uof65m5ev39c3dy016tyhguu',
                name: 'messages_conversation_id_foreign',
                sourceSchema: 't_talk_db',
                targetSchema: 't_talk_db',
                sourceTableId: 'p93y0ksa4riotg9brtg3us955',
                targetTableId: 'c7vc8hqi3g685begamoeynk8d',
                sourceFieldId: 'chqdcj89fyutwbd3e3t2hsnvf',
                targetFieldId: 'gjppm3s63owtj652n7pg98ge1',
                sourceCardinality: 'many',
                targetCardinality: 'one',
                createdAt: now,
            },
            {
                id: 'de4p0tsu4gs07m76534tomu9k',
                name: 'messages_user_id_foreign',
                sourceSchema: 't_talk_db',
                targetSchema: 't_talk_db',
                sourceTableId: 'p93y0ksa4riotg9brtg3us955',
                targetTableId: 'hhzhqg75ww5z6hpcclgt744gp',
                sourceFieldId: '1xga79r962mnpd944tugdl4op',
                targetFieldId: '4zee1a93txjpymyykzffgn0yv',
                sourceCardinality: 'many',
                targetCardinality: 'one',
                createdAt: now,
            },
            {
                id: 'ro7uwskdw8b1mj833n9m82yn9',
                name: 'conversations_user_one_foreign',
                sourceSchema: 't_talk_db',
                targetSchema: 't_talk_db',
                sourceTableId: 'c7vc8hqi3g685begamoeynk8d',
                targetTableId: 'hhzhqg75ww5z6hpcclgt744gp',
                sourceFieldId: 's7i8ns3s2s90qnwq0f5bhh3os',
                targetFieldId: '4zee1a93txjpymyykzffgn0yv',
                sourceCardinality: 'many',
                targetCardinality: 'one',
                createdAt: now,
            },
        ],
        dependencies: [],
    },
};