Skip to content

ADR: Multi-ISO schema strategy — universal vs ISO-specific columns #52

@haydenk

Description

@haydenk

Decision needed

How should we structure the data model so ERCOT's 24 fields can coexist with future ISOs (CAISO, MISO, NYISO, ISO-NE, PJM, CENACE) that have wildly different field sets?

Options

A. Wide single table with NULLable ISO-specific columns

  • One service_points table holds the union of all ISO fields
  • Pros: simple queries; one schema
  • Cons: column count explodes; semantically unclear (which fields apply to which ISO?); migrations on millions of rows

B. Universal columns + JSONB iso_attributes

  • service_points has only universal columns (id, iso, address, city, state, zip, status, is_active, search_vector, timestamps); ERCOT-specific fields live in iso_attributes JSONB
  • Pros: schema stable; cheap to add an ISO; queryable via JSONB operators
  • Cons: typeless; harder to index specific fields; query verbosity

C. Universal columns + per-ISO sidecar tables

  • service_points (universal) + service_points_ercot_attrs (FK + ERCOT columns) + service_points_caiso_attrs, etc.
  • Pros: typed; indexable; clear ownership per ISO
  • Cons: more migrations; joins for full-record queries

Required output

A short ADR at docs/adr/0001-multi-iso-schema-strategy.md documenting:

Why now

This decision needs to land before more v0.2.0 schema work continues, otherwise issues like #16 and #20 risk being done one way and redone in v0.4.0.

Blocks

Context

See docs/multi-iso-plan.md for the broader multi-ISO architectural plan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:dbDatabase migrations / sqlx cachearea:multi-isoMulti-ISO architecture / provider abstractiondocumentationImprovements or additions to documentation

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions