Skip to main content

Database Schema

The following diagram represents the core tables and relationships in the Jet Admin database, generated from the Prisma Schema.

Entity Relationship Diagram

Core Entities

User Management

TableDescription
tblUsersSystem users synced with Firebase Authentication
tblTenantsWorkspaces/organizations in the multi-tenant system
tblUsersTenantsRelationshipJunction table linking users to tenants with roles
tblRolesRole definitions (Admin, Editor, Viewer)
tblPermissionsGranular permissions assigned to roles

Resources (Tenant-Scoped)

TableDescription
tblDatasourcesExternal database connection configurations (encrypted)
tblDataQueriesSaved SQL/API queries for reuse
tblWorkflowsWorkflow metadata and settings
tblWorkflowVersionsVersioned workflow graph (nodes/edges as JSON)
tblDashboardsDashboard layouts and settings
tblWidgetsWidget instances with configuration

Runtime & Logging

TableDescription
tblWorkflowInstancesIndividual workflow execution runs
tblNodeExecutionLogsPer-node execution logs within a run
tblAuditLogsSecurity audit trail for compliance
tblCronJobsScheduled task configurations

Key Design Patterns

  • Multi-tenancy: All resource tables have a tenantID foreign key for data isolation
  • UUIDs: Primary keys use gen_random_uuid() for distributed ID generation
  • Soft Deletes: Critical tables support deletedAt for recoverable deletion
  • Timestamps: Standard createdAt and updatedAt on all tables
  • Encrypted Fields: Datasource credentials are AES-encrypted at rest