Skip to content

Commit

Permalink
schema changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed May 20, 2024
1 parent 1efdae5 commit afd2dad
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion nexus/db-model/src/schema_versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::collections::BTreeMap;
///
/// This must be updated when you change the database schema. Refer to
/// schema/crdb/README.adoc in the root of this repository for details.
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(60, 0, 0);
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(61, 0, 0);

/// List of all past database schema versions, in *reverse* order
///
Expand All @@ -29,6 +29,7 @@ static KNOWN_VERSIONS: Lazy<Vec<KnownVersion>> = Lazy::new(|| {
// | leaving the first copy as an example for the next person.
// v
// KnownVersion::new(next_int, "unique-dirname-with-the-sql-files"),
KnownVersion::new(61, "add-instance-updater-lock"),
KnownVersion::new(60, "add-lookup-vmm-by-sled-id-index"),
KnownVersion::new(59, "enforce-first-as-default"),
KnownVersion::new(58, "insert-default-allowlist"),
Expand Down
5 changes: 5 additions & 0 deletions schema/crdb/add-instance-updater-lock/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE omicron.public.instance
ADD COLUMN IF NOT EXISTS updater_id UUID
DEFAULT null,
ADD COLUMN IF NOT EXISTS updater_gen INT
NOT NULL DEFAULT 0;
10 changes: 9 additions & 1 deletion schema/crdb/dbinit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,15 @@ CREATE TABLE IF NOT EXISTS omicron.public.instance (
ncpus INT NOT NULL,
memory INT NOT NULL,
hostname STRING(63) NOT NULL,
boot_on_fault BOOL NOT NULL DEFAULT false
boot_on_fault BOOL NOT NULL DEFAULT false,

/* ID of the instance update saga that has locked this instance for
* updating, if one exists. */
updater_id UUID,

/* Generation of the instance updater lock */
updater_gen INT NOT NULL

);

-- Names for instances within a project should be unique
Expand Down

0 comments on commit afd2dad

Please sign in to comment.