oxidecomputer / oxidecomputer/omicron
Use SQL composite data types for mutli-parent resource
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
We have some tables with columns being foreign keys to potentially multiple tables depending on some kind or type, e.g.:
CREATE TYPE omicron.public.network_interface_kind AS ENUM (
/* An interface attached to a guest instance. */
'instance',
/* An interface attached to a service. */
'service'
);
CREATE TABLE omicron.public.network_interface (
/* ...snip... */
/* The kind of network interface, e.g., instance */
kind omicron.public.network_interface_kind NOT NULL,
/*
* FK into the parent resource of this interface (e.g. Instance, Service)
* as determined by the `kind`.
*/
parent_id UUID NOT NULL,
Keeping track of 2 separate columns can be kind of fraught so it'd be nice to replace with a composite data type on the SQL side and an enum + appropriate impls on the Rust side.
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 the network_interface SQL definition shown in the issue and locate the corresponding Rust enum and implementations. Trace other tables that use kind and parent_id pairs to determine the full scope. Done means the affected resources consistently use the composite SQL type and matching Rust representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100