From 153e5897a07fdb9c1ab632887f63703f4ada3b6e Mon Sep 17 00:00:00 2001 From: Greg Colombo Date: Thu, 12 Oct 2023 15:59:13 +0000 Subject: [PATCH] Move instance/VMM table schema upgrade to version 7.0.0 The instance/VMM table schema change was slated to be 6.0.0 in the original version of its pull request. That version was then added by a separate PR, but this didn't cause a merge conflict because the instance/VMM upgrade used an extra "0" in its schema upgrade files (for fear that there might be more than nine of them and that the leading 0 would be necessary to ensure they had the correct lexographical ordering). The schema changes don't conflict with each other, so everything actually works fine, but having two logically separate updates in one version is at the very least aesthetically displeasing. Move the instance schema upgrade to version 7.0.0. Rename the files to remove the leading 0 in their numbers, since that turned out not to be needed. Tested via cargo tests (there are no other functional or schema changes beyond renaming and updating version constants). --- dev-tools/omdb/tests/env.out | 6 +++--- dev-tools/omdb/tests/successes.out | 12 ++++++------ nexus/db-model/src/schema.rs | 2 +- schema/crdb/{6.0.0 => 7.0.0}/README.adoc | 0 schema/crdb/{6.0.0/up01.sql => 7.0.0/up1.sql} | 0 schema/crdb/{6.0.0/up02.sql => 7.0.0/up2.sql} | 0 schema/crdb/{6.0.0/up03.sql => 7.0.0/up3.sql} | 0 schema/crdb/{6.0.0/up04.sql => 7.0.0/up4.sql} | 0 schema/crdb/{6.0.0/up05.sql => 7.0.0/up5.sql} | 0 schema/crdb/{6.0.0/up06.sql => 7.0.0/up6.sql} | 0 schema/crdb/{6.0.0/up07.sql => 7.0.0/up7.sql} | 0 schema/crdb/{6.0.0/up08.sql => 7.0.0/up8.sql} | 0 schema/crdb/{6.0.0/up09.sql => 7.0.0/up9.sql} | 0 schema/crdb/dbinit.sql | 2 +- 14 files changed, 11 insertions(+), 11 deletions(-) rename schema/crdb/{6.0.0 => 7.0.0}/README.adoc (100%) rename schema/crdb/{6.0.0/up01.sql => 7.0.0/up1.sql} (100%) rename schema/crdb/{6.0.0/up02.sql => 7.0.0/up2.sql} (100%) rename schema/crdb/{6.0.0/up03.sql => 7.0.0/up3.sql} (100%) rename schema/crdb/{6.0.0/up04.sql => 7.0.0/up4.sql} (100%) rename schema/crdb/{6.0.0/up05.sql => 7.0.0/up5.sql} (100%) rename schema/crdb/{6.0.0/up06.sql => 7.0.0/up6.sql} (100%) rename schema/crdb/{6.0.0/up07.sql => 7.0.0/up7.sql} (100%) rename schema/crdb/{6.0.0/up08.sql => 7.0.0/up8.sql} (100%) rename schema/crdb/{6.0.0/up09.sql => 7.0.0/up9.sql} (100%) diff --git a/dev-tools/omdb/tests/env.out b/dev-tools/omdb/tests/env.out index 07a6d3fae5..8e345b78d1 100644 --- a/dev-tools/omdb/tests/env.out +++ b/dev-tools/omdb/tests/env.out @@ -7,7 +7,7 @@ sim-b6d65341 [::1]:REDACTED_PORT - REDACTED_UUID_REDACTED_UUID_REDACTED --------------------------------------------- stderr: note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable -note: database schema version matches expected (6.0.0) +note: database schema version matches expected (7.0.0) ============================================= EXECUTING COMMAND: omdb ["db", "--db-url", "junk", "sleds"] termination: Exited(2) @@ -172,7 +172,7 @@ stderr: note: database URL not specified. Will search DNS. note: (override with --db-url or OMDB_DB_URL) note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable -note: database schema version matches expected (6.0.0) +note: database schema version matches expected (7.0.0) ============================================= EXECUTING COMMAND: omdb ["--dns-server", "[::1]:REDACTED_PORT", "db", "sleds"] termination: Exited(0) @@ -185,5 +185,5 @@ stderr: note: database URL not specified. Will search DNS. note: (override with --db-url or OMDB_DB_URL) note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable -note: database schema version matches expected (6.0.0) +note: database schema version matches expected (7.0.0) ============================================= diff --git a/dev-tools/omdb/tests/successes.out b/dev-tools/omdb/tests/successes.out index 038f365e8e..6fd84c5eb3 100644 --- a/dev-tools/omdb/tests/successes.out +++ b/dev-tools/omdb/tests/successes.out @@ -8,7 +8,7 @@ external oxide-dev.test 2 create silo: "tes --------------------------------------------- stderr: note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable -note: database schema version matches expected (6.0.0) +note: database schema version matches expected (7.0.0) ============================================= EXECUTING COMMAND: omdb ["db", "dns", "diff", "external", "2"] termination: Exited(0) @@ -24,7 +24,7 @@ changes: names added: 1, names removed: 0 --------------------------------------------- stderr: note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable -note: database schema version matches expected (6.0.0) +note: database schema version matches expected (7.0.0) ============================================= EXECUTING COMMAND: omdb ["db", "dns", "names", "external", "2"] termination: Exited(0) @@ -36,7 +36,7 @@ External zone: oxide-dev.test --------------------------------------------- stderr: note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable -note: database schema version matches expected (6.0.0) +note: database schema version matches expected (7.0.0) ============================================= EXECUTING COMMAND: omdb ["db", "services", "list-instances"] termination: Exited(0) @@ -52,7 +52,7 @@ Nexus REDACTED_UUID_REDACTED_UUID_REDACTED [::ffff:127.0.0.1]:REDACTED_ --------------------------------------------- stderr: note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable -note: database schema version matches expected (6.0.0) +note: database schema version matches expected (7.0.0) ============================================= EXECUTING COMMAND: omdb ["db", "services", "list-by-sled"] termination: Exited(0) @@ -71,7 +71,7 @@ sled: sim-b6d65341 (id REDACTED_UUID_REDACTED_UUID_REDACTED) --------------------------------------------- stderr: note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable -note: database schema version matches expected (6.0.0) +note: database schema version matches expected (7.0.0) ============================================= EXECUTING COMMAND: omdb ["db", "sleds"] termination: Exited(0) @@ -82,7 +82,7 @@ sim-b6d65341 [::1]:REDACTED_PORT - REDACTED_UUID_REDACTED_UUID_REDACTED --------------------------------------------- stderr: note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable -note: database schema version matches expected (6.0.0) +note: database schema version matches expected (7.0.0) ============================================= EXECUTING COMMAND: omdb ["mgs", "inventory"] termination: Exited(0) diff --git a/nexus/db-model/src/schema.rs b/nexus/db-model/src/schema.rs index 2d6970452d..61a05754c6 100644 --- a/nexus/db-model/src/schema.rs +++ b/nexus/db-model/src/schema.rs @@ -1142,7 +1142,7 @@ table! { /// /// This should be updated whenever the schema is changed. For more details, /// refer to: schema/crdb/README.adoc -pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(6, 0, 0); +pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(7, 0, 0); allow_tables_to_appear_in_same_query!( system_update, diff --git a/schema/crdb/6.0.0/README.adoc b/schema/crdb/7.0.0/README.adoc similarity index 100% rename from schema/crdb/6.0.0/README.adoc rename to schema/crdb/7.0.0/README.adoc diff --git a/schema/crdb/6.0.0/up01.sql b/schema/crdb/7.0.0/up1.sql similarity index 100% rename from schema/crdb/6.0.0/up01.sql rename to schema/crdb/7.0.0/up1.sql diff --git a/schema/crdb/6.0.0/up02.sql b/schema/crdb/7.0.0/up2.sql similarity index 100% rename from schema/crdb/6.0.0/up02.sql rename to schema/crdb/7.0.0/up2.sql diff --git a/schema/crdb/6.0.0/up03.sql b/schema/crdb/7.0.0/up3.sql similarity index 100% rename from schema/crdb/6.0.0/up03.sql rename to schema/crdb/7.0.0/up3.sql diff --git a/schema/crdb/6.0.0/up04.sql b/schema/crdb/7.0.0/up4.sql similarity index 100% rename from schema/crdb/6.0.0/up04.sql rename to schema/crdb/7.0.0/up4.sql diff --git a/schema/crdb/6.0.0/up05.sql b/schema/crdb/7.0.0/up5.sql similarity index 100% rename from schema/crdb/6.0.0/up05.sql rename to schema/crdb/7.0.0/up5.sql diff --git a/schema/crdb/6.0.0/up06.sql b/schema/crdb/7.0.0/up6.sql similarity index 100% rename from schema/crdb/6.0.0/up06.sql rename to schema/crdb/7.0.0/up6.sql diff --git a/schema/crdb/6.0.0/up07.sql b/schema/crdb/7.0.0/up7.sql similarity index 100% rename from schema/crdb/6.0.0/up07.sql rename to schema/crdb/7.0.0/up7.sql diff --git a/schema/crdb/6.0.0/up08.sql b/schema/crdb/7.0.0/up8.sql similarity index 100% rename from schema/crdb/6.0.0/up08.sql rename to schema/crdb/7.0.0/up8.sql diff --git a/schema/crdb/6.0.0/up09.sql b/schema/crdb/7.0.0/up9.sql similarity index 100% rename from schema/crdb/6.0.0/up09.sql rename to schema/crdb/7.0.0/up9.sql diff --git a/schema/crdb/dbinit.sql b/schema/crdb/dbinit.sql index 2b06e4cbd6..9f5f78326c 100644 --- a/schema/crdb/dbinit.sql +++ b/schema/crdb/dbinit.sql @@ -2539,7 +2539,7 @@ INSERT INTO omicron.public.db_metadata ( version, target_version ) VALUES - ( TRUE, NOW(), NOW(), '6.0.0', NULL) + ( TRUE, NOW(), NOW(), '7.0.0', NULL) ON CONFLICT DO NOTHING;