Appearance
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 Name | Description | Data Type | Default Value | Required (= Nullable) | Unique | Format | Validations | Index | Example |
|---|---|---|---|---|---|---|---|---|---|
| id | Primary key of the entity. | UUID | Generated in code (app layer) | Yes | Yes | UUID v7 | - | Primary Key | 01960000-0000-7000-8000-000000000601 |
| tenantId | Tenant that owns this record. Denormalised from gauge for uniform data-scoping. | UUID | - | Yes | No | UUID v7 | Foreign Key → tenant; must equal the parent gauge.tenantId. | name: idx_gaugeDistributionRateHistory_tenantId, type: btree | 01960000-0000-7000-8000-000000000099 |
| gaugeId | The gauge whose rate is recorded. Only gauges with medium = electricity, supplyType = retail and kind = standard. | UUID | - | Yes | No | UUID v7 | Foreign 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 |
| distributionRateId | The rate that applies from validFrom. | UUID | - | Yes | No | UUID v7 | Foreign Key → distributionRate; must exist; its supplyTypes must contain the gauge's supplyType at write time. | name: idx_gaugeDistributionRateHistory_rateId, type: btree | 01960000-0000-7000-8000-000000000501 |
| validFrom | Timestamp from which the rate applies. A change writes a new record instead of updating this one. | Timestamp with time zone | - | Yes | No | ISO 8601 | Unique 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 |
| createdAt | Timestamp of entity creation. Immutable. | Timestamp with time zone | Set in code | Yes | No | ISO 8601 | - | - | 2026-09-30T10:00:00Z |
| createdBy | Identifier of the actor who created this record. | String | - | Yes | No | type:actor | - | - | user:01960000-0000-7000-8000-000000000099 |
Notes
gauge.distributorTariffbecomes a read model: thecodeof the current record, kept for lists and exports; it is no longer writable through the API.- Migration: EM2
gauge_ratemaps 1:1 (rate_id→ seededdistributionRate.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).