The note growers most wish they had two seasons later — did it do well, was it worth keeping — never had a home. New append-only GardenOutcomes table (lotId, season year, three-face rating, free note); the question appears ONCE, inline, right after recording a harvest in the batch story, and is skippable without a trace. The answer shows as one more story line. Rides backups/sync like every mutable table (JSON codec, LWW import, HLC clock absorb). Migration v12→v13 guarded + verified from every historical version.
30 lines
928 B
Dart
30 lines
928 B
Dart
import 'package:drift_dev/api/migrations_native.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:tane/db/database.dart';
|
|
|
|
import 'schema/schema.dart';
|
|
|
|
void main() {
|
|
late SchemaVerifier verifier;
|
|
|
|
setUpAll(() {
|
|
verifier = SchemaVerifier(GeneratedHelper());
|
|
});
|
|
|
|
test('freshly created database matches the exported schema v13', () async {
|
|
final schema = await verifier.schemaAt(13);
|
|
final db = AppDatabase(schema.newConnection());
|
|
await verifier.migrateAndValidate(db, 13);
|
|
await db.close();
|
|
});
|
|
|
|
// Every historical version upgrades cleanly to the current schema (v13).
|
|
for (var from = 1; from <= 12; from++) {
|
|
test('upgrades v$from → v13 and matches the fresh schema', () async {
|
|
final connection = await verifier.startAt(from);
|
|
final db = AppDatabase(connection);
|
|
await verifier.migrateAndValidate(db, 13);
|
|
await db.close();
|
|
});
|
|
}
|
|
}
|