Skip to content

Commit

Permalink
schema changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed May 24, 2024
1 parent 88466f0 commit 30a341d
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(65, 0, 0);
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(66, 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(66, "add-instance-updater-lock"),
KnownVersion::new(65, "region-replacement"),
KnownVersion::new(64, "add-view-for-v2p-mappings"),
KnownVersion::new(63, "remove-producer-base-route-column"),
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 @@ -1007,7 +1007,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 30a341d

Please sign in to comment.