feat(db): lot presentation + attachment sort order (schema v4→v5)

Expand LotType from {seed, plant} to six append-only forms (seed,
seedling, plant, tree, bulb, cutting) and add an optional Presentation
attribute (pot/tray/plug/bareRoot/rootBall) kept separate from quantity
so 'how many' and 'in what packaging' never conflate.

Add attachments.sortOrder so the cover photo is the lowest-ordered one,
enabling reordering from the full-screen viewer. Expand QuantityKind
with the new plant-aware forms.

Migrations are additive (v1→v5 all covered by migration_test); enum
values are stored by name and appended only, keeping CRDT sync safe.
This commit is contained in:
vjrj 2026-07-09 11:51:21 +02:00
parent 06aed2a586
commit 3954c62aa6
16 changed files with 6174 additions and 32 deletions

View file

@ -33,10 +33,15 @@ enum QuantityKind {
tuber(QuantityGroup.seedForm, countable: true),
seedHead(QuantityGroup.seedForm, countable: true),
bunch(QuantityGroup.seedForm, countable: true),
// Seedlings / plants (for a plant lot).
// Living material counted as whole individuals (seedling / plant / tree /
// bulb / cutting lots). [pot] and [tray] are retained for old rows but are no
// longer offered as amounts packaging now lives in [Presentation] instead.
plant(QuantityGroup.plant, countable: true),
pot(QuantityGroup.plant, countable: true),
tray(QuantityGroup.plant, countable: true),
seedling(QuantityGroup.plant, countable: true),
tree(QuantityGroup.plant, countable: true),
cutting(QuantityGroup.plant, countable: true),
// Precise (optional).
grams(QuantityGroup.precise, countable: true),
count(QuantityGroup.precise, countable: true);