Skip to content

Commit eafafe4

Browse files
committed
add constraint, comment
1 parent 31deaac commit eafafe4

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

nexus/types/src/deployment.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ pub struct Blueprint {
230230
/// The generation of the active group of Nexuses
231231
///
232232
/// If a Nexus instance notices it has a nexus_generation less than
233-
/// this value, it will start to quiesce (see: RFD 588).
233+
/// this value, it will start to quiesce in preparation for handing off
234+
/// control to the newer generation (see: RFD 588).
234235
pub nexus_generation: Generation,
235236

236237
/// CockroachDB state fingerprint when this blueprint was created

schema/crdb/dbinit.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4757,6 +4757,12 @@ CREATE TABLE IF NOT EXISTS omicron.public.bp_omicron_zone (
47574757
OR
47584758
(image_source != 'artifact'
47594759
AND image_artifact_sha256 IS NULL)
4760+
),
4761+
4762+
CONSTRAINT nexus_generation_for_nexus_zones CHECK (
4763+
(zone_type = 'nexus' AND nexus_generation IS NOT NULL)
4764+
OR
4765+
(zone_type != 'nexus' AND nexus_generation IS NULL)
47604766
)
47614767
);
47624768

schema/crdb/nexus-generation/up05.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ALTER TABLE omicron.public.bp_omicron_zone ADD CONSTRAINT IF NOT EXISTS nexus_generation_for_nexus_zones CHECK (
2+
(zone_type = 'nexus' AND nexus_generation IS NOT NULL)
3+
OR
4+
(zone_type != 'nexus' AND nexus_generation IS NULL)
5+
);

0 commit comments

Comments
 (0)