The data model always meant sale offers to carry an informational price (data-model §2.8, sharing-model §4.4); with offer state collapsed onto the Lot, the price lives there. Null amount on a sell lot = 'to be agreed' — the NIP-99 event simply omits the price tag. - schema v11: Lots.price_amount/price_currency, guarded migration, schema dump + generated schema_v11 for the round-trip test - ShareableLot/VarietyLot carry the price (sell-only in shareableLots); addLot/updateLot persist it and clear it when the lot leaves sale - OffersCubit.publishLots forwards it (outbox flush picks it up free) - lot sheet: price + currency inputs revealed only on 'For sale', with the €/Ğ1/hours quick-picks extracted to a shared CurrencyQuickPicks widget (reused by the sale sheet) - backup JSON round-trips the new columns - i18n share.price/priceHint in en/es/pt/ast
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 v11', () async {
|
|
final schema = await verifier.schemaAt(11);
|
|
final db = AppDatabase(schema.newConnection());
|
|
await verifier.migrateAndValidate(db, 11);
|
|
await db.close();
|
|
});
|
|
|
|
// Every historical version upgrades cleanly to the current schema (v11).
|
|
for (var from = 1; from <= 10; from++) {
|
|
test('upgrades v$from → v11 and matches the fresh schema', () async {
|
|
final connection = await verifier.startAt(from);
|
|
final db = AppDatabase(connection);
|
|
await verifier.migrateAndValidate(db, 11);
|
|
await db.close();
|
|
});
|
|
}
|
|
}
|