diff --git a/app/lib/app_init.dart b/app/lib/app_init.dart index dc62ba9b..059c5c8a 100644 --- a/app/lib/app_init.dart +++ b/app/lib/app_init.dart @@ -207,12 +207,6 @@ Future _initDiContainer(InitIsolateType isolateType) async { const AlbumRemoteDataSource2(), AlbumSqliteDbDataSource2(c.sqliteDb)); c.albumRepo2Remote = const BasicAlbumRepo2(AlbumRemoteDataSource2()); c.albumRepo2Local = BasicAlbumRepo2(AlbumSqliteDbDataSource2(c.sqliteDb)); - c.faceRecognitionPersonRepo = const BasicFaceRecognitionPersonRepo( - FaceRecognitionPersonRemoteDataSource()); - c.faceRecognitionPersonRepoRemote = const BasicFaceRecognitionPersonRepo( - FaceRecognitionPersonRemoteDataSource()); - c.faceRecognitionPersonRepoLocal = BasicFaceRecognitionPersonRepo( - FaceRecognitionPersonSqliteDbDataSource(c.sqliteDb)); c.fileRepo = FileRepo(FileCachedDataSource(c)); c.fileRepoRemote = const FileRepo(FileWebdavDataSource()); c.fileRepoLocal = FileRepo(FileSqliteDbDataSource(c)); @@ -228,6 +222,12 @@ Future _initDiContainer(InitIsolateType isolateType) async { const NcAlbumRemoteDataSource(), NcAlbumSqliteDbDataSource(c.sqliteDb)); c.ncAlbumRepoRemote = const BasicNcAlbumRepo(NcAlbumRemoteDataSource()); c.ncAlbumRepoLocal = BasicNcAlbumRepo(NcAlbumSqliteDbDataSource(c.sqliteDb)); + c.faceRecognitionPersonRepo = const BasicFaceRecognitionPersonRepo( + FaceRecognitionPersonRemoteDataSource()); + c.faceRecognitionPersonRepoRemote = const BasicFaceRecognitionPersonRepo( + FaceRecognitionPersonRemoteDataSource()); + c.faceRecognitionPersonRepoLocal = BasicFaceRecognitionPersonRepo( + FaceRecognitionPersonSqliteDbDataSource(c.sqliteDb)); c.touchManager = TouchManager(c); diff --git a/app/lib/di_container.dart b/app/lib/di_container.dart index b20f2ba4..a2070343 100644 --- a/app/lib/di_container.dart +++ b/app/lib/di_container.dart @@ -434,8 +434,4 @@ extension DiContainerExtension on DiContainer { DiContainer withLocalFileRepo() => copyWith(fileRepo: OrNull(fileRepoLocal)); DiContainer withRemoteTagRepo() => copyWith(tagRepo: OrNull(tagRepoRemote)); DiContainer withLocalTagRepo() => copyWith(tagRepo: OrNull(tagRepoLocal)); - DiContainer withRemoteFaceRecognitionPersonRepo() => copyWith( - faceRecognitionPersonRepo: OrNull(faceRecognitionPersonRepoRemote)); - DiContainer withLocalFaceRecognitionPersonRepo() => copyWith( - faceRecognitionPersonRepo: OrNull(faceRecognitionPersonRepoLocal)); } diff --git a/app/lib/entity/face_recognition_person/data_source.dart b/app/lib/entity/face_recognition_person/data_source.dart index 308564ed..122182ea 100644 --- a/app/lib/entity/face_recognition_person/data_source.dart +++ b/app/lib/entity/face_recognition_person/data_source.dart @@ -72,7 +72,7 @@ class FaceRecognitionPersonSqliteDbDataSource Future> getPersons(Account account) async { _log.info("[getPersons] $account"); final dbPersons = await sqliteDb.use((db) async { - return await db.allPersons(account: sql.ByAccount.app(account)); + return await db.allFaceRecognitionPersons(account: sql.ByAccount.app(account)); }); return dbPersons .map((p) { diff --git a/app/lib/entity/search/data_source.dart b/app/lib/entity/search/data_source.dart index 3003cfa8..3458e177 100644 --- a/app/lib/entity/search/data_source.dart +++ b/app/lib/entity/search/data_source.dart @@ -164,7 +164,7 @@ class SearchSqliteDbDataSource implements SearchDataSource { // "Ada" will return results from "Ada Crook" but NOT "Adabelle" try { final dbPersons = await _c.sqliteDb.use((db) async { - return await db.personsByName( + return await db.faceRecognitionPersonsByName( appAccount: account, name: criteria.input, ); @@ -172,7 +172,7 @@ class SearchSqliteDbDataSource implements SearchDataSource { if (dbPersons.isEmpty) { return []; } - final persons = (await dbPersons.convertToAppPerson()) + final persons = (await dbPersons.convertToAppFaceRecognitionPerson()) .map((p) => PersonBuilder.byFaceRecognitionPerson(account, p)) .toList(); _log.info( diff --git a/app/lib/entity/sqlite/database.dart b/app/lib/entity/sqlite/database.dart index 2adb2542..c71cdb95 100644 --- a/app/lib/entity/sqlite/database.dart +++ b/app/lib/entity/sqlite/database.dart @@ -18,8 +18,8 @@ import 'package:nc_photos/platform/k.dart' as platform_k; import 'package:np_codegen/np_codegen.dart'; part 'database.g.dart'; -part 'database_extension.dart'; part 'database/nc_album_extension.dart'; +part 'database_extension.dart'; // remember to also update the truncate method after adding a new table @npLog @@ -36,7 +36,7 @@ part 'database/nc_album_extension.dart'; Albums, AlbumShares, Tags, - Persons, + FaceRecognitionPersons, NcAlbums, NcAlbumItems, ], @@ -47,7 +47,7 @@ class SqliteDb extends _$SqliteDb { }) : super(executor ?? platform.openSqliteConnection()); @override - get schemaVersion => 5; + get schemaVersion => 6; @override get migration => MigrationStrategy( @@ -86,7 +86,7 @@ class SqliteDb extends _$SqliteDb { await transaction(() async { if (from < 2) { await m.createTable(tags); - await m.createTable(persons); + await m.createTable(faceRecognitionPersons); await _createIndexV2(m); } if (from < 3) { @@ -100,6 +100,11 @@ class SqliteDb extends _$SqliteDb { await m.createTable(ncAlbums); await m.createTable(ncAlbumItems); } + if (from < 6) { + if (from >= 2) { + await m.renameTable(faceRecognitionPersons, "persons"); + } + } }); } catch (e, stackTrace) { _log.shout("[onUpgrade] Failed upgrading sqlite db", e, stackTrace); @@ -119,8 +124,8 @@ class SqliteDb extends _$SqliteDb { Future _createIndexV2(Migrator m) async { await m.createIndex(Index("tags_server_index", "CREATE INDEX tags_server_index ON tags(server);")); - await m.createIndex(Index("persons_account_index", - "CREATE INDEX persons_account_index ON persons(account);")); + await m.createIndex(Index("face_recognition_persons_account_index", + "CREATE INDEX face_recognition_persons_account_index ON face_recognition_persons(account);")); } Future _createIndexV3(Migrator m) async { diff --git a/app/lib/entity/sqlite/database.g.dart b/app/lib/entity/sqlite/database.g.dart index 926a0713..b23a0444 100644 --- a/app/lib/entity/sqlite/database.g.dart +++ b/app/lib/entity/sqlite/database.g.dart @@ -3905,11 +3905,12 @@ class TagsCompanion extends UpdateCompanion { } } -class $PersonsTable extends Persons with TableInfo<$PersonsTable, Person> { +class $FaceRecognitionPersonsTable extends FaceRecognitionPersons + with TableInfo<$FaceRecognitionPersonsTable, FaceRecognitionPerson> { @override final GeneratedDatabase attachedDatabase; final String? _alias; - $PersonsTable(this.attachedDatabase, [this._alias]); + $FaceRecognitionPersonsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _rowIdMeta = const VerificationMeta('rowId'); @override late final GeneratedColumn rowId = GeneratedColumn( @@ -3948,11 +3949,12 @@ class $PersonsTable extends Persons with TableInfo<$PersonsTable, Person> { List get $columns => [rowId, account, name, thumbFaceId, count]; @override - String get aliasedName => _alias ?? 'persons'; + String get aliasedName => _alias ?? 'face_recognition_persons'; @override - String get actualTableName => 'persons'; + String get actualTableName => 'face_recognition_persons'; @override - VerificationContext validateIntegrity(Insertable instance, + VerificationContext validateIntegrity( + Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); @@ -3996,9 +3998,9 @@ class $PersonsTable extends Persons with TableInfo<$PersonsTable, Person> { {account, name}, ]; @override - Person map(Map data, {String? tablePrefix}) { + FaceRecognitionPerson map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; - return Person( + return FaceRecognitionPerson( rowId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}row_id'])!, account: attachedDatabase.typeMapping @@ -4013,18 +4015,19 @@ class $PersonsTable extends Persons with TableInfo<$PersonsTable, Person> { } @override - $PersonsTable createAlias(String alias) { - return $PersonsTable(attachedDatabase, alias); + $FaceRecognitionPersonsTable createAlias(String alias) { + return $FaceRecognitionPersonsTable(attachedDatabase, alias); } } -class Person extends DataClass implements Insertable { +class FaceRecognitionPerson extends DataClass + implements Insertable { final int rowId; final int account; final String name; final int thumbFaceId; final int count; - const Person( + const FaceRecognitionPerson( {required this.rowId, required this.account, required this.name, @@ -4041,8 +4044,8 @@ class Person extends DataClass implements Insertable { return map; } - PersonsCompanion toCompanion(bool nullToAbsent) { - return PersonsCompanion( + FaceRecognitionPersonsCompanion toCompanion(bool nullToAbsent) { + return FaceRecognitionPersonsCompanion( rowId: Value(rowId), account: Value(account), name: Value(name), @@ -4051,10 +4054,10 @@ class Person extends DataClass implements Insertable { ); } - factory Person.fromJson(Map json, + factory FaceRecognitionPerson.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; - return Person( + return FaceRecognitionPerson( rowId: serializer.fromJson(json['rowId']), account: serializer.fromJson(json['account']), name: serializer.fromJson(json['name']), @@ -4074,13 +4077,13 @@ class Person extends DataClass implements Insertable { }; } - Person copyWith( + FaceRecognitionPerson copyWith( {int? rowId, int? account, String? name, int? thumbFaceId, int? count}) => - Person( + FaceRecognitionPerson( rowId: rowId ?? this.rowId, account: account ?? this.account, name: name ?? this.name, @@ -4089,7 +4092,7 @@ class Person extends DataClass implements Insertable { ); @override String toString() { - return (StringBuffer('Person(') + return (StringBuffer('FaceRecognitionPerson(') ..write('rowId: $rowId, ') ..write('account: $account, ') ..write('name: $name, ') @@ -4104,7 +4107,7 @@ class Person extends DataClass implements Insertable { @override bool operator ==(Object other) => identical(this, other) || - (other is Person && + (other is FaceRecognitionPerson && other.rowId == this.rowId && other.account == this.account && other.name == this.name && @@ -4112,20 +4115,21 @@ class Person extends DataClass implements Insertable { other.count == this.count); } -class PersonsCompanion extends UpdateCompanion { +class FaceRecognitionPersonsCompanion + extends UpdateCompanion { final Value rowId; final Value account; final Value name; final Value thumbFaceId; final Value count; - const PersonsCompanion({ + const FaceRecognitionPersonsCompanion({ this.rowId = const Value.absent(), this.account = const Value.absent(), this.name = const Value.absent(), this.thumbFaceId = const Value.absent(), this.count = const Value.absent(), }); - PersonsCompanion.insert({ + FaceRecognitionPersonsCompanion.insert({ this.rowId = const Value.absent(), required int account, required String name, @@ -4135,7 +4139,7 @@ class PersonsCompanion extends UpdateCompanion { name = Value(name), thumbFaceId = Value(thumbFaceId), count = Value(count); - static Insertable custom({ + static Insertable custom({ Expression? rowId, Expression? account, Expression? name, @@ -4151,13 +4155,13 @@ class PersonsCompanion extends UpdateCompanion { }); } - PersonsCompanion copyWith( + FaceRecognitionPersonsCompanion copyWith( {Value? rowId, Value? account, Value? name, Value? thumbFaceId, Value? count}) { - return PersonsCompanion( + return FaceRecognitionPersonsCompanion( rowId: rowId ?? this.rowId, account: account ?? this.account, name: name ?? this.name, @@ -4189,7 +4193,7 @@ class PersonsCompanion extends UpdateCompanion { @override String toString() { - return (StringBuffer('PersonsCompanion(') + return (StringBuffer('FaceRecognitionPersonsCompanion(') ..write('rowId: $rowId, ') ..write('account: $account, ') ..write('name: $name, ') @@ -5297,7 +5301,8 @@ abstract class _$SqliteDb extends GeneratedDatabase { late final $AlbumsTable albums = $AlbumsTable(this); late final $AlbumSharesTable albumShares = $AlbumSharesTable(this); late final $TagsTable tags = $TagsTable(this); - late final $PersonsTable persons = $PersonsTable(this); + late final $FaceRecognitionPersonsTable faceRecognitionPersons = + $FaceRecognitionPersonsTable(this); late final $NcAlbumsTable ncAlbums = $NcAlbumsTable(this); late final $NcAlbumItemsTable ncAlbumItems = $NcAlbumItemsTable(this); @override @@ -5316,7 +5321,7 @@ abstract class _$SqliteDb extends GeneratedDatabase { albums, albumShares, tags, - persons, + faceRecognitionPersons, ncAlbums, ncAlbumItems ]; @@ -5411,7 +5416,7 @@ abstract class _$SqliteDb extends GeneratedDatabase { on: TableUpdateQuery.onTableName('accounts', limitUpdateKind: UpdateKind.delete), result: [ - TableUpdate('persons', kind: UpdateKind.delete), + TableUpdate('face_recognition_persons', kind: UpdateKind.delete), ], ), WritePropagation( diff --git a/app/lib/entity/sqlite/database_extension.dart b/app/lib/entity/sqlite/database_extension.dart index 330487ef..f427e6bb 100644 --- a/app/lib/entity/sqlite/database_extension.dart +++ b/app/lib/entity/sqlite/database_extension.dart @@ -526,17 +526,18 @@ extension SqliteDbExtension on SqliteDb { } } - Future> allPersons({ + Future> allFaceRecognitionPersons({ required ByAccount account, }) { assert((account.sqlAccount != null) != (account.appAccount != null)); if (account.sqlAccount != null) { - final query = select(persons) + final query = select(faceRecognitionPersons) ..where((t) => t.account.equals(account.sqlAccount!.rowId)); return query.get(); } else { - final query = select(persons).join([ - innerJoin(accounts, accounts.rowId.equalsExp(persons.account), + final query = select(faceRecognitionPersons).join([ + innerJoin( + accounts, accounts.rowId.equalsExp(faceRecognitionPersons.account), useColumns: false), innerJoin(servers, servers.rowId.equalsExp(accounts.server), useColumns: false), @@ -544,18 +545,18 @@ extension SqliteDbExtension on SqliteDb { ..where(servers.address.equals(account.appAccount!.url)) ..where(accounts.userId .equals(account.appAccount!.userId.toCaseInsensitiveString())); - return query.map((r) => r.readTable(persons)).get(); + return query.map((r) => r.readTable(faceRecognitionPersons)).get(); } } - Future> personsByName({ + Future> faceRecognitionPersonsByName({ Account? sqlAccount, app.Account? appAccount, required String name, }) { assert((sqlAccount != null) != (appAccount != null)); if (sqlAccount != null) { - final query = select(persons) + final query = select(faceRecognitionPersons) ..where((t) => t.account.equals(sqlAccount.rowId)) ..where((t) => t.name.like(name) | @@ -563,8 +564,9 @@ extension SqliteDbExtension on SqliteDb { t.name.like("$name %")); return query.get(); } else { - final query = select(persons).join([ - innerJoin(accounts, accounts.rowId.equalsExp(persons.account), + final query = select(faceRecognitionPersons).join([ + innerJoin( + accounts, accounts.rowId.equalsExp(faceRecognitionPersons.account), useColumns: false), innerJoin(servers, servers.rowId.equalsExp(accounts.server), useColumns: false), @@ -572,10 +574,10 @@ extension SqliteDbExtension on SqliteDb { ..where(servers.address.equals(appAccount!.url)) ..where( accounts.userId.equals(appAccount.userId.toCaseInsensitiveString())) - ..where(persons.name.like(name) | - persons.name.like("% $name") | - persons.name.like("$name %")); - return query.map((r) => r.readTable(persons)).get(); + ..where(faceRecognitionPersons.name.like(name) | + faceRecognitionPersons.name.like("% $name") | + faceRecognitionPersons.name.like("$name %")); + return query.map((r) => r.readTable(faceRecognitionPersons)).get(); } } @@ -638,7 +640,7 @@ extension SqliteDbExtension on SqliteDb { await delete(albums).go(); await delete(albumShares).go(); await delete(tags).go(); - await delete(persons).go(); + await delete(faceRecognitionPersons).go(); await delete(ncAlbums).go(); await delete(ncAlbumItems).go(); diff --git a/app/lib/entity/sqlite/table.dart b/app/lib/entity/sqlite/table.dart index 8e8bb2b1..64518f8a 100644 --- a/app/lib/entity/sqlite/table.dart +++ b/app/lib/entity/sqlite/table.dart @@ -219,7 +219,7 @@ class Tags extends Table { ]; } -class Persons extends Table { +class FaceRecognitionPersons extends Table { IntColumn get rowId => integer().autoIncrement()(); IntColumn get account => integer().references(Accounts, #rowId, onDelete: KeyAction.cascade)(); diff --git a/app/lib/entity/sqlite/type_converter.dart b/app/lib/entity/sqlite/type_converter.dart index 2c225c12..f12c3a0e 100644 --- a/app/lib/entity/sqlite/type_converter.dart +++ b/app/lib/entity/sqlite/type_converter.dart @@ -35,19 +35,20 @@ extension AppTagListExtension on List { } } -extension SqlPersonListExtension on List { - Future> convertToAppPerson() { +extension SqlFaceRecognitionPersonListExtension + on List { + Future> convertToAppFaceRecognitionPerson() { return computeAll(SqliteFaceRecognitionPersonConverter.fromSql); } } -extension AppPersonListExtension on List { - Future> convertToPersonCompanion( - sql.Account? dbAccount) { +extension AppFaceRecognitionPersonListExtension on List { + Future> + convertToFaceRecognitionPersonCompanion(sql.Account? dbAccount) { return map((p) => { "account": dbAccount, "person": p, - }).computeAll(_convertAppPerson); + }).computeAll(_convertAppFaceRecognitionPerson); } } @@ -239,16 +240,16 @@ class SqliteTagConverter { } class SqliteFaceRecognitionPersonConverter { - static FaceRecognitionPerson fromSql(sql.Person person) => + static FaceRecognitionPerson fromSql(sql.FaceRecognitionPerson person) => FaceRecognitionPerson( name: person.name, thumbFaceId: person.thumbFaceId, count: person.count, ); - static sql.PersonsCompanion toSql( + static sql.FaceRecognitionPersonsCompanion toSql( sql.Account? dbAccount, FaceRecognitionPerson person) => - sql.PersonsCompanion( + sql.FaceRecognitionPersonsCompanion( account: dbAccount == null ? const Value.absent() : Value(dbAccount.rowId), name: Value(person.name), @@ -331,7 +332,7 @@ sql.TagsCompanion _convertAppTag(Map map) { return SqliteTagConverter.toSql(account, tag); } -sql.PersonsCompanion _convertAppPerson(Map map) { +sql.FaceRecognitionPersonsCompanion _convertAppFaceRecognitionPerson(Map map) { final account = map["account"] as sql.Account?; final person = map["person"] as FaceRecognitionPerson; return SqliteFaceRecognitionPersonConverter.toSql(account, person); diff --git a/app/lib/use_case/face_recognition_person/sync_face_recognition_person.dart b/app/lib/use_case/face_recognition_person/sync_face_recognition_person.dart index 63a39859..3226bcb8 100644 --- a/app/lib/use_case/face_recognition_person/sync_face_recognition_person.dart +++ b/app/lib/use_case/face_recognition_person/sync_face_recognition_person.dart @@ -56,26 +56,26 @@ class SyncFaceRecognitionPerson { await db.batch((batch) { for (final d in deletes) { batch.deleteWhere( - db.persons, - (sql.$PersonsTable p) => + db.faceRecognitionPersons, + (sql.$FaceRecognitionPersonsTable p) => p.account.equals(dbAccount.rowId) & p.name.equals(d.name), ); } for (final u in updates) { batch.update( - db.persons, - sql.PersonsCompanion( + db.faceRecognitionPersons, + sql.FaceRecognitionPersonsCompanion( name: sql.Value(u.name), thumbFaceId: sql.Value(u.thumbFaceId), count: sql.Value(u.count), ), - where: (sql.$PersonsTable p) => + where: (sql.$FaceRecognitionPersonsTable p) => p.account.equals(dbAccount.rowId) & p.name.equals(u.name), ); } for (final i in inserts) { batch.insert( - db.persons, + db.faceRecognitionPersons, SqliteFaceRecognitionPersonConverter.toSql(dbAccount, i), mode: sql.InsertMode.insertOrIgnore, ); diff --git a/app/test/entity/sqlite/database_test.dart b/app/test/entity/sqlite/database_test.dart index 2a7f476b..2e246e8e 100644 --- a/app/test/entity/sqlite/database_test.dart +++ b/app/test/entity/sqlite/database_test.dart @@ -319,7 +319,7 @@ Future _truncate() async { "albums", "album_shares", "tags", - "persons", + "face_recognition_persons", "nc_albums", "nc_album_items", }); diff --git a/app/test/use_case/face_recognition_person/sync_face_recognition_person_test.dart b/app/test/use_case/face_recognition_person/sync_face_recognition_person_test.dart index a4204973..e237ab2d 100644 --- a/app/test/use_case/face_recognition_person/sync_face_recognition_person_test.dart +++ b/app/test/use_case/face_recognition_person/sync_face_recognition_person_test.dart @@ -43,8 +43,8 @@ Future _new() async { await c.sqliteDb.insertAccountOf(account); await c.sqliteDb.batch((batch) { batch.insert( - c.sqliteDb.persons, - sql.PersonsCompanion.insert( + c.sqliteDb.faceRecognitionPersons, + sql.FaceRecognitionPersonsCompanion.insert( account: 1, name: "test1", thumbFaceId: 1, count: 1), ); }); @@ -83,12 +83,12 @@ Future _remove() async { await c.sqliteDb.transaction(() async { await c.sqliteDb.insertAccountOf(account); await c.sqliteDb.batch((batch) { - batch.insertAll(c.sqliteDb.persons, [ - sql.PersonsCompanion.insert( + batch.insertAll(c.sqliteDb.faceRecognitionPersons, [ + sql.FaceRecognitionPersonsCompanion.insert( account: 1, name: "test1", thumbFaceId: 1, count: 1), - sql.PersonsCompanion.insert( + sql.FaceRecognitionPersonsCompanion.insert( account: 1, name: "test2", thumbFaceId: 2, count: 10), - sql.PersonsCompanion.insert( + sql.FaceRecognitionPersonsCompanion.insert( account: 1, name: "test3", thumbFaceId: 3, count: 100), ]); }); @@ -127,10 +127,10 @@ Future _update() async { await c.sqliteDb.transaction(() async { await c.sqliteDb.insertAccountOf(account); await c.sqliteDb.batch((batch) { - batch.insertAll(c.sqliteDb.persons, [ - sql.PersonsCompanion.insert( + batch.insertAll(c.sqliteDb.faceRecognitionPersons, [ + sql.FaceRecognitionPersonsCompanion.insert( account: 1, name: "test1", thumbFaceId: 1, count: 1), - sql.PersonsCompanion.insert( + sql.FaceRecognitionPersonsCompanion.insert( account: 1, name: "test2", thumbFaceId: 2, count: 10), ]); }); @@ -150,11 +150,13 @@ Future _update() async { Future>> _listSqliteDbPersons( sql.SqliteDb db) async { - final query = db.select(db.persons).join([ - sql.innerJoin(db.accounts, db.accounts.rowId.equalsExp(db.persons.account)), + final query = db.select(db.faceRecognitionPersons).join([ + sql.innerJoin(db.accounts, + db.accounts.rowId.equalsExp(db.faceRecognitionPersons.account)), ]); final result = await query - .map((r) => Tuple2(r.readTable(db.accounts), r.readTable(db.persons))) + .map((r) => Tuple2( + r.readTable(db.accounts), r.readTable(db.faceRecognitionPersons))) .get(); final product = >{}; for (final r in result) {