Skip to content
Updated Sep 26, 2026 by Barča Dvořáková · Owner: analysisactiveentityconfluence-migration Edit on GitHub

Entity: clientWeatherStation ​

Entity Definition ​

  • Entity Name: clientWeatherStation

  • Entity Type: Database table (join table with metadata)

  • Description: Records weather station assignments for a client. A client has one default station (stored as client.defaultWeatherStationId) used for consumption normalisation across all buildings. Supplementary station assignments are stored here — each row links a weather station to a client and optionally to a specific building. A row with buildingId = null represents a client-level supplementary station; a row with a specific buildingId overrides the default for that building. A single weatherStationId may appear in multiple rows — one supplementary station can be assigned to several buildings at the same time; the composite uniqueness constraint below applies only to (clientId, buildingId), not to weatherStationId.

    Default station vs. supplementary stations: the client's default weather station is stored directly on client.defaultWeatherStationId (nullable FK). This table stores only supplementary assignments.

    Resolution logic: a building uses its specific assignment from this table if one exists; otherwise it falls back to client.defaultWeatherStationId. Otherwise no normalisation is applied.

    Because of this split, every row in clientWeatherStation is a supplementary assignment. There is no need for a role attribute distinguishing default from supplementary, since the default is never represented as a row in this table.

Data Attributes Table ​

Attribute NameDescriptionData TypeDefault ValueRequired (= Nullable)UniqueFormatValidationsIndexExample
idPrimary keyUUIDGenerated in code (app layer)YesYesUUID v7-Primary Key018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2
tenantIdTenant this record belongs to.UUID-YesNoUUID v7FK → tenant; must existname: idx_client_weather_station_tenantId, type: btree018fa51f-fda1-79f4-8461-2cb8f1cabc10
clientIdClient this assignment belongs toUUID-YesNoUUID v7FK → client; must exist — see clientname: idx_client_weather_station_clientId, type: btree018fa51f-fda1-79f4-8461-2cb8f1cabc10
weatherStationIdThe assigned weather stationUUID-YesNoUUID v7FK → weatherStation; must exist; onDelete CASCADEname: idx_client_weather_station_weatherStationId, type: btree018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2
buildingIdBuilding this assignment applies to. Null means the station applies to the entire client (supplementary at client level). When set, this station overrides the client default for that building specifically.UUID-NoNoUUID v7FK → building; nullable; onDelete CASCADE. Composite unique with (clientId, buildingId) — one supplementary station per building.name: idx_client_weather_station_clientId_buildingId, type: btree (unique, nulls distinct)018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2
createdAtTimestamp of when the record was created. Immutable after insert.Timestamp with time zonenow() — set in codeYesNoISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZCannot be null; cannot be modified after creation-2025-03-16T18:00:00Z
createdByIdentifier of the actor who created the recordString-YesNotype:actorNon-empty-user:018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2

Discrepancy — incomplete audit block: the source Confluence page only lists createdAt and createdBy; it is missing updatedAt, deletedAt, and updatedBy, which the foundations doc (§5) requires on every persistent entity as a trailing quintet, and which every other migrated sibling entity carries in full. This is very likely an oversight on the source page (this is a join table that may genuinely never be updated/soft-deleted, which would make the omission intentional — but that isn't stated). Carried over exactly as documented rather than inventing the missing rows; recommend confirming with the author whether clientWeatherStation truly has no update/soft-delete semantics, or whether the three missing rows should be added upstream and re-migrated.

Audited fields ​

Recorded on created (in full) and deleted (in full) — this entity's own Data Attributes Table carries no updatedAt/updatedBy at all, so no field of an existing assignment can ever change; a re-assignment is a delete of the old row plus a create of the new one, never an update: clientId, weatherStationId, buildingId.

Excluded: none.

Every entry would carry subjectEntityType = client / subjectEntityId = clientId — buildingId (null for a client-level assignment, set for a building-level override) rides as a field on the entry rather than as a second subject.

Not registered for entityName resolution — a join row (client × weather station, optionally × building), not a named record of its own.