Skip to main content

Database ERD

Overview​

The ForgeX database consists of 27 models organized into core entities, configuration tables, and audit logging. This ERD shows the complete structure with all relationships.

Entity Relationship Diagram​

πŸ” Click diagram to expand

Model Categories​

Core Models (3)​

πŸ‘€

User

Authentication and authorization with invitation system

🏒

Client

Customer/client management

πŸ“„

Bid

Main bid entity with cost rollup fields

User Management (1)​

πŸ”‘

ServiceAccess

Service-specific access control (BIDS, PROJECTS, FIELD) with optional role override

Scope Types & Configuration (2)​

πŸ”·

ScopeType

Types of scopes (e.g., Slab, Pier, Wall) with active/inactive status

πŸ“‹

ScopeTypeMaterialCategory

Junction table linking scope types to required material categories

Scope & Estimation Items (7)​

πŸ—ΊοΈ

Scope

Work breakdown structure within a bid

🧊

ConcreteItem

Concrete and rebar calculations

πŸ‘₯

LaborItem

Labor cost estimation

πŸš›

EquipmentItem

Equipment rental and fuel costs

πŸ“¦

MaterialItem

Material costs with waste factors

🀝

SubcontractorItem

Subcontractor services (pumps, saws, etc.)

β€’β€’β€’

MiscItem

Miscellaneous costs

Configuration Models (9)​

βš™οΈ

GlobalVariable

Bid-specific variable overrides

πŸ“

DefaultVariable

Location-based default variables

πŸ’°

PricingItem

Global pricing catalog

πŸ’²

BidPricingItem

Bid-specific pricing overrides

≑

RebarRate

Rebar size and spacing rates

πŸͺͺ

Employee

Crew/labor employee data

πŸ”§

PumpPricing

Pump catalog with vendor pricing

Audit & Logging (1)​

πŸ•

AuditLog

Complete audit trail for all entity changes

Key Relationships​

  1. Bid β†’ Scope β†’ Items: Hierarchical cost structure
  2. PricingItem β†’ BidPricingItem: Global pricing with bid overrides
  3. PricingItem β†’ Items: Items reference pricing for calculations
  4. ConcreteItem β†’ MaterialItem: Auto-generated material items from concrete
  5. User β†’ Bid: Creator tracking
  6. Client β†’ Bid: One-to-many relationship
  7. Bid β†’ Bid (sourceBidId): Imported bid traceability (optional self-reference)
  8. ScopeType β†’ Scope: Each scope has a type (required for new scopes)
  9. ScopeType β†’ ScopeTypeMaterialCategory: Many-to-many relationship for material categories
  10. User β†’ ServiceAccess: Users have service-specific access with optional role overrides

Enums​

BidStatus​

  • DRAFT - Work in progress
  • SUBMITTED - Sent to client
  • NEGOTIATION - In negotiation phase
  • AWARDED - Bid won
  • COMPLETED - Project completed
  • LOST - Bid lost

UserRole​

  • ADMIN - System administrator
  • PM - Project Manager
  • OPS - Operations
  • ACCOUNTING - Accounting/Finance
  • ESTIMATOR - Bid estimator
  • FOREMAN - Field foreman

UserStatus​

  • PENDING_INVITATION - Invited but hasn't accepted
  • ACTIVE - Active user
  • DISABLED - Account disabled

ServiceType​

  • BIDS - Bids service access
  • PROJECTS - Projects service access
  • FIELD - Field service access