Skip to content

Data Schema Design ​

Overview ​

Data schemas define the structure of operational data—the entities managed, their attributes, and how they relate to each other. Schemas specify what data is stored, what relationships exist, and what integrity rules apply.

What Schemas Define ​

Entities

The core objects managed by applications:

  • Operational Assets — Vehicles, equipment, facilities, infrastructure
  • People and Organizations — Users, customers, teams, partners
  • Transactions — Orders, bookings, assignments, transfers
  • Events — Incidents, alerts, observations, measurements
  • Reference Data — Categories, configurations, templates, rules

Relationships

How entities connect:

  • One-to-One — Each entity instance relates to exactly one other instance
  • One-to-Many — Each parent entity has multiple child entities
  • Many-to-Many — Entities relate to multiple instances of each other

Data Integrity Rules

Constraints ensuring data validity:

  • Uniqueness — Values that must be unique across all instances
  • Required Fields — Data that must always be provided
  • Value Constraints — Acceptable ranges, patterns, or options for fields
  • Referential Integrity — Relationships that must remain valid

Schema Components ​

Persistent Entities

Data stored in the data service with automatic create, read, update, and delete operations. All entity types receive standard operations for data access and modification.

Relationships

Connections between entities with automatic navigation. Relationships are bidirectional—queries can traverse from either entity.

Validation Rules

Constraints enforced on data operations. Rules ensure data meets requirements before storage.

Custom Operations

Specialized operations beyond standard data access—business logic, aggregations, or complex workflows. Data services can be extended with custom operations for specialized requirements.

Common Schema Patterns ​

Asset Management

Tracking physical or digital assets with location, status, and maintenance information. Common in fleet management, equipment tracking, and facility management.

Scheduling and Planning

Managing time-based allocations of resources, people, or equipment. Common in logistics, workforce management, and service delivery.

Event Tracking

Recording time-series observations, measurements, or incidents. Common in monitoring, alerting, and compliance applications.

Hierarchical Structures

Organizing entities in parent-child or tree structures. Common in organizational charts, location hierarchies, and product categorization.

Transaction Processing

Recording business transactions with parties, items, and audit trails. Common in order management, booking systems, and financial applications.

Data Types ​

Schemas support standard data types:

  • Text — Names, descriptions, codes, formatted content
  • Numbers — Quantities, measurements, monetary values, calculations
  • Dates and Times — Timestamps, durations, schedules
  • Boolean — Status flags, feature toggles, conditions
  • Identifiers — Unique keys for linking and referencing
  • Structured Data — Nested information, configurations
  • Arrays — Lists of values or related items
  • Geospatial — Locations, coordinates, geographic regions

Schema Evolution ​

Schemas evolve to support changing requirements:

Adding Entities

New data structures can be introduced as application scope expands. New entities receive automatic operations while existing data and operations remain unchanged.

Modifying Relationships

Entity connections can be adjusted as processes change. Relationships can be added, removed, or restructured to match evolving workflows.

Updating Constraints

Validation rules can be refined as requirements become clearer. Constraints can be tightened or relaxed based on operational experience.

Extending Operations

Custom operations can be added for specialized logic or integrations. Custom logic complements standard operations for unique requirements.

Data integrity and custom extensions are preserved as schemas evolve.

Design Principles ​

Domain-Focused

Model the operational domain—what is managed and how—rather than technical database structures. Think in terms of business entities and their relationships.

Start Simple

Begin with core entities and essential relationships. Add complexity as requirements become clear through use and feedback.

Descriptive Naming

Entity and field names should clearly communicate what they represent. Clear names make schemas self-documenting and reduce ambiguity.

Early Validation

Define what makes data valid before storage. Input validation prevents invalid data from entering the system.

Change-Ready

Structure schemas to allow additions and modifications without disrupting existing functionality. Plan for evolution.

Schema Examples ​

Fleet Management

Entities: Vehicle, Driver, Route, Assignment

  • Vehicles have properties: ID, model, status, location
  • Drivers have properties: ID, name, license, availability
  • Assignments link drivers to vehicles with time periods
  • Routes track vehicle paths with timestamps

Equipment Maintenance

Entities: Equipment, Maintenance Record, Work Order, Technician

  • Equipment has properties: ID, type, location, condition
  • Maintenance Records track service history
  • Work Orders schedule future maintenance
  • Technicians are assigned to work orders

Sensor Monitoring

Entities: Sensor, Site, Reading, Alert

  • Sensors belong to sites with configuration
  • Readings record measurements with timestamps
  • Alerts trigger when readings exceed thresholds
  • Sites organize sensors hierarchically

Best Practices ​

Clear Entity Boundaries

Each entity should represent a distinct concept. If an entity serves multiple purposes, consider splitting into separate entities.

Appropriate Relationships

Choose relationship types that match real-world connections. One-to-many for ownership, many-to-many for associations.

Meaningful Constraints

Apply constraints that enforce business rules. Required fields for essential data, uniqueness for identifiers.

Flexible Structure

Avoid overly specific constraints that limit future changes. Leave room for workflow evolution.

Consistent Naming

Use consistent naming patterns across entities and fields. Consistency aids understanding and reduces errors.

Next Steps ​

  • Architecture — Data Layer structure and operation
  • Usage — Working with data services
  • Examples — Real-world schema patterns
  • Frontend — Visual schema design interface

User documentation for Optimal Reality