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:
parent
06aed2a586
commit
3954c62aa6
16 changed files with 6174 additions and 32 deletions
|
|
@ -50,6 +50,8 @@ class Lots extends Table with SyncColumns {
|
|||
TextColumn get quantityKind => text().nullable()(); // QuantityKind.name
|
||||
RealColumn get quantityPrecise => real().nullable()();
|
||||
TextColumn get quantityLabel => text().nullable()();
|
||||
// How living (non-seed) material is packaged; null for seed lots or unset.
|
||||
TextColumn get presentation => textEnum<Presentation>().nullable()();
|
||||
TextColumn get storageLocation => text().nullable()();
|
||||
TextColumn get offerStatus =>
|
||||
textEnum<OfferStatus>().withDefault(const Constant('private'))();
|
||||
|
|
@ -99,6 +101,12 @@ class Attachments extends Table with SyncColumns {
|
|||
TextColumn get uri => text().nullable()();
|
||||
BlobColumn get bytes => blob().nullable()();
|
||||
TextColumn get mimeType => text().nullable()();
|
||||
|
||||
/// Display order among sibling attachments (lower first). The lowest-ordered
|
||||
/// photo is the "preferred"/cover — used as the variety avatar and shown
|
||||
/// first. New photos append at the end; "set as cover" moves one to the
|
||||
/// front. A plain int (not a bool flag) so it generalizes to full reordering.
|
||||
IntColumn get sortOrder => integer().withDefault(const Constant(0))();
|
||||
}
|
||||
|
||||
/// Any pasted URL (Wikipedia, forum…). Polymorphic parent.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue