add Databse.connect to be able to run in isaltes

This commit is contained in:
Sorunome 2020-07-17 13:20:23 +02:00
parent 26510173de
commit 175cb0fbd2
No known key found for this signature in database
GPG key ID: B19471D07FC9BE9C
3 changed files with 9 additions and 17 deletions

6
build.yaml Normal file
View file

@ -0,0 +1,6 @@
targets:
$default:
builders:
moor_generator:
options:
generate_connect_constructor: true

View file

@ -15,6 +15,8 @@ part 'database.g.dart';
class Database extends _$Database { class Database extends _$Database {
Database(QueryExecutor e) : super(e); Database(QueryExecutor e) : super(e);
Database.connect(DatabaseConnection connection) : super.connect(connection);
@override @override
int get schemaVersion => 5; int get schemaVersion => 5;

View file

@ -5361,6 +5361,7 @@ class Files extends Table with TableInfo<Files, DbFile> {
abstract class _$Database extends GeneratedDatabase { abstract class _$Database extends GeneratedDatabase {
_$Database(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e); _$Database(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
_$Database.connect(DatabaseConnection c) : super.connect(c);
Clients _clients; Clients _clients;
Clients get clients => _clients ??= Clients(this); Clients get clients => _clients ??= Clients(this);
UserDeviceKeys _userDeviceKeys; UserDeviceKeys _userDeviceKeys;
@ -6196,23 +6197,6 @@ abstract class _$Database extends GeneratedDatabase {
}).map(_rowToDbRoomState); }).map(_rowToDbRoomState);
} }
Selectable<DbRoomState> dbGetUsers(
int client_id, List<String> mxids, String room_id) {
var $arrayStartIndex = 2;
final expandedmxids = $expandVar($arrayStartIndex, mxids.length);
$arrayStartIndex += mxids.length;
return customSelect(
'SELECT * FROM room_states WHERE client_id = :client_id AND type = \'m.room.member\' AND state_key IN ($expandedmxids) AND room_id = :room_id',
variables: [
Variable.withInt(client_id),
for (var $ in mxids) Variable.withString($),
Variable.withString(room_id)
],
readsFrom: {
roomStates
}).map(_rowToDbRoomState);
}
DbEvent _rowToDbEvent(QueryRow row) { DbEvent _rowToDbEvent(QueryRow row) {
return DbEvent( return DbEvent(
clientId: row.readInt('client_id'), clientId: row.readInt('client_id'),