Skip to content

Commit 30a341d

Browse files
committed
schema changes
1 parent 88466f0 commit 30a341d

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

nexus/db-model/src/schema_versions.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::collections::BTreeMap;
1717
///
1818
/// This must be updated when you change the database schema. Refer to
1919
/// schema/crdb/README.adoc in the root of this repository for details.
20-
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(65, 0, 0);
20+
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(66, 0, 0);
2121

2222
/// List of all past database schema versions, in *reverse* order
2323
///
@@ -29,6 +29,7 @@ static KNOWN_VERSIONS: Lazy<Vec<KnownVersion>> = Lazy::new(|| {
2929
// | leaving the first copy as an example for the next person.
3030
// v
3131
// KnownVersion::new(next_int, "unique-dirname-with-the-sql-files"),
32+
KnownVersion::new(66, "add-instance-updater-lock"),
3233
KnownVersion::new(65, "region-replacement"),
3334
KnownVersion::new(64, "add-view-for-v2p-mappings"),
3435
KnownVersion::new(63, "remove-producer-base-route-column"),
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ALTER TABLE omicron.public.instance
2+
ADD COLUMN IF NOT EXISTS updater_id UUID
3+
DEFAULT null,
4+
ADD COLUMN IF NOT EXISTS updater_gen INT
5+
NOT NULL DEFAULT 0;

schema/crdb/dbinit.sql

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,15 @@ CREATE TABLE IF NOT EXISTS omicron.public.instance (
10071007
ncpus INT NOT NULL,
10081008
memory INT NOT NULL,
10091009
hostname STRING(63) NOT NULL,
1010-
boot_on_fault BOOL NOT NULL DEFAULT false
1010+
boot_on_fault BOOL NOT NULL DEFAULT false,
1011+
1012+
/* ID of the instance update saga that has locked this instance for
1013+
* updating, if one exists. */
1014+
updater_id UUID,
1015+
1016+
/* Generation of the instance updater lock */
1017+
updater_gen INT NOT NULL
1018+
10111019
);
10121020

10131021
-- Names for instances within a project should be unique

0 commit comments

Comments
 (0)