Skip to content

Commit afd2dad

Browse files
committed
schema changes
1 parent 1efdae5 commit afd2dad

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(60, 0, 0);
20+
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(61, 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(61, "add-instance-updater-lock"),
3233
KnownVersion::new(60, "add-lookup-vmm-by-sled-id-index"),
3334
KnownVersion::new(59, "enforce-first-as-default"),
3435
KnownVersion::new(58, "insert-default-allowlist"),
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
@@ -1002,7 +1002,15 @@ CREATE TABLE IF NOT EXISTS omicron.public.instance (
10021002
ncpus INT NOT NULL,
10031003
memory INT NOT NULL,
10041004
hostname STRING(63) NOT NULL,
1005-
boot_on_fault BOOL NOT NULL DEFAULT false
1005+
boot_on_fault BOOL NOT NULL DEFAULT false,
1006+
1007+
/* ID of the instance update saga that has locked this instance for
1008+
* updating, if one exists. */
1009+
updater_id UUID,
1010+
1011+
/* Generation of the instance updater lock */
1012+
updater_gen INT NOT NULL
1013+
10061014
);
10071015

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

0 commit comments

Comments
 (0)