survey_version_pointers
Overview
A pointer table recording which version a survey treats as its "latest". One row per survey and pointer type.
Table Definition
| Logical name | Physical name | Column | Type | PK | Relation | Unique | Nullable | Default | Notes |
|---|---|---|---|---|---|---|---|---|---|
| Version pointer | survey_version_pointers | survey_id | uuid | โฏ | surveys:id (cascade) | ||||
| version_id | uuid | survey_versions:id (cascade) | The version pointed at | ||||||
| pointer_type | varchar(50) | โฏ | Currently only latest |
Relations
- survey_id โ surveys.id (onDelete: cascade)
- version_id โ survey_versions.id (onDelete: cascade)
Indexes
- Composite primary key (survey_id, pointer_type)
Constraints
- CHECK:
survey_version_pointers_pointer_type_checkโpointer_type in ('latest')
Notes
- The
latestpointer is created when a survey is created and updated to the new version on every save and rollback - The composite primary key prevents a survey from holding more than one pointer of the same type
pointer_typeis a varchar with a CHECK constraint rather than an enum, to leave room for future pointer types such as a "published version". Onlylatestis used today- In practice, identifying the latest version also uses
surveys.latest_version_no