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

@ -3,9 +3,26 @@
// may only be appended, never renumbered or reused; when sync arrives, readers
// must tolerate unknown values (map to a safe default). No sync yet in Block 1.
/// Whether a lot holds seeds or living plants/seedlings (plantel). Germination
/// tests apply only to seed lots.
enum LotType { seed, plant }
/// The form in which a lot is held. `seed` is dry seed (the only form
/// germination tests apply to); the rest are living/vegetative material. Values
/// are stored by name and append-only (data-model §5): never renamed/reordered.
///
/// - `seedling` a young plant grown from seed, to transplant (plantón).
/// - `plant` an established plant (potted or bare-root).
/// - `tree` a woody plant: tree or shrub.
/// - `bulb` a storage organ: bulb, corm, tuber or rhizome.
/// - `cutting` vegetative propagation material (cutting, scion).
enum LotType { seed, plant, seedling, tree, bulb, cutting }
/// How living plant material is packaged/supplied an optional attribute of a
/// non-seed [Lot], kept separate from the amount. Append-only by name.
///
/// - `pot` in a pot/container (maceta/contenedor).
/// - `tray` in a plug/cell tray (bandeja de alvéolos).
/// - `plug` a single plug/cell.
/// - `bareRoot` dormant, roots exposed, no soil (raíz desnuda).
/// - `rootBall` dug with an intact soil ball (cepellón).
enum Presentation { pot, tray, plug, bareRoot, rootBall }
/// Per-lot visibility (data-model §2.3). Used by the future sharing layer.
enum OfferStatus { private, shared, exchange, sell }