Eddy Dev Handbook
Technical reference

Database Schema

Complete database structure and relationships for the Eddy platform

Database Schema Documentation

Source: This page is based on docs/DATABASE_SCHEMA.md

Last Updated: January 8, 2026

Database Type: PostgreSQL
Total Tables: 54

This document provides a comprehensive overview of the Eddy database schema, organized by functional domain.

Overview

The Eddy database is structured around several key domains:

  • Core Entities - Users, groups, workflows, and workflow runs
  • Workflow Structure - Pages, blocks, sections, and transitions
  • Data Storage - Sheets, columns, rows, and cells
  • Execution - Workflow run stages and progression
  • Assignments & Roles - User roles and permissions
  • Collaboration - Discussions, comments, and polls
  • Organization - Memberships and invitations

Entity Relationship Overview

The Workflow Hierarchy

groups
  └── workflows
        ├── pages
        │     ├── sections
        │     │     └── blocks
        │     └── page_transitions
        └── workflow_runs (sessions)
              └── workflow_run_stages

The Sheet Hierarchy

groups
  └── sheets
        ├── columns
        └── rows
              └── cells

The Assignment Chain

workflows
  └── workflow_roles
        └── stage_role_assignments
              └── session_role_assignments
                    └── session_assignments

Core Entities

users

User accounts in the system.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique user identifier
auth0Idvarchar(255)NOT NULL, INDEXEDAuth0 authentication ID
emailvarchar(255)NOT NULLUser email address
namevarchar(255)User display name
phototextProfile photo URL
workflow_preferencesjsonbUser workflow preferences
is_superadminbooleanWhether user is a superadmin
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Indexes:

  • users_auth0id_index on auth0Id

Relationships:

  • Has many memberships
  • Has many workflows (as creator)
  • Has many workflow_runs (as participant)

groups

Workspaces or organizations that contain workflows and members.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique group identifier
namevarchar(255)Group name
descriptiontextGroup description
creator_iduuidFK → users(id)User who created the group
publicbooleanWhether group is publicly accessible
phototextGroup photo URL
bannertextGroup banner URL
open_ai_api_keyvarchar(255)OpenAI API key for group
email_optionsjsonbEmail configuration options
brand_logovarchar(255)Brand logo URL
brand_optionsjsonbBrand customization options
archived_attimestamptzSoft delete timestamp
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • creator_idusers(id)

Relationships:

  • Has many workflows
  • Has many sheets
  • Has many memberships

workflows

Workflow templates that define processes.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique workflow identifier
namevarchar(255)Workflow name
descriptiontextWorkflow description
user_iduuidFK → users(id)Creator user ID
group_iduuidAssociated group ID
scaffold_sheet_iduuidFK → sheets(id)Scaffold sheet reference
source_workflow_iduuidFK → workflows(id)Source workflow if copied
published_attimestamptzPublication timestamp
archived_attimestamptzSoft delete timestamp
publicbooleanWhether workflow is public
singletonbooleanDEFAULT falseOnly one run can exist at a time
restricted_stage_visibilitybooleanDEFAULT falseRestrict stage visibility
optionsjsonbDEFAULT ''UI and behavior options
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • user_idusers(id)
  • scaffold_sheet_idsheets(id)
  • source_workflow_idworkflows(id) (self-reference for duplicates)

Relationships:

  • Belongs to group
  • Has many pages
  • Has many workflow_runs
  • Has many workflow_roles
  • Has one scaffold_sheet

workflow_runs

Live instances of workflow execution (sessions).

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique workflow run identifier
workflow_iduuidFK → workflows(id)Associated workflow template
group_iduuidAssociated group
user_iduuidFK → users(id)User who started the run
statusvarchar(50)Current status (active, completed, etc.)
started_attimestamptzWhen the run started
completed_attimestamptzWhen the run completed
archived_attimestamptzSoft delete timestamp
metadatajsonbAdditional run metadata
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • workflow_idworkflows(id)
  • user_idusers(id)

Relationships:

  • Belongs to workflow
  • Has many workflow_run_stages
  • Has many session_role_assignments
  • Has many session_assignments

Workflow Structure

pages

Individual steps or screens in a workflow.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique page identifier
workflow_iduuidFK → workflows(id)Associated workflow
namevarchar(255)Page name
descriptiontextPage description
typevarchar(50)Page type (standard, start, end)
sort_orderintegerDisplay order
optionsjsonbDEFAULT ''Page configuration options
archived_attimestamptzSoft delete timestamp
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • workflow_idworkflows(id)

Relationships:

  • Belongs to workflow
  • Has many sections
  • Has many page_transitions (as from_page or to_page)
  • Has many stage_role_assignments

sections

Containers for blocks within a page.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique section identifier
page_iduuidFK → pages(id)Associated page
typevarchar(50)Section type (content, sheet, etc.)
namevarchar(255)Section name
sort_orderintegerDisplay order
optionsjsonbDEFAULT ''Section configuration
archived_attimestamptzSoft delete timestamp
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • page_idpages(id)

Relationships:

  • Belongs to page
  • Has many blocks

blocks

Atomic units of content and user input.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique block identifier
section_iduuidFK → sections(id)Associated section
typevarchar(50)Block type (string, select, content, etc.)
labelvarchar(255)Block label/question
help_texttextHelp text for users
requiredbooleanDEFAULT falseWhether block is required
sheet_iduuidFK → sheets(id)Target sheet for data
column_iduuidFK → columns(id)Target column for data
sort_orderintegerDisplay order
optionsjsonbDEFAULT ''Block-specific configuration
archived_attimestamptzSoft delete timestamp
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • section_idsections(id)
  • sheet_idsheets(id) (optional)
  • column_idcolumns(id) (optional)

Relationships:

  • Belongs to section
  • Optionally belongs to column (for data-binding)

page_transitions

Define the flow between pages in a workflow.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique transition identifier
workflow_iduuidFK → workflows(id)Associated workflow
from_page_iduuidFK → pages(id)Source page
to_page_iduuidFK → pages(id)Destination page
conditionsjsonbConditional logic for transition
labelvarchar(255)Transition label
sort_orderintegerDisplay order
archived_attimestamptzSoft delete timestamp
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • workflow_idworkflows(id)
  • from_page_idpages(id)
  • to_page_idpages(id)

Sheets & Data

sheets

Structured data tables that store workflow outputs.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique sheet identifier
group_iduuidAssociated group
namevarchar(255)Sheet name
descriptiontextSheet description
user_iduuidFK → users(id)Creator user ID
archived_attimestamptzSoft delete timestamp
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • user_idusers(id)

Relationships:

  • Has many columns
  • Has many rows
  • Has many sheet_views

columns

Define the structure of data in sheets.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique column identifier
sheet_iduuidFK → sheets(id)Associated sheet
namevarchar(255)Column name
typevarchar(50)Column type (text, number, date, etc.)
formulatextFormula for computed columns
sort_orderintegerDisplay order
optionsjsonbDEFAULT ''Column configuration
archived_attimestamptzSoft delete timestamp
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • sheet_idsheets(id)

Relationships:

  • Belongs to sheet
  • Has many cells

rows

Individual records in sheets.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique row identifier
sheet_iduuidFK → sheets(id)Associated sheet
workflow_run_iduuidFK → workflow_runs(id)Source workflow run (optional)
primary_row_iduuidFK → rows(id)Primary row reference (for related rows)
sort_orderintegerDisplay order
archived_attimestamptzSoft delete timestamp
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • sheet_idsheets(id)
  • workflow_run_idworkflow_runs(id) (optional)
  • primary_row_idrows(id) (self-reference, optional)

Relationships:

  • Belongs to sheet
  • Optionally belongs to workflow_run
  • Has many cells

cells

Store individual data values in sheet rows.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique cell identifier
row_iduuidFK → rows(id)Associated row
column_iduuidFK → columns(id)Associated column
valuejsonbCell value (stored as JSON)
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • row_idrows(id)
  • column_idcolumns(id)

Unique Constraint:

  • (row_id, column_id) - One cell per row/column combination

Assignments & Roles

workflow_roles

Define the different participant types in a workflow.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique role identifier
workflow_iduuidFK → workflows(id)Associated workflow
namevarchar(255)Role name (e.g., "Submitter", "Approver")
descriptiontextRole description
colorvarchar(50)Display color
sort_orderintegerDisplay order
archived_attimestamptzSoft delete timestamp
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • workflow_idworkflows(id)

stage_role_assignments

Assign roles to specific pages/stages in a workflow.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique assignment identifier
page_iduuidFK → pages(id)Associated page
workflow_role_iduuidFK → workflow_roles(id)Associated role
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • page_idpages(id)
  • workflow_role_idworkflow_roles(id)

session_role_assignments

Assign users to roles for a specific workflow run.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique assignment identifier
workflow_run_iduuidFK → workflow_runs(id)Associated workflow run
workflow_role_iduuidFK → workflow_roles(id)Associated role
user_iduuidFK → users(id)Assigned user
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • workflow_run_idworkflow_runs(id)
  • workflow_role_idworkflow_roles(id)
  • user_idusers(id)

session_assignments

Track which users are assigned to which stages in a workflow run.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique assignment identifier
workflow_run_stage_iduuidFK → workflow_run_stages(id)Associated stage
user_iduuidFK → users(id)Assigned user
statusvarchar(50)Assignment status
completed_attimestamptzWhen assignment was completed
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • workflow_run_stage_idworkflow_run_stages(id)
  • user_idusers(id)

Workflow Execution

workflow_run_stages

Represent the current state of pages within a workflow run.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique stage identifier
workflow_run_iduuidFK → workflow_runs(id)Associated workflow run
page_iduuidFK → pages(id)Associated page template
statusvarchar(50)Stage status (pending, active, completed)
started_attimestamptzWhen stage became active
completed_attimestamptzWhen stage was completed
datajsonbStage-specific data
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • workflow_run_idworkflow_runs(id)
  • page_idpages(id)

Collaboration

discussions

Threaded conversations attached to various entities.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique discussion identifier
entity_typevarchar(50)Type of entity (workflow, workflow_run, etc.)
entity_iduuidID of the entity
titlevarchar(255)Discussion title
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Relationships:

  • Has many comments
  • Has many discussion_subscriptions

comments

Individual messages within discussions.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique comment identifier
discussion_iduuidFK → discussions(id)Associated discussion
user_iduuidFK → users(id)Comment author
contenttextComment content
parent_comment_iduuidFK → comments(id)Parent comment (for threading)
archived_attimestamptzSoft delete timestamp
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • discussion_iddiscussions(id)
  • user_idusers(id)
  • parent_comment_idcomments(id) (self-reference)

Organization

memberships

Define user access to groups.

ColumnTypeConstraintsDescription
iduuidPRIMARY KEYUnique membership identifier
group_iduuidFK → groups(id)Associated group
user_iduuidFK → users(id)Associated user
rolevarchar(50)User role in group (admin, member, etc.)
created_attimestamptzNOT NULLCreation timestamp
updated_attimestamptzNOT NULLLast update timestamp

Foreign Keys:

  • group_idgroups(id)
  • user_idusers(id)

Unique Constraint:

  • (group_id, user_id) - One membership per user per group

Common Patterns

Soft Deletes

Most entities use archived_at timestamp for soft deletion rather than hard deletes. This preserves data integrity and allows for recovery.

Timestamps

All entities include:

  • created_at - When the record was created
  • updated_at - When the record was last modified

UUIDs

All primary keys use UUID v4 for globally unique identifiers.

JSONB Columns

Many entities use JSONB columns for flexible configuration:

  • options - UI and behavior configuration
  • metadata - Additional contextual data
  • conditions - Conditional logic
  • value - Cell values in sheets

Database Migrations

Eddy uses Knex.js for database migrations. Migrations are located in /migrations and follow the naming convention:

YYYYMMDDHHMMSS_descriptive_name.js

Running Migrations

# Run all pending migrations
npx knex migrate:latest

# Rollback the last migration
npx knex migrate:rollback

# Create a new migration
npx knex migrate:make migration_name

On this page