Brick Work

0016. Data model 4.0: Brick Work ids, a catalogue from the Rebrickable dump, one migration

Context

Brick Work 0.5 uses BrickLink's (item_type, item_no) as the identity of everything. Rebrickable and Brickset data is translated into it, and what cannot be translated becomes a ? placeholder. Spike #102 showed that a local catalogue with set part lists can come only from Rebrickable's dump, because BrickStore's archive of BrickLink data has no shown permission. It also showed that the dump reaches BrickLink ids only through mappings, which are n:m: sticker sheets, 970cNN legs whose BrickLink id depends on the colour, and assemblies. A Brick Work id touches 54 key references in 40 tables, so on 22 Oct the maintainer decided on a full redesign rather than patching the identity core. An initial design (22 Oct) was reviewed cold on 23 Oct ("approve with changes": two blockers, about 17–20 weeks) and revised; the revision is in docs/data-model-4.0/.

Options considered

  1. Keep BrickLink keys as identity and add a Rebrickable catalogue beside them. This is the smallest change, but every unmapped Rebrickable row stays a ? placeholder, and the n:m cases cannot be expressed.
  2. A Brick Work id with provider links, patched into schema 3.x. The identity changes, but the 40 tables keep typed pairs during a long transition.
  3. Schema 4.0 re-derived from the domain model (two files, Brick Work ids, links with status, one migration with proof, API v2).

Recommendation at the time: option 3.

Decision

Option 3, as designed in docs/data-model-4.0/data-model-design.md with its DDL. In short:

Consequences

#101 (decisions), #102 (spike), docs/data-model-4.0/, ADRs 0006, 0011.