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

Entity: gaugeFormulaMember ​

Entity Type: Database table

Description: One term of a gaugeFormula version: which gauge (channel) enters the formula and with which sign. The formula editor shows the sign as + / −; the stored coefficient is the signed weight of the term (+1 / −1 from the form, any non-zero number through the API for weighted formulas). Members belong to a version — a new version carries its own member rows, so the members of a past version stay as they were.

Source of the current shape: EM3 apps/backend/migrations/202609011000-gauge-formula.sql (gauge_formula_member), member rules in apps/backend/src/core/assets/domain/rules/formula-member.rules.ts.

Data Attributes Table ​

Attribute NameDescriptionData TypeDefault ValueRequired (= Nullable)UniqueFormatValidationsIndexExample
idPrimary key of the member row.UUIDGenerated in code (app layer)YesYesUUID v7-Primary Key01960000-0000-7000-8000-000000000411
tenantIdTenant that owns this record. Denormalised from gaugeFormula; row-level security policy tenant_isolation.UUID-YesNoUUID v7Foreign Key → tenant; must equal gaugeFormula.tenantId.name: idx_gaugeFormulaMember_tenantId, type: btree01960000-0000-7000-8000-000000000099
formulaIdThe formula version this term belongs to.UUID-YesNoUUID v7Foreign Key → gaugeFormula.name: idx_gaugeFormulaMember_formulaId, type: btree01960000-0000-7000-8000-000000000401
memberGaugeIdThe gauge whose effective consumption enters the formula.UUID-YesNoUUID v7Foreign Key → gauge. Not the owner itself; not archived at the time of saving; not a buildingTotal; unique within the version. A computed virtual gauge is allowed when it does not lead back to the owner. Same medium as the owner for buildingTotal; for computed the form offers the owner's medium only (open whether the API keeps allowing other media).name: idx_gaugeFormulaMember_memberGaugeId, type: btree01960000-0000-7000-8000-000000000003
coefficientSigned weight of the term. The form writes 1 for + and −1 for −.Decimal1YesNoDecimal(18,6)Not zero (CHECK (coefficient <> 0)).--1.000000
sortOrderPosition of the term in the editor, so the formula reads back in the order the user wrote it.Integer0YesNo-Zero or greater; unique within the version.-1
createdAtTimestamp of entity creation. Immutable.Timestamp with time zoneSet in codeYesNoISO 8601--2026-09-24T09:00:00Z
updatedAtTimestamp of last entity update. Set on insert equal to createdAt.Timestamp with time zoneSet in codeYesNoISO 8601--2026-09-24T09:00:00Z
deletedAtTimestamp of soft delete. Versions are voided, not deleted; kept for the uniform lifecycle. Once set, immutable.Timestamp with time zonenullNoNoISO 8601--null
createdByIdentifier of the actor who created this record.String-YesNotype:actor--user:01960000-0000-7000-8000-000000000099
updatedByIdentifier of the actor who last updated this record.String-YesNotype:actor--user:01960000-0000-7000-8000-000000000099

Audited fields ​

Recorded on created (in full), updated (changed only) and deleted (in full): formulaId, memberGaugeId, coefficient, sortOrder.

Excluded: none — a member is the formula.

Not registered for entityName resolution — join row; identified by its formulaId/memberGaugeId scope.

Row-level security ​

Enabled and forced, with the tenant-isolation policy every tenant-schema table carries (tenant_isolation on app.tenant_id).

Notes ​

  • Uniqueness of (formulaId, memberGaugeId) is enforced in the database; the rules layer reports a duplicate as a descriptive validation error before the insert.
  • Archiving a member gauge does not delete the row — it sets needsReview on the formula so the user decides.