oxidecomputer / oxidecomputer/omicron

db schema: Use `hw_m2_slot` enum instead of ints for `inv_sled_config_reconciler`

Open
#8,642 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

database
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.