database: Adapt to moor 3.0.0

This commit is contained in:
Elias Projahn 2020-05-03 22:18:41 +02:00
parent 96f80b3575
commit 437e6a3c2c
2 changed files with 14 additions and 4 deletions

View file

@ -4,3 +4,4 @@ targets:
moor_generator: moor_generator:
options: options:
generate_connect_constructor: true generate_connect_constructor: true
use_column_name_as_json_key_when_defined_in_moor_file: false

View file

@ -51,7 +51,10 @@ class Database extends _$Database {
/// Add [person] or replace an existing person with the same ID. /// Add [person] or replace an existing person with the same ID.
Future<void> updatePerson(Person person) async { Future<void> updatePerson(Person person) async {
await into(persons).insert(person, orReplace: true); await into(persons).insert(
person,
mode: InsertMode.insertOrReplace,
);
} }
/// Delete the person by [id]. /// Delete the person by [id].
@ -79,7 +82,10 @@ class Database extends _$Database {
/// Add [instrument] or replace an existing one with the same ID. /// Add [instrument] or replace an existing one with the same ID.
Future<void> updateInstrument(Instrument instrument) async { Future<void> updateInstrument(Instrument instrument) async {
await into(instruments).insert(instrument, orReplace: true); await into(instruments).insert(
instrument,
mode: InsertMode.insertOrReplace,
);
} }
/// Delete the instrument by [id]. /// Delete the instrument by [id].
@ -214,7 +220,10 @@ class Database extends _$Database {
/// Add [ensemble] or replace an existing one with the same ID. /// Add [ensemble] or replace an existing one with the same ID.
Future<void> updateEnsemble(Ensemble ensemble) async { Future<void> updateEnsemble(Ensemble ensemble) async {
await into(ensembles).insert(ensemble, orReplace: true); await into(ensembles).insert(
ensemble,
mode: InsertMode.insertOrReplace,
);
} }
/// Delete the ensemble by [id]. /// Delete the ensemble by [id].