Skip to content
Updated Sep 30, 2026 by Pavel Coufal · Owner: analysisdraftentitygauge-management Edit on GitHub

Entity: gaugeDistributionRateHistory ​

Entity Type: Database table

Description: Append-only history of the distribution rate assigned to a retail electricity gauge. Each change writes a new record with a validFrom; the previous record is never modified or deleted. The rate valid at a moment is the record with the highest validFrom not exceeding it. Replaces the free-text gauge.distributorTariff with a reference into the platform catalogue distributionRate, so the gauge form and Reading Management can read the rate's tariffScheme instead of parsing a code. Follows the versioned / append-only pattern of gaugeSerialHistory (deviation #16: no updatedAt, updatedBy, deletedAt). EM2 kept the same history in gauge_rate (6 782 rows on 6 572 gauges, staging 30 Sep 2026) but read only the current row; EM3 reads the row valid at the reading time. Decided 30 September 2026.

Data Attributes Table ​

Attribute NameDescriptionData TypeDefault ValueRequired (= Nullable)UniqueFormatValidationsIndexExample
idPrimary key of the entity.UUIDGenerated in code (app layer)YesYesUUID v7-Primary Key01960000-0000-7000-8000-000000000601
tenantIdTenant that owns this record. Denormalised from gauge for uniform data-scoping.UUID-YesNoUUID v7Foreign Key → tenant; must equal the parent gauge.tenantId.name: idx_gaugeDistributionRateHistory_tenantId, type: btree01960000-0000-7000-8000-000000000099
gaugeIdThe gauge whose rate is recorded. Only gauges with medium = electricity, supplyType = retail and kind = standard.UUID-YesNoUUID v7Foreign Key → gauge; must exist and satisfy the medium / supply-type rule.name: idx_gaugeDistributionRateHistory_gaugeId_validFrom, type: btree (composite, validFrom DESC)01960000-0000-7000-8000-000000000005
distributionRateIdThe rate that applies from validFrom.UUID-YesNoUUID v7Foreign Key → distributionRate; must exist; its supplyTypes must contain the gauge's supplyType at write time.name: idx_gaugeDistributionRateHistory_rateId, type: btree01960000-0000-7000-8000-000000000501
validFromTimestamp from which the rate applies. A change writes a new record instead of updating this one.Timestamp with time zone-YesNoISO 8601Unique per gaugeId. Must be later than the readAt of the last stored manual reading of the gauge, because the tariff series of stored rows never change (see gauge form specification, chapter 3.4).name: idx_gaugeDistributionRateHistory_gaugeId_validFrom, type: btree (composite)2026-01-01T00:00:00Z
createdAtTimestamp of entity creation. Immutable.Timestamp with time zoneSet in codeYesNoISO 8601--2026-09-30T10:00:00Z
createdByIdentifier of the actor who created this record.String-YesNotype:actor--user:01960000-0000-7000-8000-000000000099

Notes ​

  • gauge.distributorTariff becomes a read model: the code of the current record, kept for lists and exports; it is no longer writable through the API.
  • Migration: EM2 gauge_rate maps 1:1 (rate_id → seeded distributionRate.id, valid_from → validFrom). Retail electricity gauges without any row (EM2 fell back to a single high-tariff series) get no record and are listed in the migration report for the client to complete; until then the channel records one series (total).