Database Schema

Overview of the database schema and types used in the application

Core Schemas

Users & Authentication

  • users - Core user information and profiles
  • auth - Authentication-related tables and sessions

Workspaces

  • workspaces - Workspace configuration and settings
  • workspaceMembers - Workspace membership and roles
  • invitations - Pending workspace invitations

Permissions & Access Control

  • permissions - RBAC permissions definitions
  • roles - User roles and capabilities

Feature Schemas

Notifications

  • notifications - User notifications
  • userNotificationSettings - Notification preferences

Billing & Subscriptions

  • subscriptions - Workspace subscription details

Integration

  • items - Generic items storage

Type Definitions

Inferred Types

The following TypeScript types are automatically inferred from the schema:

TYPESCRIPT

Schema Organization

File Structure

All schema definitions are organized in separate files under server/drizzle/schema/ and exported through a central index.ts file. This modular approach allows for:

  • 1
    Better code organization and maintainability
  • 2
    Easier schema updates and migrations
  • 3
    Clear separation of concerns
  • 4
    Type-safe database operations

Key Features

🔄

Type Safety

Full TypeScript integration with Drizzle ORM

📊

Schema Migrations

Automated migration generation and application

🔍

Query Building

Type-safe query building with autocompletion

🛡️

Validation

Runtime validation with Zod integration