Skip to content

Commit aa9d990

Browse files
authored
[1/n] move db schema into its own crate (#7880)
While working on Diesel-related code, I noticed that schema generation is both _very_ large (~450k lines of code currently), and also can be separated out into its own crate. Spent a couple of hours doing so and I think I quite like the result! The most important thing here is that the schema code is completely independent of the rest of Omicron, so it can be compiled in parallel with crates like omicron-common. For me, a full `cargo check --all-targets` in Omicron goes from 2m04s to 1m51s, which is a really nice speedup. Incremental builds should also be faster due to the parallelization and reduction of crate size. (But this doesn't really touch nexus-db-queries, which is the worst offender at the moment.)
1 parent cb3090b commit aa9d990

File tree

211 files changed

+1612
-1701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+1612
-1701
lines changed

Cargo.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ members = [
7878
"nexus/db-macros",
7979
"nexus/db-model",
8080
"nexus/db-queries",
81+
"nexus/db-schema",
8182
"nexus/defaults",
8283
"nexus/external-api",
8384
"nexus/internal-api",
@@ -219,6 +220,7 @@ default-members = [
219220
"nexus/db-macros",
220221
"nexus/db-model",
221222
"nexus/db-queries",
223+
"nexus/db-schema",
222224
"nexus/defaults",
223225
"nexus/external-api",
224226
"nexus/internal-api",
@@ -483,6 +485,7 @@ nexus-config = { path = "nexus-config" }
483485
nexus-db-fixed-data = { path = "nexus/db-fixed-data" }
484486
nexus-db-model = { path = "nexus/db-model" }
485487
nexus-db-queries = { path = "nexus/db-queries" }
488+
nexus-db-schema = { path = "nexus/db-schema" }
486489
nexus-defaults = { path = "nexus/defaults" }
487490
nexus-external-api = { path = "nexus/external-api" }
488491
nexus-inventory = { path = "nexus/inventory" }

dev-tools/omdb/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ nexus-client.workspace = true
3535
nexus-config.workspace = true
3636
nexus-db-model.workspace = true
3737
nexus-db-queries.workspace = true
38+
nexus-db-schema.workspace = true
3839
nexus-inventory.workspace = true
3940
nexus-reconfigurator-preparation.workspace = true
4041
nexus-saga-recovery.workspace = true

0 commit comments

Comments
 (0)