feat(plantare): reproduction-commitment data layer (schema v9)
The Plantare — a promise to reproduce seed and return some (data-model §2.7, the seed-domain Pledge with return_kind=similar). NOT a sale. Local-first v1: your honest ledger of commitments (from/to a person by name); the bilateral signed cross-party form is a later social-layer phase. - New Plantares table (SyncColumns): varietyId, direction (iReturn/owedToMe), counterparty, owedDescription, madeOn, dueBy, status (open/returned/ forgiven), settledOn, note. schemaVersion 8 -> 9 with a guarded createTable migration; schema exported + migration-test helper regenerated. - VarietyRepository: createPlantare / watchPlantares / watchPlantaresForVariety / setPlantareStatus / deletePlantare (soft-delete, CRDT-stamped). - Included in backups + sync: InventorySnapshot + JSON codec (round-trips isDeleted) + exportInventory/exportForSync/importInventory, so commitments survive restore and replicate LWW like every other row. Tests: v1..v8 -> v9 migration + fresh v9; repo create/list/settle/reopen/ delete; and a backup round-trip preserving a commitment. 13 green. UI (detail section + Plantares screen) follows.
This commit is contained in:
parent
0e41293de5
commit
81094f25a8
12 changed files with 5418 additions and 60 deletions
|
|
@ -22,6 +22,7 @@ part 'database.g.dart';
|
|||
Parties,
|
||||
Attachments,
|
||||
ExternalLinks,
|
||||
Plantares,
|
||||
],
|
||||
)
|
||||
class AppDatabase extends _$AppDatabase {
|
||||
|
|
@ -29,7 +30,7 @@ class AppDatabase extends _$AppDatabase {
|
|||
|
||||
/// Current schema version; also stamped into interchange exports so an
|
||||
/// importer knows which app generation wrote the file (data-model §7).
|
||||
static const int currentSchemaVersion = 8;
|
||||
static const int currentSchemaVersion = 9;
|
||||
|
||||
@override
|
||||
int get schemaVersion => currentSchemaVersion;
|
||||
|
|
@ -138,6 +139,13 @@ class AppDatabase extends _$AppDatabase {
|
|||
await m.createTable(conditionChecks);
|
||||
}
|
||||
}
|
||||
// v9: Plantares — reproduction commitments (data-model §2.7). Guarded so a
|
||||
// half-migrated dev database re-runs cleanly (see the v7 note above).
|
||||
if (from < 9) {
|
||||
if (!await _hasTable('plantares')) {
|
||||
await m.createTable(plantares);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue