oxidecomputer / oxidecomputer/omicron
Need a check that field order in schema.rs matches order in dbinit.sql
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
While developing https://github.com/oxidecomputer/omicron/pull/4520 I encountered a mysterious error Received more than 8 bytes decoding i64. Was an expression of a different type misidentified as BigInt? (full error). It took a bit of debugging work to figure out that this was happening due to a mismatch in the field order between dbinit.sql and schema.rs.
We should have a check to ensure that the field order (and maybe types, if possible) match.
Another related issue is checking that the order of fields in a Queryable or Insertable struct is the same as that in the database.
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
Read dbinit.sql and schema.rs first, then inspect the Queryable and Insertable structs mentioned in the issue to understand how field order is represented. Define whether the check covers only field order or types as well; done means mismatches are detected before they cause decoding errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100