Skip to content
Adam Mikulasev edited this page Apr 13, 2025 · 2 revisions
erDiagram
    %% NOTE: "json" column type may be "jsonb" for PostgreSQL
    %% STI subclasses use the `type` column in `events` table

    %% User-defined model
    events {
        bigint user_id
        bigint tenant_id
        string eventable_type
        bigint eventable_id
        string type
        json body
        datetime created_at
    }

    %% STI-derived event types (represented for clarity only)
    accountify_contact_created_event {
        string type
    }
    accountify_contact_updated_event {
        string type
    }
    accountify_invoice_created_event {
        string type
    }

    %% Outboxer (library) models
    outboxer_messages {
        string status
        string messageable_id
        string messageable_type
        datetime created_at
        datetime updated_at
        string updated_by_publisher_name
        bigint updated_by_publisher_id
    }
    outboxer_publishers {
        string name
        string status
        json settings
        json metrics
        datetime created_at
        datetime updated_at
    }
    outboxer_exceptions {
        bigint message_id
        string class_name
        text message_text
        datetime created_at
    }
    outboxer_frames {
        bigint exception_id
        int index
        text text
    }
    outboxer_settings {
        string name
        string value
        datetime created_at
        datetime updated_at
    }
    outboxer_signals {
        string name
        bigint publisher_id
        datetime created_at
    }

    %% Relationships
    outboxer_messages ||--o{ outboxer_exceptions : "has"
    outboxer_exceptions ||--o{ outboxer_frames : "has"
    outboxer_publishers ||--o{ outboxer_signals : "sends"
    outboxer_publishers ||--o{ outboxer_messages : "updates"

    %% Polymorphic association
    events ||--|| outboxer_messages : "messageable (polymorphic)"

    %% STI grouping (fake relationships for diagram clarity)
    events ||--o{ accountify_contact_created_event : "STI"
    events ||--o{ accountify_contact_updated_event : "STI"
    events ||--o{ accountify_invoice_created_event : "STI"

Loading
Clone this wiki locally