Skip to content

[test] Check that CockroachDB tables align with Diesel tables#9927

Open
smklein wants to merge 8 commits intomainfrom
crdb-alignment
Open

[test] Check that CockroachDB tables align with Diesel tables#9927
smklein wants to merge 8 commits intomainfrom
crdb-alignment

Conversation

@smklein
Copy link
Collaborator

@smklein smklein commented Feb 26, 2026

Part of #9925

Comment on lines 5246 to 5250
"bp_omicron_zone.underlay_address",
"inv_omicron_sled_config_dataset.sled_id",
"inv_omicron_sled_config_disk.sled_id",
"silo_group.active",
"tuf_trust_root.time_modified",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is a work-in-progress, but FYI, this is how I uncovered the problem cases fixed in #9926

pub columns: fn() -> Vec<(&'static str, &'static str)>,
}

#[distributed_slice]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sorta the implementation-specific artifact to come out of the table! macro in nexus/db-schema/src/schema.rs, but basically:

  • I made a new table! macro
  • looks and smells like the old table macro
  • it also auto-registers the table with this big static list

This means that "just by declaring your table macro, we know your table exists", and you don't need to type the table name again in some big list somewhere else.

For folks updating schema.rs: it means there's no observable changes.
For our tests: We now know the list of all schema-declared tables, as well as the types of all columns within.

Aside: linkme is kinda dope

Comment on lines +5148 to +5149
// Check for Array<...>
let kind = if let Some(array_inner) = inner
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cockroach doesn't support nested arrays, fwiw, so this is as far as we'd go

@smklein smklein marked this pull request as ready for review February 27, 2026 17:08
@smklein smklein requested review from hawkw and jgallagher February 27, 2026 17:11
@smklein
Copy link
Collaborator Author

smklein commented Feb 27, 2026

As an FYI, my next step is going to be: "reduce the size of the exception-list EXPECTORATE files". But this PR really is the back-stop regression test which should prevent this problem from getting worse.

@smklein smklein changed the title Align CockroachDB tables with Diesel tables [test] Check that CockroachDB tables align with Diesel tables Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant