Appearance
Entity: defaultCalorificValue
Entity Type: Database table (shared schema)
Description: The platform's default calorific value for a medium and primary source — the factor that converts a volume or a mass of fuel into energy when nobody closer to the gauge has stated a better one. Values come from national standards and change rarely, but they do change, so each one carries the date it starts applying and none is ever overwritten.
This is the outermost of the three scopes a calorific value can be stated at. It carries the same columns as the tenant-side calorificValue, so the resolver compares like with like; the two are separate tables only because cross-tenant data may live only in the shared schema while a per-gauge value cannot.
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 | 018f9c4d-2c11-7a3e-9b77-4f0d3a5e6b41 |
| tenantId | Always null for a platform default, which is what makes the row readable by every tenant. Present because the shared-schema policies read it. | UUID | null | No | No | UUID v7 | Must be null on a row created through the platform administration surface. | name: idx_default_calorific_value_tenant_id, type: btree | null |
| medium | Medium the value applies to. | Enum | - | Yes | Part of composite unique | Enum - GaugeMedium | An entry from the enum. Only media that convert to energy carry rows. | name: uq_default_calorific_value_scope, type: btree (unique, partial) | gas |
| primarySource | Fuel or source the value applies to within the medium — natural gas and biogas convert differently. | Integer | - | Yes | Part of composite unique | Enum - PrimarySource | An entry from the enum. | Part of the unique index above | 1 |
| value | The conversion factor itself: how much energy one unit of unitFrom yields, expressed in unitTo. | Decimal | - | Yes | No | numeric(12,6) | Must be > 0. | - | 10.550000 |
| unitFrom | Unit the factor converts from. | Enum | - | Yes | No | Enum - Unit | Must be a volume or mass unit. | - | m³ |
| unitTo | Unit the factor converts to. | Enum | - | Yes | No | Enum - Unit | Must be an energy unit. | - | kWh |
| validFrom | First day the value applies. A value has no explicit end: it runs until the next value for the same medium and primary source begins. | Date | - | Yes | Part of composite unique | YYYY-MM-DD | Unique per (medium, primarySource, validFrom) among rows where deletedAt is null. | Part of the unique index above | 2024-01-01 |
| note | Where the value comes from — the standard, table or measurement it was taken from. | String | null | No | No | - | Max 500 characters. | - | ČSN 38 5502, tabulka 3 |
| createdAt | Timestamp of record creation. | Timestamp with time zone | now() — set in code | Yes | No | ISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ | Cannot be null. | - | 2023-12-18T10:00:00Z |
| updatedAt | Timestamp of the last update. | Timestamp with time zone | now() — set in code | Yes | No | ISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ | Cannot be null. | - | 2023-12-18T10:00:00Z |
| deletedAt | Soft-delete marker for a row entered in error. Null means active. A superseded value is never deleted — it is what reproduces consumption from the period it covered. | Timestamp with time zone | null | No | No | ISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ | Immutable once set. Active rows: WHERE deletedAt IS NULL. | - | null |
| createdBy | Actor who created the record. | String | - | Yes | No | type:actor | Non-empty. | - | user:018ed0b3-… |
| updatedBy | Actor who last updated the record. | String | - | Yes | No | type:actor | Non-empty. | - | user:018ed0b3-… |
Indexes
| Name | Columns | Type | Why |
|---|---|---|---|
uq_default_calorific_value_scope | medium, primarySource, validFrom where deletedAt is null | Unique, partial | One default per medium, source and start date; a withdrawn row must not block re-entering the same date. |
idx_default_calorific_value_tenant_id | tenantId | btree | Supports the shared-schema policies. |
Row-level security
Enabled and forced, with the split read and write policies the shared schema uses: readable when tenantId is null or matches the current tenant, writable only in a context with no tenant set — the platform administration context. A tenant reads every default and changes none.
Audited fields
Recorded on created (in full), updated (changed only) and deleted (in full): medium, primarySource, value, unitFrom, unitTo, validFrom, note.
Excluded: tenantId — always null on a platform row, so it carries no information about the change.
Not registered for entityName resolution, and has no independent human-readable attribute to register — identified by its medium/primarySource/validFrom scope.