Skip to content

Commit

Permalink
schema upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
smklein committed Jul 26, 2024
1 parent 021aa2f commit 67bf6fa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 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(83, 0, 0);
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(84, 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(84, "inv-dataset"),
KnownVersion::new(83, "dataset-address-optional"),
KnownVersion::new(82, "region-port"),
KnownVersion::new(81, "add-nullable-filesystem-pool"),
Expand Down
3 changes: 1 addition & 2 deletions schema/crdb/dbinit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3206,7 +3206,6 @@ CREATE TABLE IF NOT EXISTS omicron.public.inv_dataset (
-- - Which collection this was
-- - The sled reporting the disk
-- - The name of this dataset
-- - The slot in which this disk was found
PRIMARY KEY (inv_collection_id, sled_id, name)
);

Expand Down Expand Up @@ -4171,7 +4170,7 @@ INSERT INTO omicron.public.db_metadata (
version,
target_version
) VALUES
(TRUE, NOW(), NOW(), '83.0.0', NULL)
(TRUE, NOW(), NOW(), '84.0.0', NULL)
ON CONFLICT DO NOTHING;

COMMIT;
16 changes: 16 additions & 0 deletions schema/crdb/inv-dataset/up01.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
CREATE TABLE IF NOT EXISTS omicron.public.inv_dataset (
inv_collection_id UUID NOT NULL,
sled_id UUID NOT NULL,

id UUID,

name TEXT NOT NULL,
available INT8 NOT NULL,
used INT8 NOT NULL,
quota INT8,
reservation INT8,
compression TEXT NOT NULL,

PRIMARY KEY (inv_collection_id, sled_id, name)
);

0 comments on commit 67bf6fa

Please sign in to comment.