Skip to content

db schema: Use hw_m2_slot enum instead of ints for inv_sled_config_reconciler #8642

@jgallagher

Description

@jgallagher

The inv_sled_config_reconciler table uses an INT2 column with a check constraint for storing the boot disk slot:

omicron/schema/crdb/dbinit.sql

Lines 3721 to 3727 in 0bef6e9

-- Which internal disk slot did we use at boot?
--
-- If not NULL, `boot_disk_slot` must be 0 or 1 (corresponding to M2Slot::A
-- and M2Slot::B, respectively). The column pair `boot_disk_slot` /
-- `boot_disk_error` represents a Rust `Result`; one or the other must be
-- non-NULL, but not both.
boot_disk_slot INT2 CHECK (boot_disk_slot >= 0 AND boot_disk_slot <= 1),

#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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    databaseRelated to database access

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions