oxidecomputer / oxidecomputer/omicron
db schema: Use `hw_m2_slot` enum instead of ints for `inv_sled_config_reconciler`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
The inv_sled_config_reconciler table uses an INT2 column with a check constraint for storing the boot disk slot: https://github.com/oxidecomputer/omicron/blob/0bef6e9aae817d3b3717fb98a9d2f93c3c52122d/schema/crdb/dbinit.sql#L3721-L3727
#8624 adds a hw_m2_slot enum; we should use that instead. I think this will require the normal dance of
- rename old column
- add new column
- copy data from old to new
- drop old column
and we may also want to do the same to the boot_disk_error column just to keep them next to each other in the schema? (That may be overkill; certainly not necessary for crdb but might be nicer for readers.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with schema/crdb/dbinit.sql around lines 3721-3727 and review issue #8624 for the hw_m2_slot enum definition. Trace the migration conventions for renaming the existing column, adding the enum column, copying values, and removing the old column. Done means the reconciler schema stores the boot disk slot with hw_m2_slot and preserves existing data; decide whether boot_disk_error should change as part of the same cleanup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- databases
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100