Start migrating the ingredient cache to a local sqlite database

This commit is contained in:
Roland Geider
2024-09-26 21:18:54 +02:00
parent 15b6eb19b0
commit 8ce9029459
3 changed files with 57 additions and 38 deletions

View File

@@ -10,6 +10,7 @@ part 'ingredients_database.g.dart';
@DataClassName('IngredientTable')
class Ingredients extends Table {
const Ingredients();
IntColumn get id => integer()();
TextColumn get data => text()();
@@ -27,6 +28,14 @@ class IngredientDatabase extends _$IngredientDatabase {
@override
// TODO: implement schemaVersion
int get schemaVersion => 1;
Future<void> deleteEverything() {
return transaction(() async {
for (final table in allTables) {
await delete(table).go();
}
});
}
}
LazyDatabase _openConnection() {