Database diagrams editor that allows you to visualize and design your DB with a single query.
TypeScript databasedbdb-migrationeditorerdmariadbmssqlmysqlpostgresqlreactreact-flowschema-migrationssqlsqlitetypescriptvisualizationxyflow
import { DatabaseType } from '@/lib/domain/database-type';
import type { Template } from '../templates-data';
import image from '@/assets/templates/laravel-permission-db.png';
import imageDark from '@/assets/templates/laravel-permission-db-dark.png';
const now = Date.now();
export const laravelPermissionDb: Template = {
slug: 'laravel-permission-database',
name: 'Laravel Permission',
shortDescription: 'Roles and Permission For Laravel',
description:
'Associate users with roles and permissions (Laravel-Permission on github)',
image,
imageDark,
tags: ['Postgres', 'Open Source', 'Laravel', 'PHP'],
featured: false,
url: 'https://github.com/spatie/laravel-permission',
diagram: {
id: 'laravel_permission_db',
name: 'laravel-permission-database',
createdAt: new Date(),
updatedAt: new Date(),
databaseType: DatabaseType.POSTGRESQL,
tables: [
{
id: '2620qxtifbx20r7mbpjeujv4j',
name: 'roles',
schema: 'public',
x: 464.87710843373475,
y: 100,
fields: [
{
id: 'poke4psscnh9kcnjhksaaujnf',
name: 'id',
type: {
id: 'bigint',
name: 'bigint',
},
primaryKey: true,
unique: true,
nullable: false,
createdAt: now,
},
{
id: 'zmecmt42pnfcvm60fymzzvb4a',
name: 'name',
type: {
id: 'character_varying',
name: 'character varying',
},
primaryKey: false,
unique: false,
nullable: false,
createdAt: now,
},
{
id: 'qaq3tbo01ijru1x03f3kg1evr',
name: 'guard_name',
type: {
id: 'character_varying',
name: 'character varying',
},
primaryKey: false,
unique: false,
nullable: false,
createdAt: now,
},
{
id: 'y9d6p7p7easu8soxbu6t3eydc',
name: 'created_at',
type: {
id: 'timestamp_without_time_zone',
name: 'timestamp without time zone',
},
primaryKey: false,
unique: false,
nullable: true,
createdAt: now,
},
{
id: 'qoci8vbx8jvoqmdtnmpany9gb',
name: 'updated_at',
type: {
id: 'timestamp_without_time_zone',
name: 'timestamp without time zone',
},
primaryKey: false,
unique: false,
nullable: true,
createdAt: now,
},
],
indexes: [
{
id: '1en34nunvxrt4275dsgcvww4l',
name: 'roles_pkey',
unique: true,
fieldIds: ['poke4psscnh9kcnjhksaaujnf'],
createdAt: now,
},
{
id: 'spqunz0hxv2bg874w0m1y36r4',
name: 'unique_role_name',
unique: true,
fieldIds: [
'zmecmt42pnfcvm60fymzzvb4a',
'qaq3tbo01ijru1x03f3kg1evr',
],
createdAt: now,
},
],
color: '#4dee8a',
isView: false,
isMaterializedView: false,
createdAt: now,
},
{
id: '4bfk337wvmggh25gtuv9xu2l2',
name: 'model_has_permissions',
schema: 'public',
x: -272.1075069508805,
y: -78.51195551436513,
fields: [
{
id: 'o6hhvn4ygrxnqnrzt3078st9i',
name: 'permission_id',
type: {
id: 'bigint',
name: 'bigint',
},
primaryKey: true,
unique: false,
nullable: false,
createdAt: now,
},
{
id: 'zxtynvat7f4oxf2c1zpqal1fk',
name: 'model_type',
type: {
id: 'character_varying',
name: 'character varying',
},
primaryKey: true,
unique: false,
nullable: false,
createdAt: now,
},
{
id: 'r5bioxa56ghm7mlk4r9x9a5o6',
name: 'model_id',
type: {
id: 'integer',
name: 'integer',
},
primaryKey: true,
unique: false,
nullable: false,
createdAt: now,
},
],
indexes: [
{
id: 'bf1u0pks34k83iozivuhjvwha',
name: 'idx_permission_model_type',
unique: false,
fieldIds: [
'o6hhvn4ygrxnqnrzt3078st9i',
'zxtynvat7f4oxf2c1zpqal1fk',
],
createdAt: now,
},
{
id: '8vdxiolssrpakzuv7twx3yk5o',
name: 'model_has_permissions_pkey',
unique: true,
fieldIds: [
'o6hhvn4ygrxnqnrzt3078st9i',
'r5bioxa56ghm7mlk4r9x9a5o6',
'zxtynvat7f4oxf2c1zpqal1fk',
],
createdAt: now,
},
{
id: 'l00lk7nit3rr3rja4jzwpbg9z',
name: 'idx_model_id_type',
unique: false,
fieldIds: [
'r5bioxa56ghm7mlk4r9x9a5o6',
'zxtynvat7f4oxf2c1zpqal1fk',
],
createdAt: now,
},
],
color: '#ff6b8a',
isView: false,
isMaterializedView: false,
createdAt: now,
},
{
id: 'd1ehpum03i9bnnfawx9rq3zq7',
name: 'model_has_roles',
schema: 'public',
x: 33.680815569972424,
y: 111.89050046339204,
fields: [
{
id: '6jgasj9vo69w60b5237un1zx3',
name: 'role_id',
type: {
id: 'bigint',
name: 'bigint',
},
primaryKey: true,
unique: false,
nullable: false,
createdAt: now,
},
{
id: 'hghqz8b4rcwkmp90xzxgcvtnq',
name: 'model_type',
type: {
id: 'character_varying',
name: 'character varying',
},
primaryKey: true,
unique: false,
nullable: false,
createdAt: now,
},
{
id: 'xmqnxspc9au3kr8ii4a58xm9y',
name: 'model_id',
type: {
id: 'integer',
name: 'integer',
},
primaryKey: true,
unique: false,
nullable: false,
createdAt: now,
},
],
indexes: [
{
id: '6n1klb9uu2h1cla1fvzrjbi95',
name: 'idx_model_id_type_roles',
unique: false,
fieldIds: [
'xmqnxspc9au3kr8ii4a58xm9y',
'hghqz8b4rcwkmp90xzxgcvtnq',
],
createdAt: now,
},
{
id: '9h1sf1k29qbz3sv2itdfrk4dk',
name: 'model_has_roles_pkey',
unique: true,
fieldIds: [
'6jgasj9vo69w60b5237un1zx3',
'xmqnxspc9au3kr8ii4a58xm9y',
'hghqz8b4rcwkmp90xzxgcvtnq',
],
createdAt: now,
},
{
id: 'c86wjo6kj2ovehsxxa2enllp9',
name: 'idx_role_model_type',
unique: false,
fieldIds: [
'6jgasj9vo69w60b5237un1zx3',
'hghqz8b4rcwkmp90xzxgcvtnq',
],
createdAt: now,
},
],
color: '#c05dcf',
isView: false,
isMaterializedView: false,
createdAt: now,
},
{
id: 'n1ybvm5upr14p0628603p30f7',
name: 'role_has_permissions',
schema: 'public',
x: 501.8594995366079,
y: -188.2224281742354,
fields: [
{
id: '5gweun1ja59v4j0iwew7qtmug',
name: 'permission_id',
type: {
id: 'bigint',
name: 'bigint',
},
primaryKey: true,
unique: false,
nullable: false,
createdAt: now,
},
{
id: 'ax62xq5y074x11xlo5fgilbxw',
name: 'role_id',
type: {
id: 'bigint',
name: 'bigint',
},
primaryKey: true,
unique: false,
nullable: false,
createdAt: now,
},
],
indexes: [
{
id: '5qpx9oexxq8hpeth52284mcpo',
name: 'role_has_permissions_pkey',
unique: true,
fieldIds: [
'5gweun1ja59v4j0iwew7qtmug',
'ax62xq5y074x11xlo5fgilbxw',
],
createdAt: now,
},
{
id: 'upkdmo20fjun4mliamza4hddh',
name: 'idx_permission_role',
unique: false,
fieldIds: [
'5gweun1ja59v4j0iwew7qtmug',
'ax62xq5y074x11xlo5fgilbxw',
],
createdAt: now,
},
],
color: '#ffe374',
isView: false,
isMaterializedView: false,
createdAt: now,
},
{
id: 's6ocy1b7i68o367j8f3jpp0x9',
name: 'permissions',
schema: 'public',
x: 59.09101019462469,
y: -303.5113994439296,
fields: [
{
id: 'xbh22rbm01xf67vlb4iob7s2m',
name: 'id',
type: {
id: 'bigint',
name: 'bigint',
},
primaryKey: true,
unique: true,
nullable: false,
createdAt: now,
},
{
id: 'p6w2uqym56yh11li8j7ie80y6',
name: 'name',
type: {
id: 'character_varying',
name: 'character varying',
},
primaryKey: false,
unique: false,
nullable: false,
createdAt: now,
},
{
id: 'kdg8mlkz9xv23yigbev3548o1',
name: 'guard_name',
type: {
id: 'character_varying',
name: 'character varying',
},
primaryKey: false,
unique: false,
nullable: false,
createdAt: now,
},
{
id: 'lnuejviuvqhbe5xis5lx6g88u',
name: 'created_at',
type: {
id: 'timestamp_without_time_zone',
name: 'timestamp without time zone',
},
primaryKey: false,
unique: false,
nullable: true,
createdAt: now,
},
{
id: '6e7k9krkbuw3mu50j1l2j1a5p',
name: 'updated_at',
type: {
id: 'timestamp_without_time_zone',
name: 'timestamp without time zone',
},
primaryKey: false,
unique: false,
nullable: true,
createdAt: now,
},
],
indexes: [
{
id: 'h0nxliia478xydaxwh3ez348i',
name: 'unique_permission_name',
unique: true,
fieldIds: [
'p6w2uqym56yh11li8j7ie80y6',
'kdg8mlkz9xv23yigbev3548o1',
],
createdAt: now,
},
{
id: '6kwd6xdwm5ffff0e6nc0pth9d',
name: 'permissions_pkey',
unique: true,
fieldIds: ['xbh22rbm01xf67vlb4iob7s2m'],
createdAt: now,
},
],
color: '#ff9f74',
isView: false,
isMaterializedView: false,
createdAt: now,
},
],
relationships: [
{
id: 'm90ygayyu34f13rsqhkuntip6',
name: 'model_has_permissions_permission_id_fkey',
sourceSchema: 'public',
targetSchema: 'public',
sourceTableId: '4bfk337wvmggh25gtuv9xu2l2',
targetTableId: 's6ocy1b7i68o367j8f3jpp0x9',
sourceFieldId: 'o6hhvn4ygrxnqnrzt3078st9i',
targetFieldId: 'xbh22rbm01xf67vlb4iob7s2m',
sourceCardinality: 'many',
targetCardinality: 'one',
createdAt: now,
},
{
id: 'pqohktmdce5leh9xy89an1dvu',
name: 'role_has_permissions_role_id_fkey',
sourceSchema: 'public',
targetSchema: 'public',
sourceTableId: 'n1ybvm5upr14p0628603p30f7',
targetTableId: '2620qxtifbx20r7mbpjeujv4j',
sourceFieldId: 'ax62xq5y074x11xlo5fgilbxw',
targetFieldId: 'poke4psscnh9kcnjhksaaujnf',
sourceCardinality: 'many',
targetCardinality: 'one',
createdAt: now,
},
{
id: 'qyuoq0fn7j2ldvt9952o5quom',
name: 'model_has_roles_role_id_fkey',
sourceSchema: 'public',
targetSchema: 'public',
sourceTableId: 'd1ehpum03i9bnnfawx9rq3zq7',
targetTableId: '2620qxtifbx20r7mbpjeujv4j',
sourceFieldId: '6jgasj9vo69w60b5237un1zx3',
targetFieldId: 'poke4psscnh9kcnjhksaaujnf',
sourceCardinality: 'many',
targetCardinality: 'one',
createdAt: now,
},
{
id: 'td5vwiqogewiwky7uexog5hj1',
name: 'role_has_permissions_permission_id_fkey',
sourceSchema: 'public',
targetSchema: 'public',
sourceTableId: 'n1ybvm5upr14p0628603p30f7',
targetTableId: 's6ocy1b7i68o367j8f3jpp0x9',
sourceFieldId: '5gweun1ja59v4j0iwew7qtmug',
targetFieldId: 'xbh22rbm01xf67vlb4iob7s2m',
sourceCardinality: 'many',
targetCardinality: 'one',
createdAt: now,
},
],
dependencies: [],
},
};