From 7390238a099b48ba8fc37fa4a01acf33232ae4bb Mon Sep 17 00:00:00 2001 From: Frederik St-Onge Date: Thu, 19 Dec 2024 18:34:09 -0500 Subject: [PATCH 1/7] Add drift --- lib/bootstrapper.dart | 10 +- lib/models/improvisation_model.dart | 6 + lib/models/match_model.dart | 2 +- lib/models/match_model.g.dart | 308 +- lib/models/match_team_model.dart | 6 + lib/models/penalty_model.dart | 6 + lib/models/performer_model.dart | 6 + lib/models/point_model.dart | 6 + lib/models/star_model.dart | 6 + lib/repositories/database_repository.dart | 104 +- lib/repositories/database_repository.g.dart | 3224 +++++++++++++++++ .../legacy_database_repository.dart | 27 + lib/repositories/matches_repository.dart | 4 +- lib/repositories/pacings_repository.dart | 4 +- lib/repositories/teams_repository.dart | 4 +- pubspec.lock | 88 +- pubspec.yaml | 5 +- 17 files changed, 3626 insertions(+), 190 deletions(-) create mode 100644 lib/repositories/database_repository.g.dart create mode 100644 lib/repositories/legacy_database_repository.dart diff --git a/lib/bootstrapper.dart b/lib/bootstrapper.dart index 3a69df43..5e605945 100644 --- a/lib/bootstrapper.dart +++ b/lib/bootstrapper.dart @@ -11,7 +11,7 @@ import 'cubits/pacings/pacings_cubit.dart'; import 'cubits/settings/settings_cubit.dart'; import 'cubits/teams/teams_cubit.dart'; import 'cubits/timer/timer_cubit.dart'; -import 'repositories/database_repository.dart'; +import 'repositories/legacy_database_repository.dart'; import 'repositories/matches_repository.dart'; import 'repositories/pacings_repository.dart'; import 'repositories/teams_repository.dart'; @@ -66,27 +66,27 @@ class Bootstrapper extends StatelessWidget { ), RepositoryProvider( create: (repositoryContext) => _createOrGetOverride( - () => DatabaseRepository(), + () => LegacyDatabaseRepository(), ), ), RepositoryProvider( create: (repositoryContext) => _createOrGetOverride( () => PacingsRepository( - databaseRepository: repositoryContext.read(), + databaseRepository: repositoryContext.read(), ), ), ), RepositoryProvider( create: (repositoryContext) => _createOrGetOverride( () => MatchesRepository( - databaseRepository: repositoryContext.read(), + databaseRepository: repositoryContext.read(), ), ), ), RepositoryProvider( create: (repositoryContext) => _createOrGetOverride( () => TeamsRepository( - databaseRepository: repositoryContext.read(), + databaseRepository: repositoryContext.read(), ), ), ), diff --git a/lib/models/improvisation_model.dart b/lib/models/improvisation_model.dart index f5a20f99..113adec0 100644 --- a/lib/models/improvisation_model.dart +++ b/lib/models/improvisation_model.dart @@ -1,4 +1,5 @@ import 'package:dart_mappable/dart_mappable.dart'; +import 'package:drift/drift.dart'; import 'package:isar/isar.dart'; import 'improvisation_type.dart'; @@ -34,4 +35,9 @@ class ImprovisationModel with ImprovisationModelMappable { this.integrationEntityId, this.integrationAdditionalData, }); + + static JsonTypeConverter converter = TypeConverter.json( + fromJson: (json) => ImprovisationModelMapper.fromMap(json as Map), + toJson: (pref) => pref.toMap(), + ); } diff --git a/lib/models/match_model.dart b/lib/models/match_model.dart index 635b2042..56216ac4 100644 --- a/lib/models/match_model.dart +++ b/lib/models/match_model.dart @@ -25,11 +25,11 @@ class MatchModel with MatchModelMappable { final DateTime? createdDate; @index final DateTime? modifiedDate; + final List tags; final List teams; final List improvisations; final List penalties; final List points; - final List tags; final List stars; final bool enableStatistics; final bool enablePenaltiesImpactPoints; diff --git a/lib/models/match_model.g.dart b/lib/models/match_model.g.dart index acd13acf..2a189fc2 100644 --- a/lib/models/match_model.g.dart +++ b/lib/models/match_model.g.dart @@ -32,6 +32,10 @@ const MatchModelSchema = IsarGeneratedSchema( name: 'modifiedDate', type: IsarType.dateTime, ), + IsarPropertySchema( + name: 'tags', + type: IsarType.stringList, + ), IsarPropertySchema( name: 'teams', type: IsarType.objectList, @@ -52,10 +56,6 @@ const MatchModelSchema = IsarGeneratedSchema( type: IsarType.objectList, target: 'PointModel', ), - IsarPropertySchema( - name: 'tags', - type: IsarType.stringList, - ), IsarPropertySchema( name: 'stars', type: IsarType.objectList, @@ -175,8 +175,16 @@ int serializeMatchModel(IsarWriter writer, MatchModel object) { object.modifiedDate?.toUtc().microsecondsSinceEpoch ?? -9223372036854775808); { - final list = object.teams; + final list = object.tags; final listWriter = IsarCore.beginList(writer, 4, list.length); + for (var i = 0; i < list.length; i++) { + IsarCore.writeString(listWriter, i, list[i]); + } + IsarCore.endList(writer, listWriter); + } + { + final list = object.teams; + final listWriter = IsarCore.beginList(writer, 5, list.length); for (var i = 0; i < list.length; i++) { { final value = list[i]; @@ -189,7 +197,7 @@ int serializeMatchModel(IsarWriter writer, MatchModel object) { } { final list = object.improvisations; - final listWriter = IsarCore.beginList(writer, 5, list.length); + final listWriter = IsarCore.beginList(writer, 6, list.length); for (var i = 0; i < list.length; i++) { { final value = list[i]; @@ -202,7 +210,7 @@ int serializeMatchModel(IsarWriter writer, MatchModel object) { } { final list = object.penalties; - final listWriter = IsarCore.beginList(writer, 6, list.length); + final listWriter = IsarCore.beginList(writer, 7, list.length); for (var i = 0; i < list.length; i++) { { final value = list[i]; @@ -215,7 +223,7 @@ int serializeMatchModel(IsarWriter writer, MatchModel object) { } { final list = object.points; - final listWriter = IsarCore.beginList(writer, 7, list.length); + final listWriter = IsarCore.beginList(writer, 8, list.length); for (var i = 0; i < list.length; i++) { { final value = list[i]; @@ -226,14 +234,6 @@ int serializeMatchModel(IsarWriter writer, MatchModel object) { } IsarCore.endList(writer, listWriter); } - { - final list = object.tags; - final listWriter = IsarCore.beginList(writer, 8, list.length); - for (var i = 0; i < list.length; i++) { - IsarCore.writeString(listWriter, i, list[i]); - } - IsarCore.endList(writer, listWriter); - } { final list = object.stars; final listWriter = IsarCore.beginList(writer, 9, list.length); @@ -335,9 +335,26 @@ MatchModel deserializeMatchModel(IsarReader reader) { DateTime.fromMicrosecondsSinceEpoch(value, isUtc: true).toLocal(); } } - final List _teams; + final List _tags; { final length = IsarCore.readList(reader, 4, IsarCore.readerPtrPtr); + { + final reader = IsarCore.readerPtr; + if (reader.isNull) { + _tags = const []; + } else { + final list = List.filled(length, '', growable: true); + for (var i = 0; i < length; i++) { + list[i] = IsarCore.readString(reader, i) ?? ''; + } + IsarCore.freeReader(reader); + _tags = list; + } + } + } + final List _teams; + { + final length = IsarCore.readList(reader, 5, IsarCore.readerPtrPtr); { final reader = IsarCore.readerPtr; if (reader.isNull) { @@ -374,7 +391,7 @@ MatchModel deserializeMatchModel(IsarReader reader) { } final List _improvisations; { - final length = IsarCore.readList(reader, 5, IsarCore.readerPtrPtr); + final length = IsarCore.readList(reader, 6, IsarCore.readerPtrPtr); { final reader = IsarCore.readerPtr; if (reader.isNull) { @@ -419,7 +436,7 @@ MatchModel deserializeMatchModel(IsarReader reader) { } final List _penalties; { - final length = IsarCore.readList(reader, 6, IsarCore.readerPtrPtr); + final length = IsarCore.readList(reader, 7, IsarCore.readerPtrPtr); { final reader = IsarCore.readerPtr; if (reader.isNull) { @@ -462,7 +479,7 @@ MatchModel deserializeMatchModel(IsarReader reader) { } final List _points; { - final length = IsarCore.readList(reader, 7, IsarCore.readerPtrPtr); + final length = IsarCore.readList(reader, 8, IsarCore.readerPtrPtr); { final reader = IsarCore.readerPtr; if (reader.isNull) { @@ -499,23 +516,6 @@ MatchModel deserializeMatchModel(IsarReader reader) { } } } - final List _tags; - { - final length = IsarCore.readList(reader, 8, IsarCore.readerPtrPtr); - { - final reader = IsarCore.readerPtr; - if (reader.isNull) { - _tags = const []; - } else { - final list = List.filled(length, '', growable: true); - for (var i = 0; i < length; i++) { - list[i] = IsarCore.readString(reader, i) ?? ''; - } - IsarCore.freeReader(reader); - _tags = list; - } - } - } final List _stars; { final length = IsarCore.readList(reader, 9, IsarCore.readerPtrPtr); @@ -660,11 +660,11 @@ MatchModel deserializeMatchModel(IsarReader reader) { name: _name, createdDate: _createdDate, modifiedDate: _modifiedDate, + tags: _tags, teams: _teams, improvisations: _improvisations, penalties: _penalties, points: _points, - tags: _tags, stars: _stars, enableStatistics: _enableStatistics, enablePenaltiesImpactPoints: _enablePenaltiesImpactPoints, @@ -714,6 +714,23 @@ dynamic deserializeMatchModelProp(IsarReader reader, int property) { case 4: { final length = IsarCore.readList(reader, 4, IsarCore.readerPtrPtr); + { + final reader = IsarCore.readerPtr; + if (reader.isNull) { + return const []; + } else { + final list = List.filled(length, '', growable: true); + for (var i = 0; i < length; i++) { + list[i] = IsarCore.readString(reader, i) ?? ''; + } + IsarCore.freeReader(reader); + return list; + } + } + } + case 5: + { + final length = IsarCore.readList(reader, 5, IsarCore.readerPtrPtr); { final reader = IsarCore.readerPtr; if (reader.isNull) { @@ -748,9 +765,9 @@ dynamic deserializeMatchModelProp(IsarReader reader, int property) { } } } - case 5: + case 6: { - final length = IsarCore.readList(reader, 5, IsarCore.readerPtrPtr); + final length = IsarCore.readList(reader, 6, IsarCore.readerPtrPtr); { final reader = IsarCore.readerPtr; if (reader.isNull) { @@ -793,9 +810,9 @@ dynamic deserializeMatchModelProp(IsarReader reader, int property) { } } } - case 6: + case 7: { - final length = IsarCore.readList(reader, 6, IsarCore.readerPtrPtr); + final length = IsarCore.readList(reader, 7, IsarCore.readerPtrPtr); { final reader = IsarCore.readerPtr; if (reader.isNull) { @@ -836,9 +853,9 @@ dynamic deserializeMatchModelProp(IsarReader reader, int property) { } } } - case 7: + case 8: { - final length = IsarCore.readList(reader, 7, IsarCore.readerPtrPtr); + final length = IsarCore.readList(reader, 8, IsarCore.readerPtrPtr); { final reader = IsarCore.readerPtr; if (reader.isNull) { @@ -875,23 +892,6 @@ dynamic deserializeMatchModelProp(IsarReader reader, int property) { } } } - case 8: - { - final length = IsarCore.readList(reader, 8, IsarCore.readerPtrPtr); - { - final reader = IsarCore.readerPtr; - if (reader.isNull) { - return const []; - } else { - final list = List.filled(length, '', growable: true); - for (var i = 0; i < length; i++) { - list[i] = IsarCore.readString(reader, i) ?? ''; - } - IsarCore.freeReader(reader); - return list; - } - } - } case 9: { final length = IsarCore.readList(reader, 9, IsarCore.readerPtrPtr); @@ -1816,60 +1816,6 @@ extension MatchModelQueryFilter }); } - QueryBuilder teamsIsEmpty() { - return not().teamsIsNotEmpty(); - } - - QueryBuilder - teamsIsNotEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - const GreaterOrEqualCondition(property: 4, value: null), - ); - }); - } - - QueryBuilder - improvisationsIsEmpty() { - return not().improvisationsIsNotEmpty(); - } - - QueryBuilder - improvisationsIsNotEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - const GreaterOrEqualCondition(property: 5, value: null), - ); - }); - } - - QueryBuilder - penaltiesIsEmpty() { - return not().penaltiesIsNotEmpty(); - } - - QueryBuilder - penaltiesIsNotEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - const GreaterOrEqualCondition(property: 6, value: null), - ); - }); - } - - QueryBuilder pointsIsEmpty() { - return not().pointsIsNotEmpty(); - } - - QueryBuilder - pointsIsNotEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - const GreaterOrEqualCondition(property: 7, value: null), - ); - }); - } - QueryBuilder tagsElementEqualTo( String value, { @@ -1878,7 +1824,7 @@ extension MatchModelQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition( EqualCondition( - property: 8, + property: 4, value: value, caseSensitive: caseSensitive, ), @@ -1894,7 +1840,7 @@ extension MatchModelQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition( GreaterCondition( - property: 8, + property: 4, value: value, caseSensitive: caseSensitive, ), @@ -1910,7 +1856,7 @@ extension MatchModelQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition( GreaterOrEqualCondition( - property: 8, + property: 4, value: value, caseSensitive: caseSensitive, ), @@ -1926,7 +1872,7 @@ extension MatchModelQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition( LessCondition( - property: 8, + property: 4, value: value, caseSensitive: caseSensitive, ), @@ -1942,7 +1888,7 @@ extension MatchModelQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition( LessOrEqualCondition( - property: 8, + property: 4, value: value, caseSensitive: caseSensitive, ), @@ -1959,7 +1905,7 @@ extension MatchModelQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition( BetweenCondition( - property: 8, + property: 4, lower: lower, upper: upper, caseSensitive: caseSensitive, @@ -1976,7 +1922,7 @@ extension MatchModelQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition( StartsWithCondition( - property: 8, + property: 4, value: value, caseSensitive: caseSensitive, ), @@ -1992,7 +1938,7 @@ extension MatchModelQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition( EndsWithCondition( - property: 8, + property: 4, value: value, caseSensitive: caseSensitive, ), @@ -2005,7 +1951,7 @@ extension MatchModelQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition( ContainsCondition( - property: 8, + property: 4, value: value, caseSensitive: caseSensitive, ), @@ -2018,7 +1964,7 @@ extension MatchModelQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition( MatchesCondition( - property: 8, + property: 4, wildcard: pattern, caseSensitive: caseSensitive, ), @@ -2031,7 +1977,7 @@ extension MatchModelQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition( const EqualCondition( - property: 8, + property: 4, value: '', ), ); @@ -2043,7 +1989,7 @@ extension MatchModelQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition( const GreaterCondition( - property: 8, + property: 4, value: '', ), ); @@ -2055,6 +2001,60 @@ extension MatchModelQueryFilter } QueryBuilder tagsIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + const GreaterOrEqualCondition(property: 4, value: null), + ); + }); + } + + QueryBuilder teamsIsEmpty() { + return not().teamsIsNotEmpty(); + } + + QueryBuilder + teamsIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + const GreaterOrEqualCondition(property: 5, value: null), + ); + }); + } + + QueryBuilder + improvisationsIsEmpty() { + return not().improvisationsIsNotEmpty(); + } + + QueryBuilder + improvisationsIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + const GreaterOrEqualCondition(property: 6, value: null), + ); + }); + } + + QueryBuilder + penaltiesIsEmpty() { + return not().penaltiesIsNotEmpty(); + } + + QueryBuilder + penaltiesIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + const GreaterOrEqualCondition(property: 7, value: null), + ); + }); + } + + QueryBuilder pointsIsEmpty() { + return not().pointsIsNotEmpty(); + } + + QueryBuilder + pointsIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( const GreaterOrEqualCondition(property: 8, value: null), @@ -4164,7 +4164,7 @@ extension MatchModelQueryWhereDistinct QueryBuilder distinctByTags() { return QueryBuilder.apply(this, (query) { - return query.addDistinctBy(8); + return query.addDistinctBy(4); }); } @@ -4292,34 +4292,34 @@ extension MatchModelQueryProperty1 }); } - QueryBuilder, QAfterProperty> - teamsProperty() { + QueryBuilder, QAfterProperty> tagsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(4); }); } - QueryBuilder, QAfterProperty> - improvisationsProperty() { + QueryBuilder, QAfterProperty> + teamsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(5); }); } - QueryBuilder, QAfterProperty> - penaltiesProperty() { + QueryBuilder, QAfterProperty> + improvisationsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(6); }); } - QueryBuilder, QAfterProperty> pointsProperty() { + QueryBuilder, QAfterProperty> + penaltiesProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(7); }); } - QueryBuilder, QAfterProperty> tagsProperty() { + QueryBuilder, QAfterProperty> pointsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(8); }); @@ -4455,35 +4455,35 @@ extension MatchModelQueryProperty2 }); } - QueryBuilder), QAfterProperty> - teamsProperty() { + QueryBuilder), QAfterProperty> tagsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(4); }); } - QueryBuilder), QAfterProperty> - improvisationsProperty() { + QueryBuilder), QAfterProperty> + teamsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(5); }); } - QueryBuilder), QAfterProperty> - penaltiesProperty() { + QueryBuilder), QAfterProperty> + improvisationsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(6); }); } - QueryBuilder), QAfterProperty> - pointsProperty() { + QueryBuilder), QAfterProperty> + penaltiesProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(7); }); } - QueryBuilder), QAfterProperty> tagsProperty() { + QueryBuilder), QAfterProperty> + pointsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(8); }); @@ -4623,35 +4623,35 @@ extension MatchModelQueryProperty3 }); } - QueryBuilder), QOperations> - teamsProperty() { + QueryBuilder), QOperations> tagsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(4); }); } - QueryBuilder), QOperations> - improvisationsProperty() { + QueryBuilder), QOperations> + teamsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(5); }); } - QueryBuilder), QOperations> - penaltiesProperty() { + QueryBuilder), QOperations> + improvisationsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(6); }); } - QueryBuilder), QOperations> - pointsProperty() { + QueryBuilder), QOperations> + penaltiesProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(7); }); } - QueryBuilder), QOperations> tagsProperty() { + QueryBuilder), QOperations> + pointsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(8); }); diff --git a/lib/models/match_team_model.dart b/lib/models/match_team_model.dart index 6d61ef34..9330a5da 100644 --- a/lib/models/match_team_model.dart +++ b/lib/models/match_team_model.dart @@ -1,4 +1,5 @@ import 'package:dart_mappable/dart_mappable.dart'; +import 'package:drift/drift.dart'; import 'package:isar/isar.dart'; import 'performer_model.dart'; @@ -24,4 +25,9 @@ class MatchTeamModel with MatchTeamModelMappable { this.integrationEntityId, this.integrationAdditionalData, }); + + static JsonTypeConverter converter = TypeConverter.json( + fromJson: (json) => MatchTeamModelMapper.fromMap(json as Map), + toJson: (pref) => pref.toMap(), + ); } diff --git a/lib/models/penalty_model.dart b/lib/models/penalty_model.dart index 696494c9..9beeb1bc 100644 --- a/lib/models/penalty_model.dart +++ b/lib/models/penalty_model.dart @@ -1,4 +1,5 @@ import 'package:dart_mappable/dart_mappable.dart'; +import 'package:drift/drift.dart'; import 'package:isar/isar.dart'; part 'penalty_model.mapper.dart'; @@ -22,4 +23,9 @@ class PenaltyModel with PenaltyModelMappable { required this.teamId, required this.improvisationId, }); + + static JsonTypeConverter converter = TypeConverter.json( + fromJson: (json) => PenaltyModelMapper.fromMap(json as Map), + toJson: (pref) => pref.toMap(), + ); } diff --git a/lib/models/performer_model.dart b/lib/models/performer_model.dart index 80b0b5b9..39cf8d83 100644 --- a/lib/models/performer_model.dart +++ b/lib/models/performer_model.dart @@ -1,4 +1,5 @@ import 'package:dart_mappable/dart_mappable.dart'; +import 'package:drift/drift.dart'; import 'package:isar/isar.dart'; part 'performer_model.mapper.dart'; @@ -18,4 +19,9 @@ class PerformerModel with PerformerModelMappable { this.integrationEntityId, this.integrationAdditionalData, }); + + static JsonTypeConverter converter = TypeConverter.json( + fromJson: (json) => PerformerModelMapper.fromMap(json as Map), + toJson: (pref) => pref.toMap(), + ); } diff --git a/lib/models/point_model.dart b/lib/models/point_model.dart index 7545db67..de3000ee 100644 --- a/lib/models/point_model.dart +++ b/lib/models/point_model.dart @@ -1,4 +1,5 @@ import 'package:dart_mappable/dart_mappable.dart'; +import 'package:drift/drift.dart'; import 'package:isar/isar.dart'; part 'point_model.mapper.dart'; @@ -18,4 +19,9 @@ class PointModel with PointModelMappable { required this.improvisationId, required this.value, }); + + static JsonTypeConverter converter = TypeConverter.json( + fromJson: (json) => PointModelMapper.fromMap(json as Map), + toJson: (pref) => pref.toMap(), + ); } diff --git a/lib/models/star_model.dart b/lib/models/star_model.dart index 505ffc2c..2bd8405c 100644 --- a/lib/models/star_model.dart +++ b/lib/models/star_model.dart @@ -1,4 +1,5 @@ import 'package:dart_mappable/dart_mappable.dart'; +import 'package:drift/drift.dart'; import 'package:isar/isar.dart'; part 'star_model.mapper.dart'; @@ -16,4 +17,9 @@ class StarModel with StarModelMappable { required this.performerId, required this.teamId, }); + + static JsonTypeConverter converter = TypeConverter.json( + fromJson: (json) => StarModelMapper.fromMap(json as Map), + toJson: (pref) => pref.toMap(), + ); } diff --git a/lib/repositories/database_repository.dart b/lib/repositories/database_repository.dart index c33d28a5..3d1666b9 100644 --- a/lib/repositories/database_repository.dart +++ b/lib/repositories/database_repository.dart @@ -1,27 +1,93 @@ -import 'package:isar/isar.dart'; -import 'package:path_provider/path_provider.dart'; +import 'package:drift/drift.dart'; +import 'package:drift_flutter/drift_flutter.dart'; -import '../models/match_model.dart'; -import '../models/pacing_model.dart'; -import '../models/team_model.dart'; +import '../models/improvisation_model.dart'; +import '../models/match_team_model.dart'; +import '../models/penalties_impact_type.dart'; +import '../models/performer_model.dart'; -class DatabaseRepository { - Isar? _database; +part 'database_repository.g.dart'; - Future get database async { - if (_database != null) { - return _database!; - } +class TagsConverter extends TypeConverter, String> with JsonTypeConverter, String> { + static const separator = ','; + const TagsConverter(); - _database = await _getDatabase(); - return _database!; + @override + List fromSql(String fromDb) { + return fromDb.split(separator); } - Future _getDatabase() async { - final dir = await getApplicationDocumentsDirectory(); - return await Isar.openAsync( - schemas: [PacingModelSchema, MatchModelSchema, TeamModelSchema], - directory: dir.path, - ); + @override + String toSql(List value) { + return value.join(separator); + } +} + +class PacingEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + TextColumn get name => text()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + TextColumn get tags => text().map(const TagsConverter())(); + TextColumn get improvisations => text().map(ImprovisationModel.converter)(); + IntColumn get defaultNumberOfTeams => integer().withDefault(const Constant(2))(); + + TextColumn get integrationId => text().nullable()(); + TextColumn get integrationEntityId => text().nullable()(); + TextColumn get integrationAdditionalData => text().nullable()(); +} + +class MatchEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + TextColumn get name => text()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + TextColumn get tags => text().map(const TagsConverter())(); + TextColumn get teams => text().map(MatchTeamModel.converter)(); + TextColumn get improvisations => text().map(MatchTeamModel.converter)(); + TextColumn get penalties => text().map(MatchTeamModel.converter)(); + TextColumn get points => text().map(MatchTeamModel.converter)(); + TextColumn get stars => text().map(MatchTeamModel.converter)(); + BoolColumn get enableStatistics => boolean().withDefault(const Constant(true))(); + BoolColumn get enablePenaltiesImpactPoints => boolean().withDefault(const Constant(true))(); + IntColumn get penaltiesImpactType => intEnum().withDefault(Constant(PenaltiesImpactType.addPoints.index))(); + IntColumn get penaltiesRequiredToImpactPoints => integer().withDefault(const Constant(3))(); + BoolColumn get enableMatchExpulsion => boolean().withDefault(const Constant(true))(); + IntColumn get penaltiesRequiredToExpel => integer().withDefault(const Constant(3))(); + TextColumn get integrationId => text().nullable()(); + TextColumn get integrationEntityId => text().nullable()(); + TextColumn get integrationAdditionalData => text().nullable()(); + IntColumn get integrationRestrictMaximumPointPerImprovisation => integer().nullable()(); + IntColumn get integrationMinNumberOfImprovisations => integer().nullable()(); + IntColumn get integrationMaxNumberOfImprovisations => integer().nullable()(); + TextColumn get integrationPenaltyTypes => text().map(const TagsConverter()).nullable()(); +} + +class TeamEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + TextColumn get name => text()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + IntColumn get color => integer()(); + TextColumn get performers => text().map(PerformerModel.converter)(); + TextColumn get tags => text().map(const TagsConverter())(); +} + +@DriftDatabase(tables: [PacingEntity, MatchEntity, TeamEntity]) +class AppDatabase extends _$AppDatabase { + AppDatabase() : super(_openConnection()); + + @override + int get schemaVersion => 1; + + @override + MigrationStrategy get migration => MigrationStrategy( + beforeOpen: (details) async { + await customStatement('PRAGMA foreign_keys = ON'); + }, + ); + + static QueryExecutor _openConnection() { + return driftDatabase(name: 'my_database'); } } diff --git a/lib/repositories/database_repository.g.dart b/lib/repositories/database_repository.g.dart new file mode 100644 index 00000000..1376d756 --- /dev/null +++ b/lib/repositories/database_repository.g.dart @@ -0,0 +1,3224 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'database_repository.dart'; + +// ignore_for_file: type=lint +class $PacingEntityTable extends PacingEntity + with TableInfo<$PacingEntityTable, PacingEntityData> { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + $PacingEntityTable(this.attachedDatabase, [this._alias]); + static const VerificationMeta _idMeta = const VerificationMeta('id'); + @override + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + static const VerificationMeta _nameMeta = const VerificationMeta('name'); + @override + late final GeneratedColumn name = GeneratedColumn( + 'name', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + static const VerificationMeta _createdDateMeta = + const VerificationMeta('createdDate'); + @override + late final GeneratedColumn createdDate = GeneratedColumn( + 'created_date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + static const VerificationMeta _modifiedDateMeta = + const VerificationMeta('modifiedDate'); + @override + late final GeneratedColumn modifiedDate = GeneratedColumn( + 'modified_date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + static const VerificationMeta _tagsMeta = const VerificationMeta('tags'); + @override + late final GeneratedColumnWithTypeConverter, String> tags = + GeneratedColumn('tags', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true) + .withConverter>($PacingEntityTable.$convertertags); + static const VerificationMeta _improvisationsMeta = + const VerificationMeta('improvisations'); + @override + late final GeneratedColumnWithTypeConverter + improvisations = GeneratedColumn( + 'improvisations', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true) + .withConverter( + $PacingEntityTable.$converterimprovisations); + static const VerificationMeta _defaultNumberOfTeamsMeta = + const VerificationMeta('defaultNumberOfTeams'); + @override + late final GeneratedColumn defaultNumberOfTeams = GeneratedColumn( + 'default_number_of_teams', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(2)); + static const VerificationMeta _integrationIdMeta = + const VerificationMeta('integrationId'); + @override + late final GeneratedColumn integrationId = GeneratedColumn( + 'integration_id', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + static const VerificationMeta _integrationEntityIdMeta = + const VerificationMeta('integrationEntityId'); + @override + late final GeneratedColumn integrationEntityId = + GeneratedColumn('integration_entity_id', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + static const VerificationMeta _integrationAdditionalDataMeta = + const VerificationMeta('integrationAdditionalData'); + @override + late final GeneratedColumn integrationAdditionalData = + GeneratedColumn('integration_additional_data', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + @override + List get $columns => [ + id, + name, + createdDate, + modifiedDate, + tags, + improvisations, + defaultNumberOfTeams, + integrationId, + integrationEntityId, + integrationAdditionalData + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'pacing_entity'; + @override + VerificationContext validateIntegrity(Insertable instance, + {bool isInserting = false}) { + final context = VerificationContext(); + final data = instance.toColumns(true); + if (data.containsKey('id')) { + context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); + } + if (data.containsKey('name')) { + context.handle( + _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); + } else if (isInserting) { + context.missing(_nameMeta); + } + if (data.containsKey('created_date')) { + context.handle( + _createdDateMeta, + createdDate.isAcceptableOrUnknown( + data['created_date']!, _createdDateMeta)); + } + if (data.containsKey('modified_date')) { + context.handle( + _modifiedDateMeta, + modifiedDate.isAcceptableOrUnknown( + data['modified_date']!, _modifiedDateMeta)); + } + context.handle(_tagsMeta, const VerificationResult.success()); + context.handle(_improvisationsMeta, const VerificationResult.success()); + if (data.containsKey('default_number_of_teams')) { + context.handle( + _defaultNumberOfTeamsMeta, + defaultNumberOfTeams.isAcceptableOrUnknown( + data['default_number_of_teams']!, _defaultNumberOfTeamsMeta)); + } + if (data.containsKey('integration_id')) { + context.handle( + _integrationIdMeta, + integrationId.isAcceptableOrUnknown( + data['integration_id']!, _integrationIdMeta)); + } + if (data.containsKey('integration_entity_id')) { + context.handle( + _integrationEntityIdMeta, + integrationEntityId.isAcceptableOrUnknown( + data['integration_entity_id']!, _integrationEntityIdMeta)); + } + if (data.containsKey('integration_additional_data')) { + context.handle( + _integrationAdditionalDataMeta, + integrationAdditionalData.isAcceptableOrUnknown( + data['integration_additional_data']!, + _integrationAdditionalDataMeta)); + } + return context; + } + + @override + Set get $primaryKey => {id}; + @override + PacingEntityData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return PacingEntityData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + name: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}name'])!, + createdDate: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_date']), + modifiedDate: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}modified_date']), + tags: $PacingEntityTable.$convertertags.fromSql(attachedDatabase + .typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tags'])!), + improvisations: $PacingEntityTable.$converterimprovisations.fromSql( + attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}improvisations'])!), + defaultNumberOfTeams: attachedDatabase.typeMapping.read( + DriftSqlType.int, data['${effectivePrefix}default_number_of_teams'])!, + integrationId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}integration_id']), + integrationEntityId: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}integration_entity_id']), + integrationAdditionalData: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}integration_additional_data']), + ); + } + + @override + $PacingEntityTable createAlias(String alias) { + return $PacingEntityTable(attachedDatabase, alias); + } + + static JsonTypeConverter2, String, String> $convertertags = + const TagsConverter(); + static JsonTypeConverter2 + $converterimprovisations = ImprovisationModel.converter; +} + +class PacingEntityData extends DataClass + implements Insertable { + final int id; + final String name; + final DateTime? createdDate; + final DateTime? modifiedDate; + final List tags; + final ImprovisationModel improvisations; + final int defaultNumberOfTeams; + final String? integrationId; + final String? integrationEntityId; + final String? integrationAdditionalData; + const PacingEntityData( + {required this.id, + required this.name, + this.createdDate, + this.modifiedDate, + required this.tags, + required this.improvisations, + required this.defaultNumberOfTeams, + this.integrationId, + this.integrationEntityId, + this.integrationAdditionalData}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['name'] = Variable(name); + if (!nullToAbsent || createdDate != null) { + map['created_date'] = Variable(createdDate); + } + if (!nullToAbsent || modifiedDate != null) { + map['modified_date'] = Variable(modifiedDate); + } + { + map['tags'] = + Variable($PacingEntityTable.$convertertags.toSql(tags)); + } + { + map['improvisations'] = Variable( + $PacingEntityTable.$converterimprovisations.toSql(improvisations)); + } + map['default_number_of_teams'] = Variable(defaultNumberOfTeams); + if (!nullToAbsent || integrationId != null) { + map['integration_id'] = Variable(integrationId); + } + if (!nullToAbsent || integrationEntityId != null) { + map['integration_entity_id'] = Variable(integrationEntityId); + } + if (!nullToAbsent || integrationAdditionalData != null) { + map['integration_additional_data'] = + Variable(integrationAdditionalData); + } + return map; + } + + PacingEntityCompanion toCompanion(bool nullToAbsent) { + return PacingEntityCompanion( + id: Value(id), + name: Value(name), + createdDate: createdDate == null && nullToAbsent + ? const Value.absent() + : Value(createdDate), + modifiedDate: modifiedDate == null && nullToAbsent + ? const Value.absent() + : Value(modifiedDate), + tags: Value(tags), + improvisations: Value(improvisations), + defaultNumberOfTeams: Value(defaultNumberOfTeams), + integrationId: integrationId == null && nullToAbsent + ? const Value.absent() + : Value(integrationId), + integrationEntityId: integrationEntityId == null && nullToAbsent + ? const Value.absent() + : Value(integrationEntityId), + integrationAdditionalData: + integrationAdditionalData == null && nullToAbsent + ? const Value.absent() + : Value(integrationAdditionalData), + ); + } + + factory PacingEntityData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return PacingEntityData( + id: serializer.fromJson(json['id']), + name: serializer.fromJson(json['name']), + createdDate: serializer.fromJson(json['createdDate']), + modifiedDate: serializer.fromJson(json['modifiedDate']), + tags: $PacingEntityTable.$convertertags + .fromJson(serializer.fromJson(json['tags'])), + improvisations: $PacingEntityTable.$converterimprovisations + .fromJson(serializer.fromJson(json['improvisations'])), + defaultNumberOfTeams: + serializer.fromJson(json['defaultNumberOfTeams']), + integrationId: serializer.fromJson(json['integrationId']), + integrationEntityId: + serializer.fromJson(json['integrationEntityId']), + integrationAdditionalData: + serializer.fromJson(json['integrationAdditionalData']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'name': serializer.toJson(name), + 'createdDate': serializer.toJson(createdDate), + 'modifiedDate': serializer.toJson(modifiedDate), + 'tags': serializer + .toJson($PacingEntityTable.$convertertags.toJson(tags)), + 'improvisations': serializer.toJson( + $PacingEntityTable.$converterimprovisations.toJson(improvisations)), + 'defaultNumberOfTeams': serializer.toJson(defaultNumberOfTeams), + 'integrationId': serializer.toJson(integrationId), + 'integrationEntityId': serializer.toJson(integrationEntityId), + 'integrationAdditionalData': + serializer.toJson(integrationAdditionalData), + }; + } + + PacingEntityData copyWith( + {int? id, + String? name, + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), + List? tags, + ImprovisationModel? improvisations, + int? defaultNumberOfTeams, + Value integrationId = const Value.absent(), + Value integrationEntityId = const Value.absent(), + Value integrationAdditionalData = const Value.absent()}) => + PacingEntityData( + id: id ?? this.id, + name: name ?? this.name, + createdDate: createdDate.present ? createdDate.value : this.createdDate, + modifiedDate: + modifiedDate.present ? modifiedDate.value : this.modifiedDate, + tags: tags ?? this.tags, + improvisations: improvisations ?? this.improvisations, + defaultNumberOfTeams: defaultNumberOfTeams ?? this.defaultNumberOfTeams, + integrationId: + integrationId.present ? integrationId.value : this.integrationId, + integrationEntityId: integrationEntityId.present + ? integrationEntityId.value + : this.integrationEntityId, + integrationAdditionalData: integrationAdditionalData.present + ? integrationAdditionalData.value + : this.integrationAdditionalData, + ); + PacingEntityData copyWithCompanion(PacingEntityCompanion data) { + return PacingEntityData( + id: data.id.present ? data.id.value : this.id, + name: data.name.present ? data.name.value : this.name, + createdDate: + data.createdDate.present ? data.createdDate.value : this.createdDate, + modifiedDate: data.modifiedDate.present + ? data.modifiedDate.value + : this.modifiedDate, + tags: data.tags.present ? data.tags.value : this.tags, + improvisations: data.improvisations.present + ? data.improvisations.value + : this.improvisations, + defaultNumberOfTeams: data.defaultNumberOfTeams.present + ? data.defaultNumberOfTeams.value + : this.defaultNumberOfTeams, + integrationId: data.integrationId.present + ? data.integrationId.value + : this.integrationId, + integrationEntityId: data.integrationEntityId.present + ? data.integrationEntityId.value + : this.integrationEntityId, + integrationAdditionalData: data.integrationAdditionalData.present + ? data.integrationAdditionalData.value + : this.integrationAdditionalData, + ); + } + + @override + String toString() { + return (StringBuffer('PacingEntityData(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('createdDate: $createdDate, ') + ..write('modifiedDate: $modifiedDate, ') + ..write('tags: $tags, ') + ..write('improvisations: $improvisations, ') + ..write('defaultNumberOfTeams: $defaultNumberOfTeams, ') + ..write('integrationId: $integrationId, ') + ..write('integrationEntityId: $integrationEntityId, ') + ..write('integrationAdditionalData: $integrationAdditionalData') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + name, + createdDate, + modifiedDate, + tags, + improvisations, + defaultNumberOfTeams, + integrationId, + integrationEntityId, + integrationAdditionalData); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is PacingEntityData && + other.id == this.id && + other.name == this.name && + other.createdDate == this.createdDate && + other.modifiedDate == this.modifiedDate && + other.tags == this.tags && + other.improvisations == this.improvisations && + other.defaultNumberOfTeams == this.defaultNumberOfTeams && + other.integrationId == this.integrationId && + other.integrationEntityId == this.integrationEntityId && + other.integrationAdditionalData == this.integrationAdditionalData); +} + +class PacingEntityCompanion extends UpdateCompanion { + final Value id; + final Value name; + final Value createdDate; + final Value modifiedDate; + final Value> tags; + final Value improvisations; + final Value defaultNumberOfTeams; + final Value integrationId; + final Value integrationEntityId; + final Value integrationAdditionalData; + const PacingEntityCompanion({ + this.id = const Value.absent(), + this.name = const Value.absent(), + this.createdDate = const Value.absent(), + this.modifiedDate = const Value.absent(), + this.tags = const Value.absent(), + this.improvisations = const Value.absent(), + this.defaultNumberOfTeams = const Value.absent(), + this.integrationId = const Value.absent(), + this.integrationEntityId = const Value.absent(), + this.integrationAdditionalData = const Value.absent(), + }); + PacingEntityCompanion.insert({ + this.id = const Value.absent(), + required String name, + this.createdDate = const Value.absent(), + this.modifiedDate = const Value.absent(), + required List tags, + required ImprovisationModel improvisations, + this.defaultNumberOfTeams = const Value.absent(), + this.integrationId = const Value.absent(), + this.integrationEntityId = const Value.absent(), + this.integrationAdditionalData = const Value.absent(), + }) : name = Value(name), + tags = Value(tags), + improvisations = Value(improvisations); + static Insertable custom({ + Expression? id, + Expression? name, + Expression? createdDate, + Expression? modifiedDate, + Expression? tags, + Expression? improvisations, + Expression? defaultNumberOfTeams, + Expression? integrationId, + Expression? integrationEntityId, + Expression? integrationAdditionalData, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (name != null) 'name': name, + if (createdDate != null) 'created_date': createdDate, + if (modifiedDate != null) 'modified_date': modifiedDate, + if (tags != null) 'tags': tags, + if (improvisations != null) 'improvisations': improvisations, + if (defaultNumberOfTeams != null) + 'default_number_of_teams': defaultNumberOfTeams, + if (integrationId != null) 'integration_id': integrationId, + if (integrationEntityId != null) + 'integration_entity_id': integrationEntityId, + if (integrationAdditionalData != null) + 'integration_additional_data': integrationAdditionalData, + }); + } + + PacingEntityCompanion copyWith( + {Value? id, + Value? name, + Value? createdDate, + Value? modifiedDate, + Value>? tags, + Value? improvisations, + Value? defaultNumberOfTeams, + Value? integrationId, + Value? integrationEntityId, + Value? integrationAdditionalData}) { + return PacingEntityCompanion( + id: id ?? this.id, + name: name ?? this.name, + createdDate: createdDate ?? this.createdDate, + modifiedDate: modifiedDate ?? this.modifiedDate, + tags: tags ?? this.tags, + improvisations: improvisations ?? this.improvisations, + defaultNumberOfTeams: defaultNumberOfTeams ?? this.defaultNumberOfTeams, + integrationId: integrationId ?? this.integrationId, + integrationEntityId: integrationEntityId ?? this.integrationEntityId, + integrationAdditionalData: + integrationAdditionalData ?? this.integrationAdditionalData, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (name.present) { + map['name'] = Variable(name.value); + } + if (createdDate.present) { + map['created_date'] = Variable(createdDate.value); + } + if (modifiedDate.present) { + map['modified_date'] = Variable(modifiedDate.value); + } + if (tags.present) { + map['tags'] = + Variable($PacingEntityTable.$convertertags.toSql(tags.value)); + } + if (improvisations.present) { + map['improvisations'] = Variable($PacingEntityTable + .$converterimprovisations + .toSql(improvisations.value)); + } + if (defaultNumberOfTeams.present) { + map['default_number_of_teams'] = + Variable(defaultNumberOfTeams.value); + } + if (integrationId.present) { + map['integration_id'] = Variable(integrationId.value); + } + if (integrationEntityId.present) { + map['integration_entity_id'] = + Variable(integrationEntityId.value); + } + if (integrationAdditionalData.present) { + map['integration_additional_data'] = + Variable(integrationAdditionalData.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('PacingEntityCompanion(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('createdDate: $createdDate, ') + ..write('modifiedDate: $modifiedDate, ') + ..write('tags: $tags, ') + ..write('improvisations: $improvisations, ') + ..write('defaultNumberOfTeams: $defaultNumberOfTeams, ') + ..write('integrationId: $integrationId, ') + ..write('integrationEntityId: $integrationEntityId, ') + ..write('integrationAdditionalData: $integrationAdditionalData') + ..write(')')) + .toString(); + } +} + +class $MatchEntityTable extends MatchEntity + with TableInfo<$MatchEntityTable, MatchEntityData> { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + $MatchEntityTable(this.attachedDatabase, [this._alias]); + static const VerificationMeta _idMeta = const VerificationMeta('id'); + @override + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + static const VerificationMeta _nameMeta = const VerificationMeta('name'); + @override + late final GeneratedColumn name = GeneratedColumn( + 'name', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + static const VerificationMeta _createdDateMeta = + const VerificationMeta('createdDate'); + @override + late final GeneratedColumn createdDate = GeneratedColumn( + 'created_date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + static const VerificationMeta _modifiedDateMeta = + const VerificationMeta('modifiedDate'); + @override + late final GeneratedColumn modifiedDate = GeneratedColumn( + 'modified_date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + static const VerificationMeta _tagsMeta = const VerificationMeta('tags'); + @override + late final GeneratedColumnWithTypeConverter, String> tags = + GeneratedColumn('tags', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true) + .withConverter>($MatchEntityTable.$convertertags); + static const VerificationMeta _teamsMeta = const VerificationMeta('teams'); + @override + late final GeneratedColumnWithTypeConverter teams = + GeneratedColumn('teams', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true) + .withConverter($MatchEntityTable.$converterteams); + static const VerificationMeta _improvisationsMeta = + const VerificationMeta('improvisations'); + @override + late final GeneratedColumnWithTypeConverter + improvisations = GeneratedColumn( + 'improvisations', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true) + .withConverter( + $MatchEntityTable.$converterimprovisations); + static const VerificationMeta _penaltiesMeta = + const VerificationMeta('penalties'); + @override + late final GeneratedColumnWithTypeConverter + penalties = GeneratedColumn('penalties', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true) + .withConverter($MatchEntityTable.$converterpenalties); + static const VerificationMeta _pointsMeta = const VerificationMeta('points'); + @override + late final GeneratedColumnWithTypeConverter points = + GeneratedColumn('points', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true) + .withConverter($MatchEntityTable.$converterpoints); + static const VerificationMeta _starsMeta = const VerificationMeta('stars'); + @override + late final GeneratedColumnWithTypeConverter stars = + GeneratedColumn('stars', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true) + .withConverter($MatchEntityTable.$converterstars); + static const VerificationMeta _enableStatisticsMeta = + const VerificationMeta('enableStatistics'); + @override + late final GeneratedColumn enableStatistics = GeneratedColumn( + 'enable_statistics', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("enable_statistics" IN (0, 1))'), + defaultValue: const Constant(true)); + static const VerificationMeta _enablePenaltiesImpactPointsMeta = + const VerificationMeta('enablePenaltiesImpactPoints'); + @override + late final GeneratedColumn enablePenaltiesImpactPoints = + GeneratedColumn( + 'enable_penalties_impact_points', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("enable_penalties_impact_points" IN (0, 1))'), + defaultValue: const Constant(true)); + static const VerificationMeta _penaltiesImpactTypeMeta = + const VerificationMeta('penaltiesImpactType'); + @override + late final GeneratedColumnWithTypeConverter + penaltiesImpactType = GeneratedColumn( + 'penalties_impact_type', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: Constant(PenaltiesImpactType.addPoints.index)) + .withConverter( + $MatchEntityTable.$converterpenaltiesImpactType); + static const VerificationMeta _penaltiesRequiredToImpactPointsMeta = + const VerificationMeta('penaltiesRequiredToImpactPoints'); + @override + late final GeneratedColumn penaltiesRequiredToImpactPoints = + GeneratedColumn( + 'penalties_required_to_impact_points', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(3)); + static const VerificationMeta _enableMatchExpulsionMeta = + const VerificationMeta('enableMatchExpulsion'); + @override + late final GeneratedColumn enableMatchExpulsion = GeneratedColumn( + 'enable_match_expulsion', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("enable_match_expulsion" IN (0, 1))'), + defaultValue: const Constant(true)); + static const VerificationMeta _penaltiesRequiredToExpelMeta = + const VerificationMeta('penaltiesRequiredToExpel'); + @override + late final GeneratedColumn penaltiesRequiredToExpel = + GeneratedColumn('penalties_required_to_expel', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(3)); + static const VerificationMeta _integrationIdMeta = + const VerificationMeta('integrationId'); + @override + late final GeneratedColumn integrationId = GeneratedColumn( + 'integration_id', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + static const VerificationMeta _integrationEntityIdMeta = + const VerificationMeta('integrationEntityId'); + @override + late final GeneratedColumn integrationEntityId = + GeneratedColumn('integration_entity_id', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + static const VerificationMeta _integrationAdditionalDataMeta = + const VerificationMeta('integrationAdditionalData'); + @override + late final GeneratedColumn integrationAdditionalData = + GeneratedColumn('integration_additional_data', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + static const VerificationMeta + _integrationRestrictMaximumPointPerImprovisationMeta = + const VerificationMeta('integrationRestrictMaximumPointPerImprovisation'); + @override + late final GeneratedColumn + integrationRestrictMaximumPointPerImprovisation = GeneratedColumn( + 'integration_restrict_maximum_point_per_improvisation', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false); + static const VerificationMeta _integrationMinNumberOfImprovisationsMeta = + const VerificationMeta('integrationMinNumberOfImprovisations'); + @override + late final GeneratedColumn integrationMinNumberOfImprovisations = + GeneratedColumn( + 'integration_min_number_of_improvisations', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + static const VerificationMeta _integrationMaxNumberOfImprovisationsMeta = + const VerificationMeta('integrationMaxNumberOfImprovisations'); + @override + late final GeneratedColumn integrationMaxNumberOfImprovisations = + GeneratedColumn( + 'integration_max_number_of_improvisations', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + static const VerificationMeta _integrationPenaltyTypesMeta = + const VerificationMeta('integrationPenaltyTypes'); + @override + late final GeneratedColumnWithTypeConverter?, String> + integrationPenaltyTypes = GeneratedColumn( + 'integration_penalty_types', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false) + .withConverter?>( + $MatchEntityTable.$converterintegrationPenaltyTypesn); + @override + List get $columns => [ + id, + name, + createdDate, + modifiedDate, + tags, + teams, + improvisations, + penalties, + points, + stars, + enableStatistics, + enablePenaltiesImpactPoints, + penaltiesImpactType, + penaltiesRequiredToImpactPoints, + enableMatchExpulsion, + penaltiesRequiredToExpel, + integrationId, + integrationEntityId, + integrationAdditionalData, + integrationRestrictMaximumPointPerImprovisation, + integrationMinNumberOfImprovisations, + integrationMaxNumberOfImprovisations, + integrationPenaltyTypes + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'match_entity'; + @override + VerificationContext validateIntegrity(Insertable instance, + {bool isInserting = false}) { + final context = VerificationContext(); + final data = instance.toColumns(true); + if (data.containsKey('id')) { + context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); + } + if (data.containsKey('name')) { + context.handle( + _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); + } else if (isInserting) { + context.missing(_nameMeta); + } + if (data.containsKey('created_date')) { + context.handle( + _createdDateMeta, + createdDate.isAcceptableOrUnknown( + data['created_date']!, _createdDateMeta)); + } + if (data.containsKey('modified_date')) { + context.handle( + _modifiedDateMeta, + modifiedDate.isAcceptableOrUnknown( + data['modified_date']!, _modifiedDateMeta)); + } + context.handle(_tagsMeta, const VerificationResult.success()); + context.handle(_teamsMeta, const VerificationResult.success()); + context.handle(_improvisationsMeta, const VerificationResult.success()); + context.handle(_penaltiesMeta, const VerificationResult.success()); + context.handle(_pointsMeta, const VerificationResult.success()); + context.handle(_starsMeta, const VerificationResult.success()); + if (data.containsKey('enable_statistics')) { + context.handle( + _enableStatisticsMeta, + enableStatistics.isAcceptableOrUnknown( + data['enable_statistics']!, _enableStatisticsMeta)); + } + if (data.containsKey('enable_penalties_impact_points')) { + context.handle( + _enablePenaltiesImpactPointsMeta, + enablePenaltiesImpactPoints.isAcceptableOrUnknown( + data['enable_penalties_impact_points']!, + _enablePenaltiesImpactPointsMeta)); + } + context.handle( + _penaltiesImpactTypeMeta, const VerificationResult.success()); + if (data.containsKey('penalties_required_to_impact_points')) { + context.handle( + _penaltiesRequiredToImpactPointsMeta, + penaltiesRequiredToImpactPoints.isAcceptableOrUnknown( + data['penalties_required_to_impact_points']!, + _penaltiesRequiredToImpactPointsMeta)); + } + if (data.containsKey('enable_match_expulsion')) { + context.handle( + _enableMatchExpulsionMeta, + enableMatchExpulsion.isAcceptableOrUnknown( + data['enable_match_expulsion']!, _enableMatchExpulsionMeta)); + } + if (data.containsKey('penalties_required_to_expel')) { + context.handle( + _penaltiesRequiredToExpelMeta, + penaltiesRequiredToExpel.isAcceptableOrUnknown( + data['penalties_required_to_expel']!, + _penaltiesRequiredToExpelMeta)); + } + if (data.containsKey('integration_id')) { + context.handle( + _integrationIdMeta, + integrationId.isAcceptableOrUnknown( + data['integration_id']!, _integrationIdMeta)); + } + if (data.containsKey('integration_entity_id')) { + context.handle( + _integrationEntityIdMeta, + integrationEntityId.isAcceptableOrUnknown( + data['integration_entity_id']!, _integrationEntityIdMeta)); + } + if (data.containsKey('integration_additional_data')) { + context.handle( + _integrationAdditionalDataMeta, + integrationAdditionalData.isAcceptableOrUnknown( + data['integration_additional_data']!, + _integrationAdditionalDataMeta)); + } + if (data + .containsKey('integration_restrict_maximum_point_per_improvisation')) { + context.handle( + _integrationRestrictMaximumPointPerImprovisationMeta, + integrationRestrictMaximumPointPerImprovisation.isAcceptableOrUnknown( + data['integration_restrict_maximum_point_per_improvisation']!, + _integrationRestrictMaximumPointPerImprovisationMeta)); + } + if (data.containsKey('integration_min_number_of_improvisations')) { + context.handle( + _integrationMinNumberOfImprovisationsMeta, + integrationMinNumberOfImprovisations.isAcceptableOrUnknown( + data['integration_min_number_of_improvisations']!, + _integrationMinNumberOfImprovisationsMeta)); + } + if (data.containsKey('integration_max_number_of_improvisations')) { + context.handle( + _integrationMaxNumberOfImprovisationsMeta, + integrationMaxNumberOfImprovisations.isAcceptableOrUnknown( + data['integration_max_number_of_improvisations']!, + _integrationMaxNumberOfImprovisationsMeta)); + } + context.handle( + _integrationPenaltyTypesMeta, const VerificationResult.success()); + return context; + } + + @override + Set get $primaryKey => {id}; + @override + MatchEntityData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MatchEntityData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + name: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}name'])!, + createdDate: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_date']), + modifiedDate: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}modified_date']), + tags: $MatchEntityTable.$convertertags.fromSql(attachedDatabase + .typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tags'])!), + teams: $MatchEntityTable.$converterteams.fromSql(attachedDatabase + .typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}teams'])!), + improvisations: $MatchEntityTable.$converterimprovisations.fromSql( + attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}improvisations'])!), + penalties: $MatchEntityTable.$converterpenalties.fromSql(attachedDatabase + .typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}penalties'])!), + points: $MatchEntityTable.$converterpoints.fromSql(attachedDatabase + .typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}points'])!), + stars: $MatchEntityTable.$converterstars.fromSql(attachedDatabase + .typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}stars'])!), + enableStatistics: attachedDatabase.typeMapping.read( + DriftSqlType.bool, data['${effectivePrefix}enable_statistics'])!, + enablePenaltiesImpactPoints: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}enable_penalties_impact_points'])!, + penaltiesImpactType: $MatchEntityTable.$converterpenaltiesImpactType + .fromSql(attachedDatabase.typeMapping.read(DriftSqlType.int, + data['${effectivePrefix}penalties_impact_type'])!), + penaltiesRequiredToImpactPoints: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}penalties_required_to_impact_points'])!, + enableMatchExpulsion: attachedDatabase.typeMapping.read( + DriftSqlType.bool, data['${effectivePrefix}enable_match_expulsion'])!, + penaltiesRequiredToExpel: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}penalties_required_to_expel'])!, + integrationId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}integration_id']), + integrationEntityId: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}integration_entity_id']), + integrationAdditionalData: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}integration_additional_data']), + integrationRestrictMaximumPointPerImprovisation: + attachedDatabase.typeMapping.read( + DriftSqlType.int, + data[ + '${effectivePrefix}integration_restrict_maximum_point_per_improvisation']), + integrationMinNumberOfImprovisations: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}integration_min_number_of_improvisations']), + integrationMaxNumberOfImprovisations: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}integration_max_number_of_improvisations']), + integrationPenaltyTypes: $MatchEntityTable + .$converterintegrationPenaltyTypesn + .fromSql(attachedDatabase.typeMapping.read(DriftSqlType.string, + data['${effectivePrefix}integration_penalty_types'])), + ); + } + + @override + $MatchEntityTable createAlias(String alias) { + return $MatchEntityTable(attachedDatabase, alias); + } + + static JsonTypeConverter2, String, String> $convertertags = + const TagsConverter(); + static JsonTypeConverter2 $converterteams = + MatchTeamModel.converter; + static JsonTypeConverter2 + $converterimprovisations = MatchTeamModel.converter; + static JsonTypeConverter2 + $converterpenalties = MatchTeamModel.converter; + static JsonTypeConverter2 $converterpoints = + MatchTeamModel.converter; + static JsonTypeConverter2 $converterstars = + MatchTeamModel.converter; + static JsonTypeConverter2 + $converterpenaltiesImpactType = + const EnumIndexConverter(PenaltiesImpactType.values); + static JsonTypeConverter2, String, String> + $converterintegrationPenaltyTypes = const TagsConverter(); + static JsonTypeConverter2?, String?, String?> + $converterintegrationPenaltyTypesn = + JsonTypeConverter2.asNullable($converterintegrationPenaltyTypes); +} + +class MatchEntityData extends DataClass implements Insertable { + final int id; + final String name; + final DateTime? createdDate; + final DateTime? modifiedDate; + final List tags; + final MatchTeamModel teams; + final MatchTeamModel improvisations; + final MatchTeamModel penalties; + final MatchTeamModel points; + final MatchTeamModel stars; + final bool enableStatistics; + final bool enablePenaltiesImpactPoints; + final PenaltiesImpactType penaltiesImpactType; + final int penaltiesRequiredToImpactPoints; + final bool enableMatchExpulsion; + final int penaltiesRequiredToExpel; + final String? integrationId; + final String? integrationEntityId; + final String? integrationAdditionalData; + final int? integrationRestrictMaximumPointPerImprovisation; + final int? integrationMinNumberOfImprovisations; + final int? integrationMaxNumberOfImprovisations; + final List? integrationPenaltyTypes; + const MatchEntityData( + {required this.id, + required this.name, + this.createdDate, + this.modifiedDate, + required this.tags, + required this.teams, + required this.improvisations, + required this.penalties, + required this.points, + required this.stars, + required this.enableStatistics, + required this.enablePenaltiesImpactPoints, + required this.penaltiesImpactType, + required this.penaltiesRequiredToImpactPoints, + required this.enableMatchExpulsion, + required this.penaltiesRequiredToExpel, + this.integrationId, + this.integrationEntityId, + this.integrationAdditionalData, + this.integrationRestrictMaximumPointPerImprovisation, + this.integrationMinNumberOfImprovisations, + this.integrationMaxNumberOfImprovisations, + this.integrationPenaltyTypes}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['name'] = Variable(name); + if (!nullToAbsent || createdDate != null) { + map['created_date'] = Variable(createdDate); + } + if (!nullToAbsent || modifiedDate != null) { + map['modified_date'] = Variable(modifiedDate); + } + { + map['tags'] = + Variable($MatchEntityTable.$convertertags.toSql(tags)); + } + { + map['teams'] = + Variable($MatchEntityTable.$converterteams.toSql(teams)); + } + { + map['improvisations'] = Variable( + $MatchEntityTable.$converterimprovisations.toSql(improvisations)); + } + { + map['penalties'] = Variable( + $MatchEntityTable.$converterpenalties.toSql(penalties)); + } + { + map['points'] = + Variable($MatchEntityTable.$converterpoints.toSql(points)); + } + { + map['stars'] = + Variable($MatchEntityTable.$converterstars.toSql(stars)); + } + map['enable_statistics'] = Variable(enableStatistics); + map['enable_penalties_impact_points'] = + Variable(enablePenaltiesImpactPoints); + { + map['penalties_impact_type'] = Variable($MatchEntityTable + .$converterpenaltiesImpactType + .toSql(penaltiesImpactType)); + } + map['penalties_required_to_impact_points'] = + Variable(penaltiesRequiredToImpactPoints); + map['enable_match_expulsion'] = Variable(enableMatchExpulsion); + map['penalties_required_to_expel'] = + Variable(penaltiesRequiredToExpel); + if (!nullToAbsent || integrationId != null) { + map['integration_id'] = Variable(integrationId); + } + if (!nullToAbsent || integrationEntityId != null) { + map['integration_entity_id'] = Variable(integrationEntityId); + } + if (!nullToAbsent || integrationAdditionalData != null) { + map['integration_additional_data'] = + Variable(integrationAdditionalData); + } + if (!nullToAbsent || + integrationRestrictMaximumPointPerImprovisation != null) { + map['integration_restrict_maximum_point_per_improvisation'] = + Variable(integrationRestrictMaximumPointPerImprovisation); + } + if (!nullToAbsent || integrationMinNumberOfImprovisations != null) { + map['integration_min_number_of_improvisations'] = + Variable(integrationMinNumberOfImprovisations); + } + if (!nullToAbsent || integrationMaxNumberOfImprovisations != null) { + map['integration_max_number_of_improvisations'] = + Variable(integrationMaxNumberOfImprovisations); + } + if (!nullToAbsent || integrationPenaltyTypes != null) { + map['integration_penalty_types'] = Variable($MatchEntityTable + .$converterintegrationPenaltyTypesn + .toSql(integrationPenaltyTypes)); + } + return map; + } + + MatchEntityCompanion toCompanion(bool nullToAbsent) { + return MatchEntityCompanion( + id: Value(id), + name: Value(name), + createdDate: createdDate == null && nullToAbsent + ? const Value.absent() + : Value(createdDate), + modifiedDate: modifiedDate == null && nullToAbsent + ? const Value.absent() + : Value(modifiedDate), + tags: Value(tags), + teams: Value(teams), + improvisations: Value(improvisations), + penalties: Value(penalties), + points: Value(points), + stars: Value(stars), + enableStatistics: Value(enableStatistics), + enablePenaltiesImpactPoints: Value(enablePenaltiesImpactPoints), + penaltiesImpactType: Value(penaltiesImpactType), + penaltiesRequiredToImpactPoints: Value(penaltiesRequiredToImpactPoints), + enableMatchExpulsion: Value(enableMatchExpulsion), + penaltiesRequiredToExpel: Value(penaltiesRequiredToExpel), + integrationId: integrationId == null && nullToAbsent + ? const Value.absent() + : Value(integrationId), + integrationEntityId: integrationEntityId == null && nullToAbsent + ? const Value.absent() + : Value(integrationEntityId), + integrationAdditionalData: + integrationAdditionalData == null && nullToAbsent + ? const Value.absent() + : Value(integrationAdditionalData), + integrationRestrictMaximumPointPerImprovisation: + integrationRestrictMaximumPointPerImprovisation == null && + nullToAbsent + ? const Value.absent() + : Value(integrationRestrictMaximumPointPerImprovisation), + integrationMinNumberOfImprovisations: + integrationMinNumberOfImprovisations == null && nullToAbsent + ? const Value.absent() + : Value(integrationMinNumberOfImprovisations), + integrationMaxNumberOfImprovisations: + integrationMaxNumberOfImprovisations == null && nullToAbsent + ? const Value.absent() + : Value(integrationMaxNumberOfImprovisations), + integrationPenaltyTypes: integrationPenaltyTypes == null && nullToAbsent + ? const Value.absent() + : Value(integrationPenaltyTypes), + ); + } + + factory MatchEntityData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MatchEntityData( + id: serializer.fromJson(json['id']), + name: serializer.fromJson(json['name']), + createdDate: serializer.fromJson(json['createdDate']), + modifiedDate: serializer.fromJson(json['modifiedDate']), + tags: $MatchEntityTable.$convertertags + .fromJson(serializer.fromJson(json['tags'])), + teams: $MatchEntityTable.$converterteams + .fromJson(serializer.fromJson(json['teams'])), + improvisations: $MatchEntityTable.$converterimprovisations + .fromJson(serializer.fromJson(json['improvisations'])), + penalties: $MatchEntityTable.$converterpenalties + .fromJson(serializer.fromJson(json['penalties'])), + points: $MatchEntityTable.$converterpoints + .fromJson(serializer.fromJson(json['points'])), + stars: $MatchEntityTable.$converterstars + .fromJson(serializer.fromJson(json['stars'])), + enableStatistics: serializer.fromJson(json['enableStatistics']), + enablePenaltiesImpactPoints: + serializer.fromJson(json['enablePenaltiesImpactPoints']), + penaltiesImpactType: $MatchEntityTable.$converterpenaltiesImpactType + .fromJson(serializer.fromJson(json['penaltiesImpactType'])), + penaltiesRequiredToImpactPoints: + serializer.fromJson(json['penaltiesRequiredToImpactPoints']), + enableMatchExpulsion: + serializer.fromJson(json['enableMatchExpulsion']), + penaltiesRequiredToExpel: + serializer.fromJson(json['penaltiesRequiredToExpel']), + integrationId: serializer.fromJson(json['integrationId']), + integrationEntityId: + serializer.fromJson(json['integrationEntityId']), + integrationAdditionalData: + serializer.fromJson(json['integrationAdditionalData']), + integrationRestrictMaximumPointPerImprovisation: + serializer.fromJson( + json['integrationRestrictMaximumPointPerImprovisation']), + integrationMinNumberOfImprovisations: serializer + .fromJson(json['integrationMinNumberOfImprovisations']), + integrationMaxNumberOfImprovisations: serializer + .fromJson(json['integrationMaxNumberOfImprovisations']), + integrationPenaltyTypes: + $MatchEntityTable.$converterintegrationPenaltyTypesn.fromJson( + serializer.fromJson(json['integrationPenaltyTypes'])), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'name': serializer.toJson(name), + 'createdDate': serializer.toJson(createdDate), + 'modifiedDate': serializer.toJson(modifiedDate), + 'tags': serializer + .toJson($MatchEntityTable.$convertertags.toJson(tags)), + 'teams': serializer + .toJson($MatchEntityTable.$converterteams.toJson(teams)), + 'improvisations': serializer.toJson( + $MatchEntityTable.$converterimprovisations.toJson(improvisations)), + 'penalties': serializer.toJson( + $MatchEntityTable.$converterpenalties.toJson(penalties)), + 'points': serializer + .toJson($MatchEntityTable.$converterpoints.toJson(points)), + 'stars': serializer + .toJson($MatchEntityTable.$converterstars.toJson(stars)), + 'enableStatistics': serializer.toJson(enableStatistics), + 'enablePenaltiesImpactPoints': + serializer.toJson(enablePenaltiesImpactPoints), + 'penaltiesImpactType': serializer.toJson($MatchEntityTable + .$converterpenaltiesImpactType + .toJson(penaltiesImpactType)), + 'penaltiesRequiredToImpactPoints': + serializer.toJson(penaltiesRequiredToImpactPoints), + 'enableMatchExpulsion': serializer.toJson(enableMatchExpulsion), + 'penaltiesRequiredToExpel': + serializer.toJson(penaltiesRequiredToExpel), + 'integrationId': serializer.toJson(integrationId), + 'integrationEntityId': serializer.toJson(integrationEntityId), + 'integrationAdditionalData': + serializer.toJson(integrationAdditionalData), + 'integrationRestrictMaximumPointPerImprovisation': serializer + .toJson(integrationRestrictMaximumPointPerImprovisation), + 'integrationMinNumberOfImprovisations': + serializer.toJson(integrationMinNumberOfImprovisations), + 'integrationMaxNumberOfImprovisations': + serializer.toJson(integrationMaxNumberOfImprovisations), + 'integrationPenaltyTypes': serializer.toJson($MatchEntityTable + .$converterintegrationPenaltyTypesn + .toJson(integrationPenaltyTypes)), + }; + } + + MatchEntityData copyWith( + {int? id, + String? name, + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), + List? tags, + MatchTeamModel? teams, + MatchTeamModel? improvisations, + MatchTeamModel? penalties, + MatchTeamModel? points, + MatchTeamModel? stars, + bool? enableStatistics, + bool? enablePenaltiesImpactPoints, + PenaltiesImpactType? penaltiesImpactType, + int? penaltiesRequiredToImpactPoints, + bool? enableMatchExpulsion, + int? penaltiesRequiredToExpel, + Value integrationId = const Value.absent(), + Value integrationEntityId = const Value.absent(), + Value integrationAdditionalData = const Value.absent(), + Value integrationRestrictMaximumPointPerImprovisation = + const Value.absent(), + Value integrationMinNumberOfImprovisations = + const Value.absent(), + Value integrationMaxNumberOfImprovisations = + const Value.absent(), + Value?> integrationPenaltyTypes = + const Value.absent()}) => + MatchEntityData( + id: id ?? this.id, + name: name ?? this.name, + createdDate: createdDate.present ? createdDate.value : this.createdDate, + modifiedDate: + modifiedDate.present ? modifiedDate.value : this.modifiedDate, + tags: tags ?? this.tags, + teams: teams ?? this.teams, + improvisations: improvisations ?? this.improvisations, + penalties: penalties ?? this.penalties, + points: points ?? this.points, + stars: stars ?? this.stars, + enableStatistics: enableStatistics ?? this.enableStatistics, + enablePenaltiesImpactPoints: + enablePenaltiesImpactPoints ?? this.enablePenaltiesImpactPoints, + penaltiesImpactType: penaltiesImpactType ?? this.penaltiesImpactType, + penaltiesRequiredToImpactPoints: penaltiesRequiredToImpactPoints ?? + this.penaltiesRequiredToImpactPoints, + enableMatchExpulsion: enableMatchExpulsion ?? this.enableMatchExpulsion, + penaltiesRequiredToExpel: + penaltiesRequiredToExpel ?? this.penaltiesRequiredToExpel, + integrationId: + integrationId.present ? integrationId.value : this.integrationId, + integrationEntityId: integrationEntityId.present + ? integrationEntityId.value + : this.integrationEntityId, + integrationAdditionalData: integrationAdditionalData.present + ? integrationAdditionalData.value + : this.integrationAdditionalData, + integrationRestrictMaximumPointPerImprovisation: + integrationRestrictMaximumPointPerImprovisation.present + ? integrationRestrictMaximumPointPerImprovisation.value + : this.integrationRestrictMaximumPointPerImprovisation, + integrationMinNumberOfImprovisations: + integrationMinNumberOfImprovisations.present + ? integrationMinNumberOfImprovisations.value + : this.integrationMinNumberOfImprovisations, + integrationMaxNumberOfImprovisations: + integrationMaxNumberOfImprovisations.present + ? integrationMaxNumberOfImprovisations.value + : this.integrationMaxNumberOfImprovisations, + integrationPenaltyTypes: integrationPenaltyTypes.present + ? integrationPenaltyTypes.value + : this.integrationPenaltyTypes, + ); + MatchEntityData copyWithCompanion(MatchEntityCompanion data) { + return MatchEntityData( + id: data.id.present ? data.id.value : this.id, + name: data.name.present ? data.name.value : this.name, + createdDate: + data.createdDate.present ? data.createdDate.value : this.createdDate, + modifiedDate: data.modifiedDate.present + ? data.modifiedDate.value + : this.modifiedDate, + tags: data.tags.present ? data.tags.value : this.tags, + teams: data.teams.present ? data.teams.value : this.teams, + improvisations: data.improvisations.present + ? data.improvisations.value + : this.improvisations, + penalties: data.penalties.present ? data.penalties.value : this.penalties, + points: data.points.present ? data.points.value : this.points, + stars: data.stars.present ? data.stars.value : this.stars, + enableStatistics: data.enableStatistics.present + ? data.enableStatistics.value + : this.enableStatistics, + enablePenaltiesImpactPoints: data.enablePenaltiesImpactPoints.present + ? data.enablePenaltiesImpactPoints.value + : this.enablePenaltiesImpactPoints, + penaltiesImpactType: data.penaltiesImpactType.present + ? data.penaltiesImpactType.value + : this.penaltiesImpactType, + penaltiesRequiredToImpactPoints: + data.penaltiesRequiredToImpactPoints.present + ? data.penaltiesRequiredToImpactPoints.value + : this.penaltiesRequiredToImpactPoints, + enableMatchExpulsion: data.enableMatchExpulsion.present + ? data.enableMatchExpulsion.value + : this.enableMatchExpulsion, + penaltiesRequiredToExpel: data.penaltiesRequiredToExpel.present + ? data.penaltiesRequiredToExpel.value + : this.penaltiesRequiredToExpel, + integrationId: data.integrationId.present + ? data.integrationId.value + : this.integrationId, + integrationEntityId: data.integrationEntityId.present + ? data.integrationEntityId.value + : this.integrationEntityId, + integrationAdditionalData: data.integrationAdditionalData.present + ? data.integrationAdditionalData.value + : this.integrationAdditionalData, + integrationRestrictMaximumPointPerImprovisation: + data.integrationRestrictMaximumPointPerImprovisation.present + ? data.integrationRestrictMaximumPointPerImprovisation.value + : this.integrationRestrictMaximumPointPerImprovisation, + integrationMinNumberOfImprovisations: + data.integrationMinNumberOfImprovisations.present + ? data.integrationMinNumberOfImprovisations.value + : this.integrationMinNumberOfImprovisations, + integrationMaxNumberOfImprovisations: + data.integrationMaxNumberOfImprovisations.present + ? data.integrationMaxNumberOfImprovisations.value + : this.integrationMaxNumberOfImprovisations, + integrationPenaltyTypes: data.integrationPenaltyTypes.present + ? data.integrationPenaltyTypes.value + : this.integrationPenaltyTypes, + ); + } + + @override + String toString() { + return (StringBuffer('MatchEntityData(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('createdDate: $createdDate, ') + ..write('modifiedDate: $modifiedDate, ') + ..write('tags: $tags, ') + ..write('teams: $teams, ') + ..write('improvisations: $improvisations, ') + ..write('penalties: $penalties, ') + ..write('points: $points, ') + ..write('stars: $stars, ') + ..write('enableStatistics: $enableStatistics, ') + ..write('enablePenaltiesImpactPoints: $enablePenaltiesImpactPoints, ') + ..write('penaltiesImpactType: $penaltiesImpactType, ') + ..write( + 'penaltiesRequiredToImpactPoints: $penaltiesRequiredToImpactPoints, ') + ..write('enableMatchExpulsion: $enableMatchExpulsion, ') + ..write('penaltiesRequiredToExpel: $penaltiesRequiredToExpel, ') + ..write('integrationId: $integrationId, ') + ..write('integrationEntityId: $integrationEntityId, ') + ..write('integrationAdditionalData: $integrationAdditionalData, ') + ..write( + 'integrationRestrictMaximumPointPerImprovisation: $integrationRestrictMaximumPointPerImprovisation, ') + ..write( + 'integrationMinNumberOfImprovisations: $integrationMinNumberOfImprovisations, ') + ..write( + 'integrationMaxNumberOfImprovisations: $integrationMaxNumberOfImprovisations, ') + ..write('integrationPenaltyTypes: $integrationPenaltyTypes') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hashAll([ + id, + name, + createdDate, + modifiedDate, + tags, + teams, + improvisations, + penalties, + points, + stars, + enableStatistics, + enablePenaltiesImpactPoints, + penaltiesImpactType, + penaltiesRequiredToImpactPoints, + enableMatchExpulsion, + penaltiesRequiredToExpel, + integrationId, + integrationEntityId, + integrationAdditionalData, + integrationRestrictMaximumPointPerImprovisation, + integrationMinNumberOfImprovisations, + integrationMaxNumberOfImprovisations, + integrationPenaltyTypes + ]); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MatchEntityData && + other.id == this.id && + other.name == this.name && + other.createdDate == this.createdDate && + other.modifiedDate == this.modifiedDate && + other.tags == this.tags && + other.teams == this.teams && + other.improvisations == this.improvisations && + other.penalties == this.penalties && + other.points == this.points && + other.stars == this.stars && + other.enableStatistics == this.enableStatistics && + other.enablePenaltiesImpactPoints == + this.enablePenaltiesImpactPoints && + other.penaltiesImpactType == this.penaltiesImpactType && + other.penaltiesRequiredToImpactPoints == + this.penaltiesRequiredToImpactPoints && + other.enableMatchExpulsion == this.enableMatchExpulsion && + other.penaltiesRequiredToExpel == this.penaltiesRequiredToExpel && + other.integrationId == this.integrationId && + other.integrationEntityId == this.integrationEntityId && + other.integrationAdditionalData == this.integrationAdditionalData && + other.integrationRestrictMaximumPointPerImprovisation == + this.integrationRestrictMaximumPointPerImprovisation && + other.integrationMinNumberOfImprovisations == + this.integrationMinNumberOfImprovisations && + other.integrationMaxNumberOfImprovisations == + this.integrationMaxNumberOfImprovisations && + other.integrationPenaltyTypes == this.integrationPenaltyTypes); +} + +class MatchEntityCompanion extends UpdateCompanion { + final Value id; + final Value name; + final Value createdDate; + final Value modifiedDate; + final Value> tags; + final Value teams; + final Value improvisations; + final Value penalties; + final Value points; + final Value stars; + final Value enableStatistics; + final Value enablePenaltiesImpactPoints; + final Value penaltiesImpactType; + final Value penaltiesRequiredToImpactPoints; + final Value enableMatchExpulsion; + final Value penaltiesRequiredToExpel; + final Value integrationId; + final Value integrationEntityId; + final Value integrationAdditionalData; + final Value integrationRestrictMaximumPointPerImprovisation; + final Value integrationMinNumberOfImprovisations; + final Value integrationMaxNumberOfImprovisations; + final Value?> integrationPenaltyTypes; + const MatchEntityCompanion({ + this.id = const Value.absent(), + this.name = const Value.absent(), + this.createdDate = const Value.absent(), + this.modifiedDate = const Value.absent(), + this.tags = const Value.absent(), + this.teams = const Value.absent(), + this.improvisations = const Value.absent(), + this.penalties = const Value.absent(), + this.points = const Value.absent(), + this.stars = const Value.absent(), + this.enableStatistics = const Value.absent(), + this.enablePenaltiesImpactPoints = const Value.absent(), + this.penaltiesImpactType = const Value.absent(), + this.penaltiesRequiredToImpactPoints = const Value.absent(), + this.enableMatchExpulsion = const Value.absent(), + this.penaltiesRequiredToExpel = const Value.absent(), + this.integrationId = const Value.absent(), + this.integrationEntityId = const Value.absent(), + this.integrationAdditionalData = const Value.absent(), + this.integrationRestrictMaximumPointPerImprovisation = const Value.absent(), + this.integrationMinNumberOfImprovisations = const Value.absent(), + this.integrationMaxNumberOfImprovisations = const Value.absent(), + this.integrationPenaltyTypes = const Value.absent(), + }); + MatchEntityCompanion.insert({ + this.id = const Value.absent(), + required String name, + this.createdDate = const Value.absent(), + this.modifiedDate = const Value.absent(), + required List tags, + required MatchTeamModel teams, + required MatchTeamModel improvisations, + required MatchTeamModel penalties, + required MatchTeamModel points, + required MatchTeamModel stars, + this.enableStatistics = const Value.absent(), + this.enablePenaltiesImpactPoints = const Value.absent(), + this.penaltiesImpactType = const Value.absent(), + this.penaltiesRequiredToImpactPoints = const Value.absent(), + this.enableMatchExpulsion = const Value.absent(), + this.penaltiesRequiredToExpel = const Value.absent(), + this.integrationId = const Value.absent(), + this.integrationEntityId = const Value.absent(), + this.integrationAdditionalData = const Value.absent(), + this.integrationRestrictMaximumPointPerImprovisation = const Value.absent(), + this.integrationMinNumberOfImprovisations = const Value.absent(), + this.integrationMaxNumberOfImprovisations = const Value.absent(), + this.integrationPenaltyTypes = const Value.absent(), + }) : name = Value(name), + tags = Value(tags), + teams = Value(teams), + improvisations = Value(improvisations), + penalties = Value(penalties), + points = Value(points), + stars = Value(stars); + static Insertable custom({ + Expression? id, + Expression? name, + Expression? createdDate, + Expression? modifiedDate, + Expression? tags, + Expression? teams, + Expression? improvisations, + Expression? penalties, + Expression? points, + Expression? stars, + Expression? enableStatistics, + Expression? enablePenaltiesImpactPoints, + Expression? penaltiesImpactType, + Expression? penaltiesRequiredToImpactPoints, + Expression? enableMatchExpulsion, + Expression? penaltiesRequiredToExpel, + Expression? integrationId, + Expression? integrationEntityId, + Expression? integrationAdditionalData, + Expression? integrationRestrictMaximumPointPerImprovisation, + Expression? integrationMinNumberOfImprovisations, + Expression? integrationMaxNumberOfImprovisations, + Expression? integrationPenaltyTypes, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (name != null) 'name': name, + if (createdDate != null) 'created_date': createdDate, + if (modifiedDate != null) 'modified_date': modifiedDate, + if (tags != null) 'tags': tags, + if (teams != null) 'teams': teams, + if (improvisations != null) 'improvisations': improvisations, + if (penalties != null) 'penalties': penalties, + if (points != null) 'points': points, + if (stars != null) 'stars': stars, + if (enableStatistics != null) 'enable_statistics': enableStatistics, + if (enablePenaltiesImpactPoints != null) + 'enable_penalties_impact_points': enablePenaltiesImpactPoints, + if (penaltiesImpactType != null) + 'penalties_impact_type': penaltiesImpactType, + if (penaltiesRequiredToImpactPoints != null) + 'penalties_required_to_impact_points': penaltiesRequiredToImpactPoints, + if (enableMatchExpulsion != null) + 'enable_match_expulsion': enableMatchExpulsion, + if (penaltiesRequiredToExpel != null) + 'penalties_required_to_expel': penaltiesRequiredToExpel, + if (integrationId != null) 'integration_id': integrationId, + if (integrationEntityId != null) + 'integration_entity_id': integrationEntityId, + if (integrationAdditionalData != null) + 'integration_additional_data': integrationAdditionalData, + if (integrationRestrictMaximumPointPerImprovisation != null) + 'integration_restrict_maximum_point_per_improvisation': + integrationRestrictMaximumPointPerImprovisation, + if (integrationMinNumberOfImprovisations != null) + 'integration_min_number_of_improvisations': + integrationMinNumberOfImprovisations, + if (integrationMaxNumberOfImprovisations != null) + 'integration_max_number_of_improvisations': + integrationMaxNumberOfImprovisations, + if (integrationPenaltyTypes != null) + 'integration_penalty_types': integrationPenaltyTypes, + }); + } + + MatchEntityCompanion copyWith( + {Value? id, + Value? name, + Value? createdDate, + Value? modifiedDate, + Value>? tags, + Value? teams, + Value? improvisations, + Value? penalties, + Value? points, + Value? stars, + Value? enableStatistics, + Value? enablePenaltiesImpactPoints, + Value? penaltiesImpactType, + Value? penaltiesRequiredToImpactPoints, + Value? enableMatchExpulsion, + Value? penaltiesRequiredToExpel, + Value? integrationId, + Value? integrationEntityId, + Value? integrationAdditionalData, + Value? integrationRestrictMaximumPointPerImprovisation, + Value? integrationMinNumberOfImprovisations, + Value? integrationMaxNumberOfImprovisations, + Value?>? integrationPenaltyTypes}) { + return MatchEntityCompanion( + id: id ?? this.id, + name: name ?? this.name, + createdDate: createdDate ?? this.createdDate, + modifiedDate: modifiedDate ?? this.modifiedDate, + tags: tags ?? this.tags, + teams: teams ?? this.teams, + improvisations: improvisations ?? this.improvisations, + penalties: penalties ?? this.penalties, + points: points ?? this.points, + stars: stars ?? this.stars, + enableStatistics: enableStatistics ?? this.enableStatistics, + enablePenaltiesImpactPoints: + enablePenaltiesImpactPoints ?? this.enablePenaltiesImpactPoints, + penaltiesImpactType: penaltiesImpactType ?? this.penaltiesImpactType, + penaltiesRequiredToImpactPoints: penaltiesRequiredToImpactPoints ?? + this.penaltiesRequiredToImpactPoints, + enableMatchExpulsion: enableMatchExpulsion ?? this.enableMatchExpulsion, + penaltiesRequiredToExpel: + penaltiesRequiredToExpel ?? this.penaltiesRequiredToExpel, + integrationId: integrationId ?? this.integrationId, + integrationEntityId: integrationEntityId ?? this.integrationEntityId, + integrationAdditionalData: + integrationAdditionalData ?? this.integrationAdditionalData, + integrationRestrictMaximumPointPerImprovisation: + integrationRestrictMaximumPointPerImprovisation ?? + this.integrationRestrictMaximumPointPerImprovisation, + integrationMinNumberOfImprovisations: + integrationMinNumberOfImprovisations ?? + this.integrationMinNumberOfImprovisations, + integrationMaxNumberOfImprovisations: + integrationMaxNumberOfImprovisations ?? + this.integrationMaxNumberOfImprovisations, + integrationPenaltyTypes: + integrationPenaltyTypes ?? this.integrationPenaltyTypes, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (name.present) { + map['name'] = Variable(name.value); + } + if (createdDate.present) { + map['created_date'] = Variable(createdDate.value); + } + if (modifiedDate.present) { + map['modified_date'] = Variable(modifiedDate.value); + } + if (tags.present) { + map['tags'] = + Variable($MatchEntityTable.$convertertags.toSql(tags.value)); + } + if (teams.present) { + map['teams'] = Variable( + $MatchEntityTable.$converterteams.toSql(teams.value)); + } + if (improvisations.present) { + map['improvisations'] = Variable($MatchEntityTable + .$converterimprovisations + .toSql(improvisations.value)); + } + if (penalties.present) { + map['penalties'] = Variable( + $MatchEntityTable.$converterpenalties.toSql(penalties.value)); + } + if (points.present) { + map['points'] = Variable( + $MatchEntityTable.$converterpoints.toSql(points.value)); + } + if (stars.present) { + map['stars'] = Variable( + $MatchEntityTable.$converterstars.toSql(stars.value)); + } + if (enableStatistics.present) { + map['enable_statistics'] = Variable(enableStatistics.value); + } + if (enablePenaltiesImpactPoints.present) { + map['enable_penalties_impact_points'] = + Variable(enablePenaltiesImpactPoints.value); + } + if (penaltiesImpactType.present) { + map['penalties_impact_type'] = Variable($MatchEntityTable + .$converterpenaltiesImpactType + .toSql(penaltiesImpactType.value)); + } + if (penaltiesRequiredToImpactPoints.present) { + map['penalties_required_to_impact_points'] = + Variable(penaltiesRequiredToImpactPoints.value); + } + if (enableMatchExpulsion.present) { + map['enable_match_expulsion'] = + Variable(enableMatchExpulsion.value); + } + if (penaltiesRequiredToExpel.present) { + map['penalties_required_to_expel'] = + Variable(penaltiesRequiredToExpel.value); + } + if (integrationId.present) { + map['integration_id'] = Variable(integrationId.value); + } + if (integrationEntityId.present) { + map['integration_entity_id'] = + Variable(integrationEntityId.value); + } + if (integrationAdditionalData.present) { + map['integration_additional_data'] = + Variable(integrationAdditionalData.value); + } + if (integrationRestrictMaximumPointPerImprovisation.present) { + map['integration_restrict_maximum_point_per_improvisation'] = + Variable(integrationRestrictMaximumPointPerImprovisation.value); + } + if (integrationMinNumberOfImprovisations.present) { + map['integration_min_number_of_improvisations'] = + Variable(integrationMinNumberOfImprovisations.value); + } + if (integrationMaxNumberOfImprovisations.present) { + map['integration_max_number_of_improvisations'] = + Variable(integrationMaxNumberOfImprovisations.value); + } + if (integrationPenaltyTypes.present) { + map['integration_penalty_types'] = Variable($MatchEntityTable + .$converterintegrationPenaltyTypesn + .toSql(integrationPenaltyTypes.value)); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MatchEntityCompanion(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('createdDate: $createdDate, ') + ..write('modifiedDate: $modifiedDate, ') + ..write('tags: $tags, ') + ..write('teams: $teams, ') + ..write('improvisations: $improvisations, ') + ..write('penalties: $penalties, ') + ..write('points: $points, ') + ..write('stars: $stars, ') + ..write('enableStatistics: $enableStatistics, ') + ..write('enablePenaltiesImpactPoints: $enablePenaltiesImpactPoints, ') + ..write('penaltiesImpactType: $penaltiesImpactType, ') + ..write( + 'penaltiesRequiredToImpactPoints: $penaltiesRequiredToImpactPoints, ') + ..write('enableMatchExpulsion: $enableMatchExpulsion, ') + ..write('penaltiesRequiredToExpel: $penaltiesRequiredToExpel, ') + ..write('integrationId: $integrationId, ') + ..write('integrationEntityId: $integrationEntityId, ') + ..write('integrationAdditionalData: $integrationAdditionalData, ') + ..write( + 'integrationRestrictMaximumPointPerImprovisation: $integrationRestrictMaximumPointPerImprovisation, ') + ..write( + 'integrationMinNumberOfImprovisations: $integrationMinNumberOfImprovisations, ') + ..write( + 'integrationMaxNumberOfImprovisations: $integrationMaxNumberOfImprovisations, ') + ..write('integrationPenaltyTypes: $integrationPenaltyTypes') + ..write(')')) + .toString(); + } +} + +class $TeamEntityTable extends TeamEntity + with TableInfo<$TeamEntityTable, TeamEntityData> { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + $TeamEntityTable(this.attachedDatabase, [this._alias]); + static const VerificationMeta _idMeta = const VerificationMeta('id'); + @override + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + static const VerificationMeta _nameMeta = const VerificationMeta('name'); + @override + late final GeneratedColumn name = GeneratedColumn( + 'name', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + static const VerificationMeta _createdDateMeta = + const VerificationMeta('createdDate'); + @override + late final GeneratedColumn createdDate = GeneratedColumn( + 'created_date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + static const VerificationMeta _modifiedDateMeta = + const VerificationMeta('modifiedDate'); + @override + late final GeneratedColumn modifiedDate = GeneratedColumn( + 'modified_date', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + static const VerificationMeta _colorMeta = const VerificationMeta('color'); + @override + late final GeneratedColumn color = GeneratedColumn( + 'color', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + static const VerificationMeta _performersMeta = + const VerificationMeta('performers'); + @override + late final GeneratedColumnWithTypeConverter + performers = GeneratedColumn('performers', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true) + .withConverter($TeamEntityTable.$converterperformers); + static const VerificationMeta _tagsMeta = const VerificationMeta('tags'); + @override + late final GeneratedColumnWithTypeConverter, String> tags = + GeneratedColumn('tags', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true) + .withConverter>($TeamEntityTable.$convertertags); + @override + List get $columns => + [id, name, createdDate, modifiedDate, color, performers, tags]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'team_entity'; + @override + VerificationContext validateIntegrity(Insertable instance, + {bool isInserting = false}) { + final context = VerificationContext(); + final data = instance.toColumns(true); + if (data.containsKey('id')) { + context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); + } + if (data.containsKey('name')) { + context.handle( + _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); + } else if (isInserting) { + context.missing(_nameMeta); + } + if (data.containsKey('created_date')) { + context.handle( + _createdDateMeta, + createdDate.isAcceptableOrUnknown( + data['created_date']!, _createdDateMeta)); + } + if (data.containsKey('modified_date')) { + context.handle( + _modifiedDateMeta, + modifiedDate.isAcceptableOrUnknown( + data['modified_date']!, _modifiedDateMeta)); + } + if (data.containsKey('color')) { + context.handle( + _colorMeta, color.isAcceptableOrUnknown(data['color']!, _colorMeta)); + } else if (isInserting) { + context.missing(_colorMeta); + } + context.handle(_performersMeta, const VerificationResult.success()); + context.handle(_tagsMeta, const VerificationResult.success()); + return context; + } + + @override + Set get $primaryKey => {id}; + @override + TeamEntityData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return TeamEntityData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + name: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}name'])!, + createdDate: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_date']), + modifiedDate: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}modified_date']), + color: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}color'])!, + performers: $TeamEntityTable.$converterperformers.fromSql(attachedDatabase + .typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}performers'])!), + tags: $TeamEntityTable.$convertertags.fromSql(attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tags'])!), + ); + } + + @override + $TeamEntityTable createAlias(String alias) { + return $TeamEntityTable(attachedDatabase, alias); + } + + static JsonTypeConverter2 + $converterperformers = PerformerModel.converter; + static JsonTypeConverter2, String, String> $convertertags = + const TagsConverter(); +} + +class TeamEntityData extends DataClass implements Insertable { + final int id; + final String name; + final DateTime? createdDate; + final DateTime? modifiedDate; + final int color; + final PerformerModel performers; + final List tags; + const TeamEntityData( + {required this.id, + required this.name, + this.createdDate, + this.modifiedDate, + required this.color, + required this.performers, + required this.tags}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['name'] = Variable(name); + if (!nullToAbsent || createdDate != null) { + map['created_date'] = Variable(createdDate); + } + if (!nullToAbsent || modifiedDate != null) { + map['modified_date'] = Variable(modifiedDate); + } + map['color'] = Variable(color); + { + map['performers'] = Variable( + $TeamEntityTable.$converterperformers.toSql(performers)); + } + { + map['tags'] = + Variable($TeamEntityTable.$convertertags.toSql(tags)); + } + return map; + } + + TeamEntityCompanion toCompanion(bool nullToAbsent) { + return TeamEntityCompanion( + id: Value(id), + name: Value(name), + createdDate: createdDate == null && nullToAbsent + ? const Value.absent() + : Value(createdDate), + modifiedDate: modifiedDate == null && nullToAbsent + ? const Value.absent() + : Value(modifiedDate), + color: Value(color), + performers: Value(performers), + tags: Value(tags), + ); + } + + factory TeamEntityData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return TeamEntityData( + id: serializer.fromJson(json['id']), + name: serializer.fromJson(json['name']), + createdDate: serializer.fromJson(json['createdDate']), + modifiedDate: serializer.fromJson(json['modifiedDate']), + color: serializer.fromJson(json['color']), + performers: $TeamEntityTable.$converterperformers + .fromJson(serializer.fromJson(json['performers'])), + tags: $TeamEntityTable.$convertertags + .fromJson(serializer.fromJson(json['tags'])), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'name': serializer.toJson(name), + 'createdDate': serializer.toJson(createdDate), + 'modifiedDate': serializer.toJson(modifiedDate), + 'color': serializer.toJson(color), + 'performers': serializer.toJson( + $TeamEntityTable.$converterperformers.toJson(performers)), + 'tags': serializer + .toJson($TeamEntityTable.$convertertags.toJson(tags)), + }; + } + + TeamEntityData copyWith( + {int? id, + String? name, + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), + int? color, + PerformerModel? performers, + List? tags}) => + TeamEntityData( + id: id ?? this.id, + name: name ?? this.name, + createdDate: createdDate.present ? createdDate.value : this.createdDate, + modifiedDate: + modifiedDate.present ? modifiedDate.value : this.modifiedDate, + color: color ?? this.color, + performers: performers ?? this.performers, + tags: tags ?? this.tags, + ); + TeamEntityData copyWithCompanion(TeamEntityCompanion data) { + return TeamEntityData( + id: data.id.present ? data.id.value : this.id, + name: data.name.present ? data.name.value : this.name, + createdDate: + data.createdDate.present ? data.createdDate.value : this.createdDate, + modifiedDate: data.modifiedDate.present + ? data.modifiedDate.value + : this.modifiedDate, + color: data.color.present ? data.color.value : this.color, + performers: + data.performers.present ? data.performers.value : this.performers, + tags: data.tags.present ? data.tags.value : this.tags, + ); + } + + @override + String toString() { + return (StringBuffer('TeamEntityData(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('createdDate: $createdDate, ') + ..write('modifiedDate: $modifiedDate, ') + ..write('color: $color, ') + ..write('performers: $performers, ') + ..write('tags: $tags') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, name, createdDate, modifiedDate, color, performers, tags); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is TeamEntityData && + other.id == this.id && + other.name == this.name && + other.createdDate == this.createdDate && + other.modifiedDate == this.modifiedDate && + other.color == this.color && + other.performers == this.performers && + other.tags == this.tags); +} + +class TeamEntityCompanion extends UpdateCompanion { + final Value id; + final Value name; + final Value createdDate; + final Value modifiedDate; + final Value color; + final Value performers; + final Value> tags; + const TeamEntityCompanion({ + this.id = const Value.absent(), + this.name = const Value.absent(), + this.createdDate = const Value.absent(), + this.modifiedDate = const Value.absent(), + this.color = const Value.absent(), + this.performers = const Value.absent(), + this.tags = const Value.absent(), + }); + TeamEntityCompanion.insert({ + this.id = const Value.absent(), + required String name, + this.createdDate = const Value.absent(), + this.modifiedDate = const Value.absent(), + required int color, + required PerformerModel performers, + required List tags, + }) : name = Value(name), + color = Value(color), + performers = Value(performers), + tags = Value(tags); + static Insertable custom({ + Expression? id, + Expression? name, + Expression? createdDate, + Expression? modifiedDate, + Expression? color, + Expression? performers, + Expression? tags, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (name != null) 'name': name, + if (createdDate != null) 'created_date': createdDate, + if (modifiedDate != null) 'modified_date': modifiedDate, + if (color != null) 'color': color, + if (performers != null) 'performers': performers, + if (tags != null) 'tags': tags, + }); + } + + TeamEntityCompanion copyWith( + {Value? id, + Value? name, + Value? createdDate, + Value? modifiedDate, + Value? color, + Value? performers, + Value>? tags}) { + return TeamEntityCompanion( + id: id ?? this.id, + name: name ?? this.name, + createdDate: createdDate ?? this.createdDate, + modifiedDate: modifiedDate ?? this.modifiedDate, + color: color ?? this.color, + performers: performers ?? this.performers, + tags: tags ?? this.tags, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (name.present) { + map['name'] = Variable(name.value); + } + if (createdDate.present) { + map['created_date'] = Variable(createdDate.value); + } + if (modifiedDate.present) { + map['modified_date'] = Variable(modifiedDate.value); + } + if (color.present) { + map['color'] = Variable(color.value); + } + if (performers.present) { + map['performers'] = Variable( + $TeamEntityTable.$converterperformers.toSql(performers.value)); + } + if (tags.present) { + map['tags'] = + Variable($TeamEntityTable.$convertertags.toSql(tags.value)); + } + return map; + } + + @override + String toString() { + return (StringBuffer('TeamEntityCompanion(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('createdDate: $createdDate, ') + ..write('modifiedDate: $modifiedDate, ') + ..write('color: $color, ') + ..write('performers: $performers, ') + ..write('tags: $tags') + ..write(')')) + .toString(); + } +} + +abstract class _$AppDatabase extends GeneratedDatabase { + _$AppDatabase(QueryExecutor e) : super(e); + $AppDatabaseManager get managers => $AppDatabaseManager(this); + late final $PacingEntityTable pacingEntity = $PacingEntityTable(this); + late final $MatchEntityTable matchEntity = $MatchEntityTable(this); + late final $TeamEntityTable teamEntity = $TeamEntityTable(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => + [pacingEntity, matchEntity, teamEntity]; +} + +typedef $$PacingEntityTableCreateCompanionBuilder = PacingEntityCompanion + Function({ + Value id, + required String name, + Value createdDate, + Value modifiedDate, + required List tags, + required ImprovisationModel improvisations, + Value defaultNumberOfTeams, + Value integrationId, + Value integrationEntityId, + Value integrationAdditionalData, +}); +typedef $$PacingEntityTableUpdateCompanionBuilder = PacingEntityCompanion + Function({ + Value id, + Value name, + Value createdDate, + Value modifiedDate, + Value> tags, + Value improvisations, + Value defaultNumberOfTeams, + Value integrationId, + Value integrationEntityId, + Value integrationAdditionalData, +}); + +class $$PacingEntityTableFilterComposer + extends Composer<_$AppDatabase, $PacingEntityTable> { + $$PacingEntityTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnFilters(column)); + + ColumnFilters get name => $composableBuilder( + column: $table.name, builder: (column) => ColumnFilters(column)); + + ColumnFilters get createdDate => $composableBuilder( + column: $table.createdDate, builder: (column) => ColumnFilters(column)); + + ColumnFilters get modifiedDate => $composableBuilder( + column: $table.modifiedDate, builder: (column) => ColumnFilters(column)); + + ColumnWithTypeConverterFilters, List, String> get tags => + $composableBuilder( + column: $table.tags, + builder: (column) => ColumnWithTypeConverterFilters(column)); + + ColumnWithTypeConverterFilters + get improvisations => $composableBuilder( + column: $table.improvisations, + builder: (column) => ColumnWithTypeConverterFilters(column)); + + ColumnFilters get defaultNumberOfTeams => $composableBuilder( + column: $table.defaultNumberOfTeams, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get integrationId => $composableBuilder( + column: $table.integrationId, builder: (column) => ColumnFilters(column)); + + ColumnFilters get integrationEntityId => $composableBuilder( + column: $table.integrationEntityId, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get integrationAdditionalData => $composableBuilder( + column: $table.integrationAdditionalData, + builder: (column) => ColumnFilters(column)); +} + +class $$PacingEntityTableOrderingComposer + extends Composer<_$AppDatabase, $PacingEntityTable> { + $$PacingEntityTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get name => $composableBuilder( + column: $table.name, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get createdDate => $composableBuilder( + column: $table.createdDate, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get modifiedDate => $composableBuilder( + column: $table.modifiedDate, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get tags => $composableBuilder( + column: $table.tags, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get improvisations => $composableBuilder( + column: $table.improvisations, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get defaultNumberOfTeams => $composableBuilder( + column: $table.defaultNumberOfTeams, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get integrationId => $composableBuilder( + column: $table.integrationId, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get integrationEntityId => $composableBuilder( + column: $table.integrationEntityId, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get integrationAdditionalData => $composableBuilder( + column: $table.integrationAdditionalData, + builder: (column) => ColumnOrderings(column)); +} + +class $$PacingEntityTableAnnotationComposer + extends Composer<_$AppDatabase, $PacingEntityTable> { + $$PacingEntityTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get name => + $composableBuilder(column: $table.name, builder: (column) => column); + + GeneratedColumn get createdDate => $composableBuilder( + column: $table.createdDate, builder: (column) => column); + + GeneratedColumn get modifiedDate => $composableBuilder( + column: $table.modifiedDate, builder: (column) => column); + + GeneratedColumnWithTypeConverter, String> get tags => + $composableBuilder(column: $table.tags, builder: (column) => column); + + GeneratedColumnWithTypeConverter + get improvisations => $composableBuilder( + column: $table.improvisations, builder: (column) => column); + + GeneratedColumn get defaultNumberOfTeams => $composableBuilder( + column: $table.defaultNumberOfTeams, builder: (column) => column); + + GeneratedColumn get integrationId => $composableBuilder( + column: $table.integrationId, builder: (column) => column); + + GeneratedColumn get integrationEntityId => $composableBuilder( + column: $table.integrationEntityId, builder: (column) => column); + + GeneratedColumn get integrationAdditionalData => $composableBuilder( + column: $table.integrationAdditionalData, builder: (column) => column); +} + +class $$PacingEntityTableTableManager extends RootTableManager< + _$AppDatabase, + $PacingEntityTable, + PacingEntityData, + $$PacingEntityTableFilterComposer, + $$PacingEntityTableOrderingComposer, + $$PacingEntityTableAnnotationComposer, + $$PacingEntityTableCreateCompanionBuilder, + $$PacingEntityTableUpdateCompanionBuilder, + ( + PacingEntityData, + BaseReferences<_$AppDatabase, $PacingEntityTable, PacingEntityData> + ), + PacingEntityData, + PrefetchHooks Function()> { + $$PacingEntityTableTableManager(_$AppDatabase db, $PacingEntityTable table) + : super(TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$PacingEntityTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$PacingEntityTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$PacingEntityTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value name = const Value.absent(), + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), + Value> tags = const Value.absent(), + Value improvisations = const Value.absent(), + Value defaultNumberOfTeams = const Value.absent(), + Value integrationId = const Value.absent(), + Value integrationEntityId = const Value.absent(), + Value integrationAdditionalData = const Value.absent(), + }) => + PacingEntityCompanion( + id: id, + name: name, + createdDate: createdDate, + modifiedDate: modifiedDate, + tags: tags, + improvisations: improvisations, + defaultNumberOfTeams: defaultNumberOfTeams, + integrationId: integrationId, + integrationEntityId: integrationEntityId, + integrationAdditionalData: integrationAdditionalData, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required String name, + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), + required List tags, + required ImprovisationModel improvisations, + Value defaultNumberOfTeams = const Value.absent(), + Value integrationId = const Value.absent(), + Value integrationEntityId = const Value.absent(), + Value integrationAdditionalData = const Value.absent(), + }) => + PacingEntityCompanion.insert( + id: id, + name: name, + createdDate: createdDate, + modifiedDate: modifiedDate, + tags: tags, + improvisations: improvisations, + defaultNumberOfTeams: defaultNumberOfTeams, + integrationId: integrationId, + integrationEntityId: integrationEntityId, + integrationAdditionalData: integrationAdditionalData, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$PacingEntityTableProcessedTableManager = ProcessedTableManager< + _$AppDatabase, + $PacingEntityTable, + PacingEntityData, + $$PacingEntityTableFilterComposer, + $$PacingEntityTableOrderingComposer, + $$PacingEntityTableAnnotationComposer, + $$PacingEntityTableCreateCompanionBuilder, + $$PacingEntityTableUpdateCompanionBuilder, + ( + PacingEntityData, + BaseReferences<_$AppDatabase, $PacingEntityTable, PacingEntityData> + ), + PacingEntityData, + PrefetchHooks Function()>; +typedef $$MatchEntityTableCreateCompanionBuilder = MatchEntityCompanion + Function({ + Value id, + required String name, + Value createdDate, + Value modifiedDate, + required List tags, + required MatchTeamModel teams, + required MatchTeamModel improvisations, + required MatchTeamModel penalties, + required MatchTeamModel points, + required MatchTeamModel stars, + Value enableStatistics, + Value enablePenaltiesImpactPoints, + Value penaltiesImpactType, + Value penaltiesRequiredToImpactPoints, + Value enableMatchExpulsion, + Value penaltiesRequiredToExpel, + Value integrationId, + Value integrationEntityId, + Value integrationAdditionalData, + Value integrationRestrictMaximumPointPerImprovisation, + Value integrationMinNumberOfImprovisations, + Value integrationMaxNumberOfImprovisations, + Value?> integrationPenaltyTypes, +}); +typedef $$MatchEntityTableUpdateCompanionBuilder = MatchEntityCompanion + Function({ + Value id, + Value name, + Value createdDate, + Value modifiedDate, + Value> tags, + Value teams, + Value improvisations, + Value penalties, + Value points, + Value stars, + Value enableStatistics, + Value enablePenaltiesImpactPoints, + Value penaltiesImpactType, + Value penaltiesRequiredToImpactPoints, + Value enableMatchExpulsion, + Value penaltiesRequiredToExpel, + Value integrationId, + Value integrationEntityId, + Value integrationAdditionalData, + Value integrationRestrictMaximumPointPerImprovisation, + Value integrationMinNumberOfImprovisations, + Value integrationMaxNumberOfImprovisations, + Value?> integrationPenaltyTypes, +}); + +class $$MatchEntityTableFilterComposer + extends Composer<_$AppDatabase, $MatchEntityTable> { + $$MatchEntityTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnFilters(column)); + + ColumnFilters get name => $composableBuilder( + column: $table.name, builder: (column) => ColumnFilters(column)); + + ColumnFilters get createdDate => $composableBuilder( + column: $table.createdDate, builder: (column) => ColumnFilters(column)); + + ColumnFilters get modifiedDate => $composableBuilder( + column: $table.modifiedDate, builder: (column) => ColumnFilters(column)); + + ColumnWithTypeConverterFilters, List, String> get tags => + $composableBuilder( + column: $table.tags, + builder: (column) => ColumnWithTypeConverterFilters(column)); + + ColumnWithTypeConverterFilters + get teams => $composableBuilder( + column: $table.teams, + builder: (column) => ColumnWithTypeConverterFilters(column)); + + ColumnWithTypeConverterFilters + get improvisations => $composableBuilder( + column: $table.improvisations, + builder: (column) => ColumnWithTypeConverterFilters(column)); + + ColumnWithTypeConverterFilters + get penalties => $composableBuilder( + column: $table.penalties, + builder: (column) => ColumnWithTypeConverterFilters(column)); + + ColumnWithTypeConverterFilters + get points => $composableBuilder( + column: $table.points, + builder: (column) => ColumnWithTypeConverterFilters(column)); + + ColumnWithTypeConverterFilters + get stars => $composableBuilder( + column: $table.stars, + builder: (column) => ColumnWithTypeConverterFilters(column)); + + ColumnFilters get enableStatistics => $composableBuilder( + column: $table.enableStatistics, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get enablePenaltiesImpactPoints => $composableBuilder( + column: $table.enablePenaltiesImpactPoints, + builder: (column) => ColumnFilters(column)); + + ColumnWithTypeConverterFilters + get penaltiesImpactType => $composableBuilder( + column: $table.penaltiesImpactType, + builder: (column) => ColumnWithTypeConverterFilters(column)); + + ColumnFilters get penaltiesRequiredToImpactPoints => $composableBuilder( + column: $table.penaltiesRequiredToImpactPoints, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get enableMatchExpulsion => $composableBuilder( + column: $table.enableMatchExpulsion, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get penaltiesRequiredToExpel => $composableBuilder( + column: $table.penaltiesRequiredToExpel, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get integrationId => $composableBuilder( + column: $table.integrationId, builder: (column) => ColumnFilters(column)); + + ColumnFilters get integrationEntityId => $composableBuilder( + column: $table.integrationEntityId, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get integrationAdditionalData => $composableBuilder( + column: $table.integrationAdditionalData, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get integrationRestrictMaximumPointPerImprovisation => + $composableBuilder( + column: $table.integrationRestrictMaximumPointPerImprovisation, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get integrationMinNumberOfImprovisations => + $composableBuilder( + column: $table.integrationMinNumberOfImprovisations, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get integrationMaxNumberOfImprovisations => + $composableBuilder( + column: $table.integrationMaxNumberOfImprovisations, + builder: (column) => ColumnFilters(column)); + + ColumnWithTypeConverterFilters?, List, String> + get integrationPenaltyTypes => $composableBuilder( + column: $table.integrationPenaltyTypes, + builder: (column) => ColumnWithTypeConverterFilters(column)); +} + +class $$MatchEntityTableOrderingComposer + extends Composer<_$AppDatabase, $MatchEntityTable> { + $$MatchEntityTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get name => $composableBuilder( + column: $table.name, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get createdDate => $composableBuilder( + column: $table.createdDate, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get modifiedDate => $composableBuilder( + column: $table.modifiedDate, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get tags => $composableBuilder( + column: $table.tags, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get teams => $composableBuilder( + column: $table.teams, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get improvisations => $composableBuilder( + column: $table.improvisations, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get penalties => $composableBuilder( + column: $table.penalties, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get points => $composableBuilder( + column: $table.points, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get stars => $composableBuilder( + column: $table.stars, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get enableStatistics => $composableBuilder( + column: $table.enableStatistics, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get enablePenaltiesImpactPoints => $composableBuilder( + column: $table.enablePenaltiesImpactPoints, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get penaltiesImpactType => $composableBuilder( + column: $table.penaltiesImpactType, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get penaltiesRequiredToImpactPoints => + $composableBuilder( + column: $table.penaltiesRequiredToImpactPoints, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get enableMatchExpulsion => $composableBuilder( + column: $table.enableMatchExpulsion, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get penaltiesRequiredToExpel => $composableBuilder( + column: $table.penaltiesRequiredToExpel, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get integrationId => $composableBuilder( + column: $table.integrationId, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get integrationEntityId => $composableBuilder( + column: $table.integrationEntityId, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get integrationAdditionalData => $composableBuilder( + column: $table.integrationAdditionalData, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get integrationRestrictMaximumPointPerImprovisation => + $composableBuilder( + column: $table.integrationRestrictMaximumPointPerImprovisation, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get integrationMinNumberOfImprovisations => + $composableBuilder( + column: $table.integrationMinNumberOfImprovisations, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get integrationMaxNumberOfImprovisations => + $composableBuilder( + column: $table.integrationMaxNumberOfImprovisations, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get integrationPenaltyTypes => $composableBuilder( + column: $table.integrationPenaltyTypes, + builder: (column) => ColumnOrderings(column)); +} + +class $$MatchEntityTableAnnotationComposer + extends Composer<_$AppDatabase, $MatchEntityTable> { + $$MatchEntityTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get name => + $composableBuilder(column: $table.name, builder: (column) => column); + + GeneratedColumn get createdDate => $composableBuilder( + column: $table.createdDate, builder: (column) => column); + + GeneratedColumn get modifiedDate => $composableBuilder( + column: $table.modifiedDate, builder: (column) => column); + + GeneratedColumnWithTypeConverter, String> get tags => + $composableBuilder(column: $table.tags, builder: (column) => column); + + GeneratedColumnWithTypeConverter get teams => + $composableBuilder(column: $table.teams, builder: (column) => column); + + GeneratedColumnWithTypeConverter get improvisations => + $composableBuilder( + column: $table.improvisations, builder: (column) => column); + + GeneratedColumnWithTypeConverter get penalties => + $composableBuilder(column: $table.penalties, builder: (column) => column); + + GeneratedColumnWithTypeConverter get points => + $composableBuilder(column: $table.points, builder: (column) => column); + + GeneratedColumnWithTypeConverter get stars => + $composableBuilder(column: $table.stars, builder: (column) => column); + + GeneratedColumn get enableStatistics => $composableBuilder( + column: $table.enableStatistics, builder: (column) => column); + + GeneratedColumn get enablePenaltiesImpactPoints => $composableBuilder( + column: $table.enablePenaltiesImpactPoints, builder: (column) => column); + + GeneratedColumnWithTypeConverter + get penaltiesImpactType => $composableBuilder( + column: $table.penaltiesImpactType, builder: (column) => column); + + GeneratedColumn get penaltiesRequiredToImpactPoints => + $composableBuilder( + column: $table.penaltiesRequiredToImpactPoints, + builder: (column) => column); + + GeneratedColumn get enableMatchExpulsion => $composableBuilder( + column: $table.enableMatchExpulsion, builder: (column) => column); + + GeneratedColumn get penaltiesRequiredToExpel => $composableBuilder( + column: $table.penaltiesRequiredToExpel, builder: (column) => column); + + GeneratedColumn get integrationId => $composableBuilder( + column: $table.integrationId, builder: (column) => column); + + GeneratedColumn get integrationEntityId => $composableBuilder( + column: $table.integrationEntityId, builder: (column) => column); + + GeneratedColumn get integrationAdditionalData => $composableBuilder( + column: $table.integrationAdditionalData, builder: (column) => column); + + GeneratedColumn get integrationRestrictMaximumPointPerImprovisation => + $composableBuilder( + column: $table.integrationRestrictMaximumPointPerImprovisation, + builder: (column) => column); + + GeneratedColumn get integrationMinNumberOfImprovisations => + $composableBuilder( + column: $table.integrationMinNumberOfImprovisations, + builder: (column) => column); + + GeneratedColumn get integrationMaxNumberOfImprovisations => + $composableBuilder( + column: $table.integrationMaxNumberOfImprovisations, + builder: (column) => column); + + GeneratedColumnWithTypeConverter?, String> + get integrationPenaltyTypes => $composableBuilder( + column: $table.integrationPenaltyTypes, builder: (column) => column); +} + +class $$MatchEntityTableTableManager extends RootTableManager< + _$AppDatabase, + $MatchEntityTable, + MatchEntityData, + $$MatchEntityTableFilterComposer, + $$MatchEntityTableOrderingComposer, + $$MatchEntityTableAnnotationComposer, + $$MatchEntityTableCreateCompanionBuilder, + $$MatchEntityTableUpdateCompanionBuilder, + ( + MatchEntityData, + BaseReferences<_$AppDatabase, $MatchEntityTable, MatchEntityData> + ), + MatchEntityData, + PrefetchHooks Function()> { + $$MatchEntityTableTableManager(_$AppDatabase db, $MatchEntityTable table) + : super(TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$MatchEntityTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$MatchEntityTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$MatchEntityTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value name = const Value.absent(), + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), + Value> tags = const Value.absent(), + Value teams = const Value.absent(), + Value improvisations = const Value.absent(), + Value penalties = const Value.absent(), + Value points = const Value.absent(), + Value stars = const Value.absent(), + Value enableStatistics = const Value.absent(), + Value enablePenaltiesImpactPoints = const Value.absent(), + Value penaltiesImpactType = + const Value.absent(), + Value penaltiesRequiredToImpactPoints = const Value.absent(), + Value enableMatchExpulsion = const Value.absent(), + Value penaltiesRequiredToExpel = const Value.absent(), + Value integrationId = const Value.absent(), + Value integrationEntityId = const Value.absent(), + Value integrationAdditionalData = const Value.absent(), + Value integrationRestrictMaximumPointPerImprovisation = + const Value.absent(), + Value integrationMinNumberOfImprovisations = + const Value.absent(), + Value integrationMaxNumberOfImprovisations = + const Value.absent(), + Value?> integrationPenaltyTypes = const Value.absent(), + }) => + MatchEntityCompanion( + id: id, + name: name, + createdDate: createdDate, + modifiedDate: modifiedDate, + tags: tags, + teams: teams, + improvisations: improvisations, + penalties: penalties, + points: points, + stars: stars, + enableStatistics: enableStatistics, + enablePenaltiesImpactPoints: enablePenaltiesImpactPoints, + penaltiesImpactType: penaltiesImpactType, + penaltiesRequiredToImpactPoints: penaltiesRequiredToImpactPoints, + enableMatchExpulsion: enableMatchExpulsion, + penaltiesRequiredToExpel: penaltiesRequiredToExpel, + integrationId: integrationId, + integrationEntityId: integrationEntityId, + integrationAdditionalData: integrationAdditionalData, + integrationRestrictMaximumPointPerImprovisation: + integrationRestrictMaximumPointPerImprovisation, + integrationMinNumberOfImprovisations: + integrationMinNumberOfImprovisations, + integrationMaxNumberOfImprovisations: + integrationMaxNumberOfImprovisations, + integrationPenaltyTypes: integrationPenaltyTypes, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required String name, + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), + required List tags, + required MatchTeamModel teams, + required MatchTeamModel improvisations, + required MatchTeamModel penalties, + required MatchTeamModel points, + required MatchTeamModel stars, + Value enableStatistics = const Value.absent(), + Value enablePenaltiesImpactPoints = const Value.absent(), + Value penaltiesImpactType = + const Value.absent(), + Value penaltiesRequiredToImpactPoints = const Value.absent(), + Value enableMatchExpulsion = const Value.absent(), + Value penaltiesRequiredToExpel = const Value.absent(), + Value integrationId = const Value.absent(), + Value integrationEntityId = const Value.absent(), + Value integrationAdditionalData = const Value.absent(), + Value integrationRestrictMaximumPointPerImprovisation = + const Value.absent(), + Value integrationMinNumberOfImprovisations = + const Value.absent(), + Value integrationMaxNumberOfImprovisations = + const Value.absent(), + Value?> integrationPenaltyTypes = const Value.absent(), + }) => + MatchEntityCompanion.insert( + id: id, + name: name, + createdDate: createdDate, + modifiedDate: modifiedDate, + tags: tags, + teams: teams, + improvisations: improvisations, + penalties: penalties, + points: points, + stars: stars, + enableStatistics: enableStatistics, + enablePenaltiesImpactPoints: enablePenaltiesImpactPoints, + penaltiesImpactType: penaltiesImpactType, + penaltiesRequiredToImpactPoints: penaltiesRequiredToImpactPoints, + enableMatchExpulsion: enableMatchExpulsion, + penaltiesRequiredToExpel: penaltiesRequiredToExpel, + integrationId: integrationId, + integrationEntityId: integrationEntityId, + integrationAdditionalData: integrationAdditionalData, + integrationRestrictMaximumPointPerImprovisation: + integrationRestrictMaximumPointPerImprovisation, + integrationMinNumberOfImprovisations: + integrationMinNumberOfImprovisations, + integrationMaxNumberOfImprovisations: + integrationMaxNumberOfImprovisations, + integrationPenaltyTypes: integrationPenaltyTypes, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$MatchEntityTableProcessedTableManager = ProcessedTableManager< + _$AppDatabase, + $MatchEntityTable, + MatchEntityData, + $$MatchEntityTableFilterComposer, + $$MatchEntityTableOrderingComposer, + $$MatchEntityTableAnnotationComposer, + $$MatchEntityTableCreateCompanionBuilder, + $$MatchEntityTableUpdateCompanionBuilder, + ( + MatchEntityData, + BaseReferences<_$AppDatabase, $MatchEntityTable, MatchEntityData> + ), + MatchEntityData, + PrefetchHooks Function()>; +typedef $$TeamEntityTableCreateCompanionBuilder = TeamEntityCompanion Function({ + Value id, + required String name, + Value createdDate, + Value modifiedDate, + required int color, + required PerformerModel performers, + required List tags, +}); +typedef $$TeamEntityTableUpdateCompanionBuilder = TeamEntityCompanion Function({ + Value id, + Value name, + Value createdDate, + Value modifiedDate, + Value color, + Value performers, + Value> tags, +}); + +class $$TeamEntityTableFilterComposer + extends Composer<_$AppDatabase, $TeamEntityTable> { + $$TeamEntityTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnFilters(column)); + + ColumnFilters get name => $composableBuilder( + column: $table.name, builder: (column) => ColumnFilters(column)); + + ColumnFilters get createdDate => $composableBuilder( + column: $table.createdDate, builder: (column) => ColumnFilters(column)); + + ColumnFilters get modifiedDate => $composableBuilder( + column: $table.modifiedDate, builder: (column) => ColumnFilters(column)); + + ColumnFilters get color => $composableBuilder( + column: $table.color, builder: (column) => ColumnFilters(column)); + + ColumnWithTypeConverterFilters + get performers => $composableBuilder( + column: $table.performers, + builder: (column) => ColumnWithTypeConverterFilters(column)); + + ColumnWithTypeConverterFilters, List, String> get tags => + $composableBuilder( + column: $table.tags, + builder: (column) => ColumnWithTypeConverterFilters(column)); +} + +class $$TeamEntityTableOrderingComposer + extends Composer<_$AppDatabase, $TeamEntityTable> { + $$TeamEntityTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get name => $composableBuilder( + column: $table.name, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get createdDate => $composableBuilder( + column: $table.createdDate, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get modifiedDate => $composableBuilder( + column: $table.modifiedDate, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get color => $composableBuilder( + column: $table.color, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get performers => $composableBuilder( + column: $table.performers, builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get tags => $composableBuilder( + column: $table.tags, builder: (column) => ColumnOrderings(column)); +} + +class $$TeamEntityTableAnnotationComposer + extends Composer<_$AppDatabase, $TeamEntityTable> { + $$TeamEntityTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get name => + $composableBuilder(column: $table.name, builder: (column) => column); + + GeneratedColumn get createdDate => $composableBuilder( + column: $table.createdDate, builder: (column) => column); + + GeneratedColumn get modifiedDate => $composableBuilder( + column: $table.modifiedDate, builder: (column) => column); + + GeneratedColumn get color => + $composableBuilder(column: $table.color, builder: (column) => column); + + GeneratedColumnWithTypeConverter get performers => + $composableBuilder( + column: $table.performers, builder: (column) => column); + + GeneratedColumnWithTypeConverter, String> get tags => + $composableBuilder(column: $table.tags, builder: (column) => column); +} + +class $$TeamEntityTableTableManager extends RootTableManager< + _$AppDatabase, + $TeamEntityTable, + TeamEntityData, + $$TeamEntityTableFilterComposer, + $$TeamEntityTableOrderingComposer, + $$TeamEntityTableAnnotationComposer, + $$TeamEntityTableCreateCompanionBuilder, + $$TeamEntityTableUpdateCompanionBuilder, + ( + TeamEntityData, + BaseReferences<_$AppDatabase, $TeamEntityTable, TeamEntityData> + ), + TeamEntityData, + PrefetchHooks Function()> { + $$TeamEntityTableTableManager(_$AppDatabase db, $TeamEntityTable table) + : super(TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$TeamEntityTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$TeamEntityTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$TeamEntityTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value name = const Value.absent(), + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), + Value color = const Value.absent(), + Value performers = const Value.absent(), + Value> tags = const Value.absent(), + }) => + TeamEntityCompanion( + id: id, + name: name, + createdDate: createdDate, + modifiedDate: modifiedDate, + color: color, + performers: performers, + tags: tags, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required String name, + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), + required int color, + required PerformerModel performers, + required List tags, + }) => + TeamEntityCompanion.insert( + id: id, + name: name, + createdDate: createdDate, + modifiedDate: modifiedDate, + color: color, + performers: performers, + tags: tags, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$TeamEntityTableProcessedTableManager = ProcessedTableManager< + _$AppDatabase, + $TeamEntityTable, + TeamEntityData, + $$TeamEntityTableFilterComposer, + $$TeamEntityTableOrderingComposer, + $$TeamEntityTableAnnotationComposer, + $$TeamEntityTableCreateCompanionBuilder, + $$TeamEntityTableUpdateCompanionBuilder, + ( + TeamEntityData, + BaseReferences<_$AppDatabase, $TeamEntityTable, TeamEntityData> + ), + TeamEntityData, + PrefetchHooks Function()>; + +class $AppDatabaseManager { + final _$AppDatabase _db; + $AppDatabaseManager(this._db); + $$PacingEntityTableTableManager get pacingEntity => + $$PacingEntityTableTableManager(_db, _db.pacingEntity); + $$MatchEntityTableTableManager get matchEntity => + $$MatchEntityTableTableManager(_db, _db.matchEntity); + $$TeamEntityTableTableManager get teamEntity => + $$TeamEntityTableTableManager(_db, _db.teamEntity); +} diff --git a/lib/repositories/legacy_database_repository.dart b/lib/repositories/legacy_database_repository.dart new file mode 100644 index 00000000..ca3d093b --- /dev/null +++ b/lib/repositories/legacy_database_repository.dart @@ -0,0 +1,27 @@ +import 'package:isar/isar.dart'; +import 'package:path_provider/path_provider.dart'; + +import '../models/match_model.dart'; +import '../models/pacing_model.dart'; +import '../models/team_model.dart'; + +class LegacyDatabaseRepository { + Isar? _database; + + Future get database async { + if (_database != null) { + return _database!; + } + + _database = await _getDatabase(); + return _database!; + } + + Future _getDatabase() async { + final dir = await getApplicationDocumentsDirectory(); + return await Isar.openAsync( + schemas: [PacingModelSchema, MatchModelSchema, TeamModelSchema], + directory: dir.path, + ); + } +} diff --git a/lib/repositories/matches_repository.dart b/lib/repositories/matches_repository.dart index d6886071..248324a3 100644 --- a/lib/repositories/matches_repository.dart +++ b/lib/repositories/matches_repository.dart @@ -1,10 +1,10 @@ import 'package:isar/isar.dart'; import '../extensions/iterable_extensions.dart'; import '../models/match_model.dart'; -import 'database_repository.dart'; +import 'legacy_database_repository.dart'; class MatchesRepository { - final DatabaseRepository databaseRepository; + final LegacyDatabaseRepository databaseRepository; const MatchesRepository({ required this.databaseRepository, diff --git a/lib/repositories/pacings_repository.dart b/lib/repositories/pacings_repository.dart index 0dc538d5..e655ed67 100644 --- a/lib/repositories/pacings_repository.dart +++ b/lib/repositories/pacings_repository.dart @@ -2,10 +2,10 @@ import 'package:isar/isar.dart'; import '../extensions/iterable_extensions.dart'; import '../models/pacing_model.dart'; -import 'database_repository.dart'; +import 'legacy_database_repository.dart'; class PacingsRepository { - final DatabaseRepository databaseRepository; + final LegacyDatabaseRepository databaseRepository; const PacingsRepository({ required this.databaseRepository, diff --git a/lib/repositories/teams_repository.dart b/lib/repositories/teams_repository.dart index 1b3f2f6f..780726a9 100644 --- a/lib/repositories/teams_repository.dart +++ b/lib/repositories/teams_repository.dart @@ -3,10 +3,10 @@ import 'package:isar/isar.dart'; import '../extensions/iterable_extensions.dart'; import '../models/pacing_model.dart'; import '../models/team_model.dart'; -import 'database_repository.dart'; +import 'legacy_database_repository.dart'; class TeamsRepository { - final DatabaseRepository databaseRepository; + final LegacyDatabaseRepository databaseRepository; const TeamsRepository({ required this.databaseRepository, diff --git a/pubspec.lock b/pubspec.lock index 0aebdb14..36c23ba7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -30,6 +30,14 @@ packages: url: "https://pub.dev" source: hosted version: "6.11.0" + analyzer_plugin: + dependency: transitive + description: + name: analyzer_plugin + sha256: "9661b30b13a685efaee9f02e5d01ed9f2b423bd889d28a304d02d704aee69161" + url: "https://pub.dev" + source: hosted + version: "0.11.3" ansicolor: dependency: transitive description: @@ -114,18 +122,18 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + sha256: "74691599a5bc750dc96a6b4bfd48f7d9d66453eab04c7f4063134800d6a5c573" url: "https://pub.dev" source: hosted - version: "2.4.13" + version: "2.4.14" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 + sha256: "22e3aa1c80e0ada3722fe5b63fd43d9c8990759d0a2cf489c8c5d7b2bdebc021" url: "https://pub.dev" source: hosted - version: "7.3.2" + version: "8.0.0" built_collection: dependency: transitive description: @@ -150,6 +158,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" + charcode: + dependency: transitive + description: + name: charcode + sha256: fb0f1107cac15a5ea6ef0a6ef71a807b9e4267c713bb93e00e92d737cc8dbd8a + url: "https://pub.dev" + source: hosted + version: "1.4.0" checked_yaml: dependency: transitive description: @@ -158,6 +174,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" clock: dependency: transitive description: @@ -254,6 +278,30 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.10" + drift: + dependency: "direct main" + description: + name: drift + sha256: c2d073d35ad441730812f4ea05b5dd031fb81c5f9786a4f5fb77ecd6307b6f74 + url: "https://pub.dev" + source: hosted + version: "2.22.1" + drift_dev: + dependency: "direct dev" + description: + name: drift_dev + sha256: f4ab5d6976b1e31551ceb82ff597a505bda7818ff4f7be08a1da9d55eb6e730c + url: "https://pub.dev" + source: hosted + version: "2.22.1" + drift_flutter: + dependency: "direct main" + description: + name: drift_flutter + sha256: "9fd9b479c6187d6b3bbdfd2703df98010470a6c65c2a8c8c5a1034c620bd0a0e" + url: "https://pub.dev" + source: hosted + version: "0.2.3" equatable: dependency: transitive description: @@ -914,6 +962,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" + recase: + dependency: transitive + description: + name: recase + sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 + url: "https://pub.dev" + source: hosted + version: "4.1.0" sanitize_filename: dependency: "direct main" description: @@ -1023,6 +1079,30 @@ packages: url: "https://pub.dev" source: hosted version: "7.0.0" + sqlite3: + dependency: transitive + description: + name: sqlite3 + sha256: cb7f4e9dc1b52b1fa350f7b3d41c662e75fc3d399555fa4e5efcf267e9a4fbb5 + url: "https://pub.dev" + source: hosted + version: "2.5.0" + sqlite3_flutter_libs: + dependency: transitive + description: + name: sqlite3_flutter_libs + sha256: "636b0fe8a2de894e5455572f6cbbc458f4ffecfe9f860b79439e27041ea4f0b9" + url: "https://pub.dev" + source: hosted + version: "0.5.27" + sqlparser: + dependency: transitive + description: + name: sqlparser + sha256: "4cad4b2c5f63dc9ea1a8dcffb58cf762322bea5dd8836870164a65e913bdae41" + url: "https://pub.dev" + source: hosted + version: "0.40.0" stack_trace: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 74860413..fc02fe4f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,6 +11,8 @@ dependencies: country_flags: ^3.0.0 cupertino_icons: ^1.0.8 dart_mappable: ^4.3.0 + drift: ^2.22.1 + drift_flutter: ^0.2.3 excel: ^4.0.3 firebase_analytics: ^11.3.3 firebase_core: ^3.6.0 @@ -45,8 +47,9 @@ dependencies: wakelock_plus: ^1.2.8 dev_dependencies: - build_runner: ^2.4.13 + build_runner: ^2.4.14 dart_mappable_builder: ^4.3.0 + drift_dev: ^2.22.1 flutter_lints: ^5.0.0 flutter_test: sdk: flutter From 0b758bc7d20ddb3bad56806f4a3cab200171657f Mon Sep 17 00:00:00 2001 From: Frederik St-Onge Date: Fri, 20 Dec 2024 17:07:43 -0500 Subject: [PATCH 2/7] Add more entities --- .../converters/int_list_converter.dart | 16 +++++ .../converters/string_list_converter.dart | 16 +++++ lib/repositories/database_repository.dart | 72 +------------------ lib/repositories/entities/match_entity.dart | 27 +++++++ .../entities/match_improvisation_entity.dart | 23 ++++++ lib/repositories/entities/pacing_entity.dart | 13 ++++ .../entities/pacing_improvisation_entity.dart | 23 ++++++ lib/repositories/entities/tag_entity.dart | 8 +++ lib/repositories/entities/team_entity.dart | 10 +++ 9 files changed, 139 insertions(+), 69 deletions(-) create mode 100644 lib/repositories/converters/int_list_converter.dart create mode 100644 lib/repositories/converters/string_list_converter.dart create mode 100644 lib/repositories/entities/match_entity.dart create mode 100644 lib/repositories/entities/match_improvisation_entity.dart create mode 100644 lib/repositories/entities/pacing_entity.dart create mode 100644 lib/repositories/entities/pacing_improvisation_entity.dart create mode 100644 lib/repositories/entities/tag_entity.dart create mode 100644 lib/repositories/entities/team_entity.dart diff --git a/lib/repositories/converters/int_list_converter.dart b/lib/repositories/converters/int_list_converter.dart new file mode 100644 index 00000000..3629d61c --- /dev/null +++ b/lib/repositories/converters/int_list_converter.dart @@ -0,0 +1,16 @@ +import 'package:drift/drift.dart'; + +class IntListConverter extends TypeConverter, String> with JsonTypeConverter, String> { + static const separator = ','; + const IntListConverter(); + + @override + List fromSql(String fromDb) { + return fromDb.split(separator).cast(); + } + + @override + String toSql(List value) { + return value.join(separator); + } +} diff --git a/lib/repositories/converters/string_list_converter.dart b/lib/repositories/converters/string_list_converter.dart new file mode 100644 index 00000000..362a7ae7 --- /dev/null +++ b/lib/repositories/converters/string_list_converter.dart @@ -0,0 +1,16 @@ +import 'package:drift/drift.dart'; + +class StringListConverter extends TypeConverter, String> with JsonTypeConverter, String> { + static const separator = ','; + const StringListConverter(); + + @override + List fromSql(String fromDb) { + return fromDb.split(separator); + } + + @override + String toSql(List value) { + return value.join(separator); + } +} diff --git a/lib/repositories/database_repository.dart b/lib/repositories/database_repository.dart index 3d1666b9..197d2148 100644 --- a/lib/repositories/database_repository.dart +++ b/lib/repositories/database_repository.dart @@ -1,78 +1,12 @@ import 'package:drift/drift.dart'; import 'package:drift_flutter/drift_flutter.dart'; -import '../models/improvisation_model.dart'; -import '../models/match_team_model.dart'; -import '../models/penalties_impact_type.dart'; -import '../models/performer_model.dart'; +import 'entities/match_entity.dart'; +import 'entities/pacing_entity.dart'; +import 'entities/team_entity.dart'; part 'database_repository.g.dart'; -class TagsConverter extends TypeConverter, String> with JsonTypeConverter, String> { - static const separator = ','; - const TagsConverter(); - - @override - List fromSql(String fromDb) { - return fromDb.split(separator); - } - - @override - String toSql(List value) { - return value.join(separator); - } -} - -class PacingEntity extends Table { - IntColumn get id => integer().autoIncrement()(); - TextColumn get name => text()(); - DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); - DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); - TextColumn get tags => text().map(const TagsConverter())(); - TextColumn get improvisations => text().map(ImprovisationModel.converter)(); - IntColumn get defaultNumberOfTeams => integer().withDefault(const Constant(2))(); - - TextColumn get integrationId => text().nullable()(); - TextColumn get integrationEntityId => text().nullable()(); - TextColumn get integrationAdditionalData => text().nullable()(); -} - -class MatchEntity extends Table { - IntColumn get id => integer().autoIncrement()(); - TextColumn get name => text()(); - DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); - DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); - TextColumn get tags => text().map(const TagsConverter())(); - TextColumn get teams => text().map(MatchTeamModel.converter)(); - TextColumn get improvisations => text().map(MatchTeamModel.converter)(); - TextColumn get penalties => text().map(MatchTeamModel.converter)(); - TextColumn get points => text().map(MatchTeamModel.converter)(); - TextColumn get stars => text().map(MatchTeamModel.converter)(); - BoolColumn get enableStatistics => boolean().withDefault(const Constant(true))(); - BoolColumn get enablePenaltiesImpactPoints => boolean().withDefault(const Constant(true))(); - IntColumn get penaltiesImpactType => intEnum().withDefault(Constant(PenaltiesImpactType.addPoints.index))(); - IntColumn get penaltiesRequiredToImpactPoints => integer().withDefault(const Constant(3))(); - BoolColumn get enableMatchExpulsion => boolean().withDefault(const Constant(true))(); - IntColumn get penaltiesRequiredToExpel => integer().withDefault(const Constant(3))(); - TextColumn get integrationId => text().nullable()(); - TextColumn get integrationEntityId => text().nullable()(); - TextColumn get integrationAdditionalData => text().nullable()(); - IntColumn get integrationRestrictMaximumPointPerImprovisation => integer().nullable()(); - IntColumn get integrationMinNumberOfImprovisations => integer().nullable()(); - IntColumn get integrationMaxNumberOfImprovisations => integer().nullable()(); - TextColumn get integrationPenaltyTypes => text().map(const TagsConverter()).nullable()(); -} - -class TeamEntity extends Table { - IntColumn get id => integer().autoIncrement()(); - TextColumn get name => text()(); - DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); - DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); - IntColumn get color => integer()(); - TextColumn get performers => text().map(PerformerModel.converter)(); - TextColumn get tags => text().map(const TagsConverter())(); -} - @DriftDatabase(tables: [PacingEntity, MatchEntity, TeamEntity]) class AppDatabase extends _$AppDatabase { AppDatabase() : super(_openConnection()); diff --git a/lib/repositories/entities/match_entity.dart b/lib/repositories/entities/match_entity.dart new file mode 100644 index 00000000..c17f21cd --- /dev/null +++ b/lib/repositories/entities/match_entity.dart @@ -0,0 +1,27 @@ +import 'package:drift/drift.dart'; + +import '../converters/string_list_converter.dart'; + +class MatchEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + TextColumn get name => text()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + TextColumn get teams => text().map(MatchTeamModel.converter)(); + TextColumn get penalties => text().map(MatchTeamModel.converter)(); + TextColumn get points => text().map(MatchTeamModel.converter)(); + TextColumn get stars => text().map(MatchTeamModel.converter)(); + BoolColumn get enableStatistics => boolean().withDefault(const Constant(true))(); + BoolColumn get enablePenaltiesImpactPoints => boolean().withDefault(const Constant(true))(); + IntColumn get penaltiesImpactType => intEnum().withDefault(Constant(PenaltiesImpactType.addPoints.index))(); + IntColumn get penaltiesRequiredToImpactPoints => integer().withDefault(const Constant(3))(); + BoolColumn get enableMatchExpulsion => boolean().withDefault(const Constant(true))(); + IntColumn get penaltiesRequiredToExpel => integer().withDefault(const Constant(3))(); + TextColumn get integrationId => text().nullable()(); + TextColumn get integrationEntityId => text().nullable()(); + TextColumn get integrationAdditionalData => text().nullable()(); + IntColumn get integrationRestrictMaximumPointPerImprovisation => integer().nullable()(); + IntColumn get integrationMinNumberOfImprovisations => integer().nullable()(); + IntColumn get integrationMaxNumberOfImprovisations => integer().nullable()(); + TextColumn get integrationPenaltyTypes => text().map(const StringListConverter()).nullable()(); +} diff --git a/lib/repositories/entities/match_improvisation_entity.dart b/lib/repositories/entities/match_improvisation_entity.dart new file mode 100644 index 00000000..8885defc --- /dev/null +++ b/lib/repositories/entities/match_improvisation_entity.dart @@ -0,0 +1,23 @@ +import 'package:drift/drift.dart'; + +import '../../models/improvisation_type.dart'; +import '../converters/int_list_converter.dart'; +import 'match_entity.dart'; + +class MatchImprovisationEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + TextColumn get name => text()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + IntColumn get type => intEnum()(); + TextColumn get category => text()(); + TextColumn get theme => text()(); + TextColumn get durationsInSeconds => text().map(const IntListConverter())(); + TextColumn get performers => text()(); + TextColumn get notes => text()(); + IntColumn get timeBufferInSeconds => integer()(); + IntColumn get huddleTimerInSeconds => integer()(); + TextColumn get integrationEntityId => text().nullable()(); + TextColumn get integrationAdditionalData => text().nullable()(); + IntColumn get match => integer().references(MatchEntity, #id)(); +} diff --git a/lib/repositories/entities/pacing_entity.dart b/lib/repositories/entities/pacing_entity.dart new file mode 100644 index 00000000..f51aaa37 --- /dev/null +++ b/lib/repositories/entities/pacing_entity.dart @@ -0,0 +1,13 @@ +import 'package:drift/drift.dart'; + +class PacingEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + TextColumn get name => text()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + IntColumn get defaultNumberOfTeams => integer().withDefault(const Constant(2))(); + + TextColumn get integrationId => text().nullable()(); + TextColumn get integrationEntityId => text().nullable()(); + TextColumn get integrationAdditionalData => text().nullable()(); +} diff --git a/lib/repositories/entities/pacing_improvisation_entity.dart b/lib/repositories/entities/pacing_improvisation_entity.dart new file mode 100644 index 00000000..f57f2292 --- /dev/null +++ b/lib/repositories/entities/pacing_improvisation_entity.dart @@ -0,0 +1,23 @@ +import 'package:drift/drift.dart'; + +import '../../models/improvisation_type.dart'; +import '../converters/int_list_converter.dart'; +import 'pacing_entity.dart'; + +class PacingImprovisationEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + TextColumn get name => text()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + IntColumn get type => intEnum()(); + TextColumn get category => text()(); + TextColumn get theme => text()(); + TextColumn get durationsInSeconds => text().map(const IntListConverter())(); + TextColumn get performers => text()(); + TextColumn get notes => text()(); + IntColumn get timeBufferInSeconds => integer()(); + IntColumn get huddleTimerInSeconds => integer()(); + TextColumn get integrationEntityId => text().nullable()(); + TextColumn get integrationAdditionalData => text().nullable()(); + IntColumn get pacing => integer().references(PacingEntity, #id)(); +} diff --git a/lib/repositories/entities/tag_entity.dart b/lib/repositories/entities/tag_entity.dart new file mode 100644 index 00000000..0281a872 --- /dev/null +++ b/lib/repositories/entities/tag_entity.dart @@ -0,0 +1,8 @@ +import 'package:drift/drift.dart'; + +class TagEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + TextColumn get name => text()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); +} diff --git a/lib/repositories/entities/team_entity.dart b/lib/repositories/entities/team_entity.dart new file mode 100644 index 00000000..cde09407 --- /dev/null +++ b/lib/repositories/entities/team_entity.dart @@ -0,0 +1,10 @@ +import 'package:drift/drift.dart'; + +class TeamEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + TextColumn get name => text()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + IntColumn get color => integer()(); + TextColumn get performers => text().map(PerformerModel.converter)(); +} From 74f04dce1446e8cb61c02401e81dbc54bd58901a Mon Sep 17 00:00:00 2001 From: Frederik St-Onge Date: Sun, 22 Dec 2024 09:32:05 -0500 Subject: [PATCH 3/7] More entities --- lib/models/improvisation_model.dart | 6 ----- lib/models/match_team_model.dart | 6 ----- lib/models/penalty_model.dart | 6 ----- lib/models/performer_model.dart | 6 ----- lib/models/point_model.dart | 6 ----- lib/models/star_model.dart | 6 ----- ..._entity.dart => improvisation_entity.dart} | 6 +++-- lib/repositories/entities/match_entity.dart | 5 +--- .../entities/match_improvisation_entity.dart | 23 ------------------- lib/repositories/entities/penalty_entity.dart | 18 +++++++++++++++ .../entities/performer_entity.dart | 15 ++++++++++++ lib/repositories/entities/point_entity.dart | 14 +++++++++++ lib/repositories/entities/star_entity.dart | 13 +++++++++++ lib/repositories/entities/team_entity.dart | 1 - 14 files changed, 65 insertions(+), 66 deletions(-) rename lib/repositories/entities/{pacing_improvisation_entity.dart => improvisation_entity.dart} (86%) delete mode 100644 lib/repositories/entities/match_improvisation_entity.dart create mode 100644 lib/repositories/entities/penalty_entity.dart create mode 100644 lib/repositories/entities/performer_entity.dart create mode 100644 lib/repositories/entities/point_entity.dart create mode 100644 lib/repositories/entities/star_entity.dart diff --git a/lib/models/improvisation_model.dart b/lib/models/improvisation_model.dart index 113adec0..f5a20f99 100644 --- a/lib/models/improvisation_model.dart +++ b/lib/models/improvisation_model.dart @@ -1,5 +1,4 @@ import 'package:dart_mappable/dart_mappable.dart'; -import 'package:drift/drift.dart'; import 'package:isar/isar.dart'; import 'improvisation_type.dart'; @@ -35,9 +34,4 @@ class ImprovisationModel with ImprovisationModelMappable { this.integrationEntityId, this.integrationAdditionalData, }); - - static JsonTypeConverter converter = TypeConverter.json( - fromJson: (json) => ImprovisationModelMapper.fromMap(json as Map), - toJson: (pref) => pref.toMap(), - ); } diff --git a/lib/models/match_team_model.dart b/lib/models/match_team_model.dart index 9330a5da..6d61ef34 100644 --- a/lib/models/match_team_model.dart +++ b/lib/models/match_team_model.dart @@ -1,5 +1,4 @@ import 'package:dart_mappable/dart_mappable.dart'; -import 'package:drift/drift.dart'; import 'package:isar/isar.dart'; import 'performer_model.dart'; @@ -25,9 +24,4 @@ class MatchTeamModel with MatchTeamModelMappable { this.integrationEntityId, this.integrationAdditionalData, }); - - static JsonTypeConverter converter = TypeConverter.json( - fromJson: (json) => MatchTeamModelMapper.fromMap(json as Map), - toJson: (pref) => pref.toMap(), - ); } diff --git a/lib/models/penalty_model.dart b/lib/models/penalty_model.dart index 9beeb1bc..696494c9 100644 --- a/lib/models/penalty_model.dart +++ b/lib/models/penalty_model.dart @@ -1,5 +1,4 @@ import 'package:dart_mappable/dart_mappable.dart'; -import 'package:drift/drift.dart'; import 'package:isar/isar.dart'; part 'penalty_model.mapper.dart'; @@ -23,9 +22,4 @@ class PenaltyModel with PenaltyModelMappable { required this.teamId, required this.improvisationId, }); - - static JsonTypeConverter converter = TypeConverter.json( - fromJson: (json) => PenaltyModelMapper.fromMap(json as Map), - toJson: (pref) => pref.toMap(), - ); } diff --git a/lib/models/performer_model.dart b/lib/models/performer_model.dart index 39cf8d83..80b0b5b9 100644 --- a/lib/models/performer_model.dart +++ b/lib/models/performer_model.dart @@ -1,5 +1,4 @@ import 'package:dart_mappable/dart_mappable.dart'; -import 'package:drift/drift.dart'; import 'package:isar/isar.dart'; part 'performer_model.mapper.dart'; @@ -19,9 +18,4 @@ class PerformerModel with PerformerModelMappable { this.integrationEntityId, this.integrationAdditionalData, }); - - static JsonTypeConverter converter = TypeConverter.json( - fromJson: (json) => PerformerModelMapper.fromMap(json as Map), - toJson: (pref) => pref.toMap(), - ); } diff --git a/lib/models/point_model.dart b/lib/models/point_model.dart index de3000ee..7545db67 100644 --- a/lib/models/point_model.dart +++ b/lib/models/point_model.dart @@ -1,5 +1,4 @@ import 'package:dart_mappable/dart_mappable.dart'; -import 'package:drift/drift.dart'; import 'package:isar/isar.dart'; part 'point_model.mapper.dart'; @@ -19,9 +18,4 @@ class PointModel with PointModelMappable { required this.improvisationId, required this.value, }); - - static JsonTypeConverter converter = TypeConverter.json( - fromJson: (json) => PointModelMapper.fromMap(json as Map), - toJson: (pref) => pref.toMap(), - ); } diff --git a/lib/models/star_model.dart b/lib/models/star_model.dart index 2bd8405c..505ffc2c 100644 --- a/lib/models/star_model.dart +++ b/lib/models/star_model.dart @@ -1,5 +1,4 @@ import 'package:dart_mappable/dart_mappable.dart'; -import 'package:drift/drift.dart'; import 'package:isar/isar.dart'; part 'star_model.mapper.dart'; @@ -17,9 +16,4 @@ class StarModel with StarModelMappable { required this.performerId, required this.teamId, }); - - static JsonTypeConverter converter = TypeConverter.json( - fromJson: (json) => StarModelMapper.fromMap(json as Map), - toJson: (pref) => pref.toMap(), - ); } diff --git a/lib/repositories/entities/pacing_improvisation_entity.dart b/lib/repositories/entities/improvisation_entity.dart similarity index 86% rename from lib/repositories/entities/pacing_improvisation_entity.dart rename to lib/repositories/entities/improvisation_entity.dart index f57f2292..dd4e1ea6 100644 --- a/lib/repositories/entities/pacing_improvisation_entity.dart +++ b/lib/repositories/entities/improvisation_entity.dart @@ -2,9 +2,10 @@ import 'package:drift/drift.dart'; import '../../models/improvisation_type.dart'; import '../converters/int_list_converter.dart'; +import 'match_entity.dart'; import 'pacing_entity.dart'; -class PacingImprovisationEntity extends Table { +class ImprovisationEntity extends Table { IntColumn get id => integer().autoIncrement()(); TextColumn get name => text()(); DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); @@ -19,5 +20,6 @@ class PacingImprovisationEntity extends Table { IntColumn get huddleTimerInSeconds => integer()(); TextColumn get integrationEntityId => text().nullable()(); TextColumn get integrationAdditionalData => text().nullable()(); - IntColumn get pacing => integer().references(PacingEntity, #id)(); + IntColumn get pacing => integer().references(PacingEntity, #id).nullable()(); + IntColumn get match => integer().references(MatchEntity, #id).nullable()(); } diff --git a/lib/repositories/entities/match_entity.dart b/lib/repositories/entities/match_entity.dart index c17f21cd..c96333b9 100644 --- a/lib/repositories/entities/match_entity.dart +++ b/lib/repositories/entities/match_entity.dart @@ -1,5 +1,6 @@ import 'package:drift/drift.dart'; +import '../../models/penalties_impact_type.dart'; import '../converters/string_list_converter.dart'; class MatchEntity extends Table { @@ -7,10 +8,6 @@ class MatchEntity extends Table { TextColumn get name => text()(); DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); - TextColumn get teams => text().map(MatchTeamModel.converter)(); - TextColumn get penalties => text().map(MatchTeamModel.converter)(); - TextColumn get points => text().map(MatchTeamModel.converter)(); - TextColumn get stars => text().map(MatchTeamModel.converter)(); BoolColumn get enableStatistics => boolean().withDefault(const Constant(true))(); BoolColumn get enablePenaltiesImpactPoints => boolean().withDefault(const Constant(true))(); IntColumn get penaltiesImpactType => intEnum().withDefault(Constant(PenaltiesImpactType.addPoints.index))(); diff --git a/lib/repositories/entities/match_improvisation_entity.dart b/lib/repositories/entities/match_improvisation_entity.dart deleted file mode 100644 index 8885defc..00000000 --- a/lib/repositories/entities/match_improvisation_entity.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:drift/drift.dart'; - -import '../../models/improvisation_type.dart'; -import '../converters/int_list_converter.dart'; -import 'match_entity.dart'; - -class MatchImprovisationEntity extends Table { - IntColumn get id => integer().autoIncrement()(); - TextColumn get name => text()(); - DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); - DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); - IntColumn get type => intEnum()(); - TextColumn get category => text()(); - TextColumn get theme => text()(); - TextColumn get durationsInSeconds => text().map(const IntListConverter())(); - TextColumn get performers => text()(); - TextColumn get notes => text()(); - IntColumn get timeBufferInSeconds => integer()(); - IntColumn get huddleTimerInSeconds => integer()(); - TextColumn get integrationEntityId => text().nullable()(); - TextColumn get integrationAdditionalData => text().nullable()(); - IntColumn get match => integer().references(MatchEntity, #id)(); -} diff --git a/lib/repositories/entities/penalty_entity.dart b/lib/repositories/entities/penalty_entity.dart new file mode 100644 index 00000000..e2731521 --- /dev/null +++ b/lib/repositories/entities/penalty_entity.dart @@ -0,0 +1,18 @@ +import 'package:drift/drift.dart'; + +import 'improvisation_entity.dart'; +import 'performer_entity.dart'; +import 'team_entity.dart'; + +class PenaltyEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + TextColumn get name => text()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + BoolColumn get major => boolean()(); + TextColumn get type => text()(); + + IntColumn get performer => integer().references(PerformerEntity, #id).nullable()(); + IntColumn get team => integer().references(TeamEntity, #id)(); + IntColumn get improvisation => integer().references(ImprovisationEntity, #id)(); +} diff --git a/lib/repositories/entities/performer_entity.dart b/lib/repositories/entities/performer_entity.dart new file mode 100644 index 00000000..50f115a9 --- /dev/null +++ b/lib/repositories/entities/performer_entity.dart @@ -0,0 +1,15 @@ +import 'package:drift/drift.dart'; + +import 'team_entity.dart'; + +class PerformerEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + TextColumn get name => text()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + + IntColumn get team => integer().references(TeamEntity, #id)(); + + TextColumn get integrationEntityId => text().nullable()(); + TextColumn get integrationAdditionalData => text().nullable()(); +} diff --git a/lib/repositories/entities/point_entity.dart b/lib/repositories/entities/point_entity.dart new file mode 100644 index 00000000..28a3207b --- /dev/null +++ b/lib/repositories/entities/point_entity.dart @@ -0,0 +1,14 @@ +import 'package:drift/drift.dart'; + +import 'improvisation_entity.dart'; +import 'team_entity.dart'; + +class PointEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + IntColumn get value => integer()(); + + IntColumn get team => integer().references(TeamEntity, #id)(); + IntColumn get improvisation => integer().references(ImprovisationEntity, #id)(); +} diff --git a/lib/repositories/entities/star_entity.dart b/lib/repositories/entities/star_entity.dart new file mode 100644 index 00000000..d6310e40 --- /dev/null +++ b/lib/repositories/entities/star_entity.dart @@ -0,0 +1,13 @@ +import 'package:drift/drift.dart'; + +import 'performer_entity.dart'; +import 'team_entity.dart'; + +class StarEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + + IntColumn get performer => integer().references(PerformerEntity, #id)(); + IntColumn get team => integer().references(TeamEntity, #id)(); +} diff --git a/lib/repositories/entities/team_entity.dart b/lib/repositories/entities/team_entity.dart index cde09407..a0e1b736 100644 --- a/lib/repositories/entities/team_entity.dart +++ b/lib/repositories/entities/team_entity.dart @@ -6,5 +6,4 @@ class TeamEntity extends Table { DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); IntColumn get color => integer()(); - TextColumn get performers => text().map(PerformerModel.converter)(); } From 9dcc381cc1648cd37a3581f993d815f9c35e158e Mon Sep 17 00:00:00 2001 From: Frederik St-Onge Date: Sun, 22 Dec 2024 10:05:43 -0500 Subject: [PATCH 4/7] Add to many tags entities --- lib/repositories/database_repository.dart | 16 +- lib/repositories/database_repository.g.dart | 928 +++--------------- .../entities/match_tag_entity.dart | 13 + .../entities/pacing_tag_entity.dart | 13 + .../entities/team_tag_entity.dart | 13 + 5 files changed, 200 insertions(+), 783 deletions(-) create mode 100644 lib/repositories/entities/match_tag_entity.dart create mode 100644 lib/repositories/entities/pacing_tag_entity.dart create mode 100644 lib/repositories/entities/team_tag_entity.dart diff --git a/lib/repositories/database_repository.dart b/lib/repositories/database_repository.dart index 197d2148..6d777c35 100644 --- a/lib/repositories/database_repository.dart +++ b/lib/repositories/database_repository.dart @@ -1,15 +1,23 @@ import 'package:drift/drift.dart'; import 'package:drift_flutter/drift_flutter.dart'; +import '../services/toaster_service.dart'; import 'entities/match_entity.dart'; import 'entities/pacing_entity.dart'; import 'entities/team_entity.dart'; +import 'legacy_database_repository.dart'; part 'database_repository.g.dart'; @DriftDatabase(tables: [PacingEntity, MatchEntity, TeamEntity]) class AppDatabase extends _$AppDatabase { - AppDatabase() : super(_openConnection()); + final LegacyDatabaseRepository legacyDatabaseRepository; + final ToasterService toasterService; + + AppDatabase({ + required this.legacyDatabaseRepository, + required this.toasterService, + }) : super(_openConnection()); @override int get schemaVersion => 1; @@ -18,10 +26,14 @@ class AppDatabase extends _$AppDatabase { MigrationStrategy get migration => MigrationStrategy( beforeOpen: (details) async { await customStatement('PRAGMA foreign_keys = ON'); + + if (details.wasCreated) { + // Migrate data from the legacy database + } }, ); static QueryExecutor _openConnection() { - return driftDatabase(name: 'my_database'); + return driftDatabase(name: 'mon_pacing_drift'); } } diff --git a/lib/repositories/database_repository.g.dart b/lib/repositories/database_repository.g.dart index 1376d756..7a95dc12 100644 --- a/lib/repositories/database_repository.g.dart +++ b/lib/repositories/database_repository.g.dart @@ -27,29 +27,18 @@ class $PacingEntityTable extends PacingEntity const VerificationMeta('createdDate'); @override late final GeneratedColumn createdDate = GeneratedColumn( - 'created_date', aliasedName, true, - type: DriftSqlType.dateTime, requiredDuringInsert: false); + 'created_date', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Constant(DateTime.now())); static const VerificationMeta _modifiedDateMeta = const VerificationMeta('modifiedDate'); @override late final GeneratedColumn modifiedDate = GeneratedColumn( - 'modified_date', aliasedName, true, - type: DriftSqlType.dateTime, requiredDuringInsert: false); - static const VerificationMeta _tagsMeta = const VerificationMeta('tags'); - @override - late final GeneratedColumnWithTypeConverter, String> tags = - GeneratedColumn('tags', aliasedName, false, - type: DriftSqlType.string, requiredDuringInsert: true) - .withConverter>($PacingEntityTable.$convertertags); - static const VerificationMeta _improvisationsMeta = - const VerificationMeta('improvisations'); - @override - late final GeneratedColumnWithTypeConverter - improvisations = GeneratedColumn( - 'improvisations', aliasedName, false, - type: DriftSqlType.string, requiredDuringInsert: true) - .withConverter( - $PacingEntityTable.$converterimprovisations); + 'modified_date', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Constant(DateTime.now())); static const VerificationMeta _defaultNumberOfTeamsMeta = const VerificationMeta('defaultNumberOfTeams'); @override @@ -82,8 +71,6 @@ class $PacingEntityTable extends PacingEntity name, createdDate, modifiedDate, - tags, - improvisations, defaultNumberOfTeams, integrationId, integrationEntityId, @@ -120,8 +107,6 @@ class $PacingEntityTable extends PacingEntity modifiedDate.isAcceptableOrUnknown( data['modified_date']!, _modifiedDateMeta)); } - context.handle(_tagsMeta, const VerificationResult.success()); - context.handle(_improvisationsMeta, const VerificationResult.success()); if (data.containsKey('default_number_of_teams')) { context.handle( _defaultNumberOfTeamsMeta, @@ -161,15 +146,9 @@ class $PacingEntityTable extends PacingEntity name: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}name'])!, createdDate: attachedDatabase.typeMapping - .read(DriftSqlType.dateTime, data['${effectivePrefix}created_date']), - modifiedDate: attachedDatabase.typeMapping - .read(DriftSqlType.dateTime, data['${effectivePrefix}modified_date']), - tags: $PacingEntityTable.$convertertags.fromSql(attachedDatabase - .typeMapping - .read(DriftSqlType.string, data['${effectivePrefix}tags'])!), - improvisations: $PacingEntityTable.$converterimprovisations.fromSql( - attachedDatabase.typeMapping.read( - DriftSqlType.string, data['${effectivePrefix}improvisations'])!), + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_date'])!, + modifiedDate: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, data['${effectivePrefix}modified_date'])!, defaultNumberOfTeams: attachedDatabase.typeMapping.read( DriftSqlType.int, data['${effectivePrefix}default_number_of_teams'])!, integrationId: attachedDatabase.typeMapping @@ -186,21 +165,14 @@ class $PacingEntityTable extends PacingEntity $PacingEntityTable createAlias(String alias) { return $PacingEntityTable(attachedDatabase, alias); } - - static JsonTypeConverter2, String, String> $convertertags = - const TagsConverter(); - static JsonTypeConverter2 - $converterimprovisations = ImprovisationModel.converter; } class PacingEntityData extends DataClass implements Insertable { final int id; final String name; - final DateTime? createdDate; - final DateTime? modifiedDate; - final List tags; - final ImprovisationModel improvisations; + final DateTime createdDate; + final DateTime modifiedDate; final int defaultNumberOfTeams; final String? integrationId; final String? integrationEntityId; @@ -208,10 +180,8 @@ class PacingEntityData extends DataClass const PacingEntityData( {required this.id, required this.name, - this.createdDate, - this.modifiedDate, - required this.tags, - required this.improvisations, + required this.createdDate, + required this.modifiedDate, required this.defaultNumberOfTeams, this.integrationId, this.integrationEntityId, @@ -221,20 +191,8 @@ class PacingEntityData extends DataClass final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); - if (!nullToAbsent || createdDate != null) { - map['created_date'] = Variable(createdDate); - } - if (!nullToAbsent || modifiedDate != null) { - map['modified_date'] = Variable(modifiedDate); - } - { - map['tags'] = - Variable($PacingEntityTable.$convertertags.toSql(tags)); - } - { - map['improvisations'] = Variable( - $PacingEntityTable.$converterimprovisations.toSql(improvisations)); - } + map['created_date'] = Variable(createdDate); + map['modified_date'] = Variable(modifiedDate); map['default_number_of_teams'] = Variable(defaultNumberOfTeams); if (!nullToAbsent || integrationId != null) { map['integration_id'] = Variable(integrationId); @@ -253,14 +211,8 @@ class PacingEntityData extends DataClass return PacingEntityCompanion( id: Value(id), name: Value(name), - createdDate: createdDate == null && nullToAbsent - ? const Value.absent() - : Value(createdDate), - modifiedDate: modifiedDate == null && nullToAbsent - ? const Value.absent() - : Value(modifiedDate), - tags: Value(tags), - improvisations: Value(improvisations), + createdDate: Value(createdDate), + modifiedDate: Value(modifiedDate), defaultNumberOfTeams: Value(defaultNumberOfTeams), integrationId: integrationId == null && nullToAbsent ? const Value.absent() @@ -281,12 +233,8 @@ class PacingEntityData extends DataClass return PacingEntityData( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), - createdDate: serializer.fromJson(json['createdDate']), - modifiedDate: serializer.fromJson(json['modifiedDate']), - tags: $PacingEntityTable.$convertertags - .fromJson(serializer.fromJson(json['tags'])), - improvisations: $PacingEntityTable.$converterimprovisations - .fromJson(serializer.fromJson(json['improvisations'])), + createdDate: serializer.fromJson(json['createdDate']), + modifiedDate: serializer.fromJson(json['modifiedDate']), defaultNumberOfTeams: serializer.fromJson(json['defaultNumberOfTeams']), integrationId: serializer.fromJson(json['integrationId']), @@ -302,12 +250,8 @@ class PacingEntityData extends DataClass return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), - 'createdDate': serializer.toJson(createdDate), - 'modifiedDate': serializer.toJson(modifiedDate), - 'tags': serializer - .toJson($PacingEntityTable.$convertertags.toJson(tags)), - 'improvisations': serializer.toJson( - $PacingEntityTable.$converterimprovisations.toJson(improvisations)), + 'createdDate': serializer.toJson(createdDate), + 'modifiedDate': serializer.toJson(modifiedDate), 'defaultNumberOfTeams': serializer.toJson(defaultNumberOfTeams), 'integrationId': serializer.toJson(integrationId), 'integrationEntityId': serializer.toJson(integrationEntityId), @@ -319,10 +263,8 @@ class PacingEntityData extends DataClass PacingEntityData copyWith( {int? id, String? name, - Value createdDate = const Value.absent(), - Value modifiedDate = const Value.absent(), - List? tags, - ImprovisationModel? improvisations, + DateTime? createdDate, + DateTime? modifiedDate, int? defaultNumberOfTeams, Value integrationId = const Value.absent(), Value integrationEntityId = const Value.absent(), @@ -330,11 +272,8 @@ class PacingEntityData extends DataClass PacingEntityData( id: id ?? this.id, name: name ?? this.name, - createdDate: createdDate.present ? createdDate.value : this.createdDate, - modifiedDate: - modifiedDate.present ? modifiedDate.value : this.modifiedDate, - tags: tags ?? this.tags, - improvisations: improvisations ?? this.improvisations, + createdDate: createdDate ?? this.createdDate, + modifiedDate: modifiedDate ?? this.modifiedDate, defaultNumberOfTeams: defaultNumberOfTeams ?? this.defaultNumberOfTeams, integrationId: integrationId.present ? integrationId.value : this.integrationId, @@ -354,10 +293,6 @@ class PacingEntityData extends DataClass modifiedDate: data.modifiedDate.present ? data.modifiedDate.value : this.modifiedDate, - tags: data.tags.present ? data.tags.value : this.tags, - improvisations: data.improvisations.present - ? data.improvisations.value - : this.improvisations, defaultNumberOfTeams: data.defaultNumberOfTeams.present ? data.defaultNumberOfTeams.value : this.defaultNumberOfTeams, @@ -380,8 +315,6 @@ class PacingEntityData extends DataClass ..write('name: $name, ') ..write('createdDate: $createdDate, ') ..write('modifiedDate: $modifiedDate, ') - ..write('tags: $tags, ') - ..write('improvisations: $improvisations, ') ..write('defaultNumberOfTeams: $defaultNumberOfTeams, ') ..write('integrationId: $integrationId, ') ..write('integrationEntityId: $integrationEntityId, ') @@ -396,8 +329,6 @@ class PacingEntityData extends DataClass name, createdDate, modifiedDate, - tags, - improvisations, defaultNumberOfTeams, integrationId, integrationEntityId, @@ -410,8 +341,6 @@ class PacingEntityData extends DataClass other.name == this.name && other.createdDate == this.createdDate && other.modifiedDate == this.modifiedDate && - other.tags == this.tags && - other.improvisations == this.improvisations && other.defaultNumberOfTeams == this.defaultNumberOfTeams && other.integrationId == this.integrationId && other.integrationEntityId == this.integrationEntityId && @@ -421,10 +350,8 @@ class PacingEntityData extends DataClass class PacingEntityCompanion extends UpdateCompanion { final Value id; final Value name; - final Value createdDate; - final Value modifiedDate; - final Value> tags; - final Value improvisations; + final Value createdDate; + final Value modifiedDate; final Value defaultNumberOfTeams; final Value integrationId; final Value integrationEntityId; @@ -434,8 +361,6 @@ class PacingEntityCompanion extends UpdateCompanion { this.name = const Value.absent(), this.createdDate = const Value.absent(), this.modifiedDate = const Value.absent(), - this.tags = const Value.absent(), - this.improvisations = const Value.absent(), this.defaultNumberOfTeams = const Value.absent(), this.integrationId = const Value.absent(), this.integrationEntityId = const Value.absent(), @@ -446,22 +371,16 @@ class PacingEntityCompanion extends UpdateCompanion { required String name, this.createdDate = const Value.absent(), this.modifiedDate = const Value.absent(), - required List tags, - required ImprovisationModel improvisations, this.defaultNumberOfTeams = const Value.absent(), this.integrationId = const Value.absent(), this.integrationEntityId = const Value.absent(), this.integrationAdditionalData = const Value.absent(), - }) : name = Value(name), - tags = Value(tags), - improvisations = Value(improvisations); + }) : name = Value(name); static Insertable custom({ Expression? id, Expression? name, Expression? createdDate, Expression? modifiedDate, - Expression? tags, - Expression? improvisations, Expression? defaultNumberOfTeams, Expression? integrationId, Expression? integrationEntityId, @@ -472,8 +391,6 @@ class PacingEntityCompanion extends UpdateCompanion { if (name != null) 'name': name, if (createdDate != null) 'created_date': createdDate, if (modifiedDate != null) 'modified_date': modifiedDate, - if (tags != null) 'tags': tags, - if (improvisations != null) 'improvisations': improvisations, if (defaultNumberOfTeams != null) 'default_number_of_teams': defaultNumberOfTeams, if (integrationId != null) 'integration_id': integrationId, @@ -487,10 +404,8 @@ class PacingEntityCompanion extends UpdateCompanion { PacingEntityCompanion copyWith( {Value? id, Value? name, - Value? createdDate, - Value? modifiedDate, - Value>? tags, - Value? improvisations, + Value? createdDate, + Value? modifiedDate, Value? defaultNumberOfTeams, Value? integrationId, Value? integrationEntityId, @@ -500,8 +415,6 @@ class PacingEntityCompanion extends UpdateCompanion { name: name ?? this.name, createdDate: createdDate ?? this.createdDate, modifiedDate: modifiedDate ?? this.modifiedDate, - tags: tags ?? this.tags, - improvisations: improvisations ?? this.improvisations, defaultNumberOfTeams: defaultNumberOfTeams ?? this.defaultNumberOfTeams, integrationId: integrationId ?? this.integrationId, integrationEntityId: integrationEntityId ?? this.integrationEntityId, @@ -525,15 +438,6 @@ class PacingEntityCompanion extends UpdateCompanion { if (modifiedDate.present) { map['modified_date'] = Variable(modifiedDate.value); } - if (tags.present) { - map['tags'] = - Variable($PacingEntityTable.$convertertags.toSql(tags.value)); - } - if (improvisations.present) { - map['improvisations'] = Variable($PacingEntityTable - .$converterimprovisations - .toSql(improvisations.value)); - } if (defaultNumberOfTeams.present) { map['default_number_of_teams'] = Variable(defaultNumberOfTeams.value); @@ -559,8 +463,6 @@ class PacingEntityCompanion extends UpdateCompanion { ..write('name: $name, ') ..write('createdDate: $createdDate, ') ..write('modifiedDate: $modifiedDate, ') - ..write('tags: $tags, ') - ..write('improvisations: $improvisations, ') ..write('defaultNumberOfTeams: $defaultNumberOfTeams, ') ..write('integrationId: $integrationId, ') ..write('integrationEntityId: $integrationEntityId, ') @@ -594,54 +496,18 @@ class $MatchEntityTable extends MatchEntity const VerificationMeta('createdDate'); @override late final GeneratedColumn createdDate = GeneratedColumn( - 'created_date', aliasedName, true, - type: DriftSqlType.dateTime, requiredDuringInsert: false); + 'created_date', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Constant(DateTime.now())); static const VerificationMeta _modifiedDateMeta = const VerificationMeta('modifiedDate'); @override late final GeneratedColumn modifiedDate = GeneratedColumn( - 'modified_date', aliasedName, true, - type: DriftSqlType.dateTime, requiredDuringInsert: false); - static const VerificationMeta _tagsMeta = const VerificationMeta('tags'); - @override - late final GeneratedColumnWithTypeConverter, String> tags = - GeneratedColumn('tags', aliasedName, false, - type: DriftSqlType.string, requiredDuringInsert: true) - .withConverter>($MatchEntityTable.$convertertags); - static const VerificationMeta _teamsMeta = const VerificationMeta('teams'); - @override - late final GeneratedColumnWithTypeConverter teams = - GeneratedColumn('teams', aliasedName, false, - type: DriftSqlType.string, requiredDuringInsert: true) - .withConverter($MatchEntityTable.$converterteams); - static const VerificationMeta _improvisationsMeta = - const VerificationMeta('improvisations'); - @override - late final GeneratedColumnWithTypeConverter - improvisations = GeneratedColumn( - 'improvisations', aliasedName, false, - type: DriftSqlType.string, requiredDuringInsert: true) - .withConverter( - $MatchEntityTable.$converterimprovisations); - static const VerificationMeta _penaltiesMeta = - const VerificationMeta('penalties'); - @override - late final GeneratedColumnWithTypeConverter - penalties = GeneratedColumn('penalties', aliasedName, false, - type: DriftSqlType.string, requiredDuringInsert: true) - .withConverter($MatchEntityTable.$converterpenalties); - static const VerificationMeta _pointsMeta = const VerificationMeta('points'); - @override - late final GeneratedColumnWithTypeConverter points = - GeneratedColumn('points', aliasedName, false, - type: DriftSqlType.string, requiredDuringInsert: true) - .withConverter($MatchEntityTable.$converterpoints); - static const VerificationMeta _starsMeta = const VerificationMeta('stars'); - @override - late final GeneratedColumnWithTypeConverter stars = - GeneratedColumn('stars', aliasedName, false, - type: DriftSqlType.string, requiredDuringInsert: true) - .withConverter($MatchEntityTable.$converterstars); + 'modified_date', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Constant(DateTime.now())); static const VerificationMeta _enableStatisticsMeta = const VerificationMeta('enableStatistics'); @override @@ -759,12 +625,6 @@ class $MatchEntityTable extends MatchEntity name, createdDate, modifiedDate, - tags, - teams, - improvisations, - penalties, - points, - stars, enableStatistics, enablePenaltiesImpactPoints, penaltiesImpactType, @@ -810,12 +670,6 @@ class $MatchEntityTable extends MatchEntity modifiedDate.isAcceptableOrUnknown( data['modified_date']!, _modifiedDateMeta)); } - context.handle(_tagsMeta, const VerificationResult.success()); - context.handle(_teamsMeta, const VerificationResult.success()); - context.handle(_improvisationsMeta, const VerificationResult.success()); - context.handle(_penaltiesMeta, const VerificationResult.success()); - context.handle(_pointsMeta, const VerificationResult.success()); - context.handle(_starsMeta, const VerificationResult.success()); if (data.containsKey('enable_statistics')) { context.handle( _enableStatisticsMeta, @@ -908,27 +762,9 @@ class $MatchEntityTable extends MatchEntity name: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}name'])!, createdDate: attachedDatabase.typeMapping - .read(DriftSqlType.dateTime, data['${effectivePrefix}created_date']), - modifiedDate: attachedDatabase.typeMapping - .read(DriftSqlType.dateTime, data['${effectivePrefix}modified_date']), - tags: $MatchEntityTable.$convertertags.fromSql(attachedDatabase - .typeMapping - .read(DriftSqlType.string, data['${effectivePrefix}tags'])!), - teams: $MatchEntityTable.$converterteams.fromSql(attachedDatabase - .typeMapping - .read(DriftSqlType.string, data['${effectivePrefix}teams'])!), - improvisations: $MatchEntityTable.$converterimprovisations.fromSql( - attachedDatabase.typeMapping.read( - DriftSqlType.string, data['${effectivePrefix}improvisations'])!), - penalties: $MatchEntityTable.$converterpenalties.fromSql(attachedDatabase - .typeMapping - .read(DriftSqlType.string, data['${effectivePrefix}penalties'])!), - points: $MatchEntityTable.$converterpoints.fromSql(attachedDatabase - .typeMapping - .read(DriftSqlType.string, data['${effectivePrefix}points'])!), - stars: $MatchEntityTable.$converterstars.fromSql(attachedDatabase - .typeMapping - .read(DriftSqlType.string, data['${effectivePrefix}stars'])!), + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_date'])!, + modifiedDate: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, data['${effectivePrefix}modified_date'])!, enableStatistics: attachedDatabase.typeMapping.read( DriftSqlType.bool, data['${effectivePrefix}enable_statistics'])!, enablePenaltiesImpactPoints: attachedDatabase.typeMapping.read( @@ -975,23 +811,11 @@ class $MatchEntityTable extends MatchEntity return $MatchEntityTable(attachedDatabase, alias); } - static JsonTypeConverter2, String, String> $convertertags = - const TagsConverter(); - static JsonTypeConverter2 $converterteams = - MatchTeamModel.converter; - static JsonTypeConverter2 - $converterimprovisations = MatchTeamModel.converter; - static JsonTypeConverter2 - $converterpenalties = MatchTeamModel.converter; - static JsonTypeConverter2 $converterpoints = - MatchTeamModel.converter; - static JsonTypeConverter2 $converterstars = - MatchTeamModel.converter; static JsonTypeConverter2 $converterpenaltiesImpactType = const EnumIndexConverter(PenaltiesImpactType.values); static JsonTypeConverter2, String, String> - $converterintegrationPenaltyTypes = const TagsConverter(); + $converterintegrationPenaltyTypes = const StringListConverter(); static JsonTypeConverter2?, String?, String?> $converterintegrationPenaltyTypesn = JsonTypeConverter2.asNullable($converterintegrationPenaltyTypes); @@ -1000,14 +824,8 @@ class $MatchEntityTable extends MatchEntity class MatchEntityData extends DataClass implements Insertable { final int id; final String name; - final DateTime? createdDate; - final DateTime? modifiedDate; - final List tags; - final MatchTeamModel teams; - final MatchTeamModel improvisations; - final MatchTeamModel penalties; - final MatchTeamModel points; - final MatchTeamModel stars; + final DateTime createdDate; + final DateTime modifiedDate; final bool enableStatistics; final bool enablePenaltiesImpactPoints; final PenaltiesImpactType penaltiesImpactType; @@ -1024,14 +842,8 @@ class MatchEntityData extends DataClass implements Insertable { const MatchEntityData( {required this.id, required this.name, - this.createdDate, - this.modifiedDate, - required this.tags, - required this.teams, - required this.improvisations, - required this.penalties, - required this.points, - required this.stars, + required this.createdDate, + required this.modifiedDate, required this.enableStatistics, required this.enablePenaltiesImpactPoints, required this.penaltiesImpactType, @@ -1050,36 +862,8 @@ class MatchEntityData extends DataClass implements Insertable { final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); - if (!nullToAbsent || createdDate != null) { - map['created_date'] = Variable(createdDate); - } - if (!nullToAbsent || modifiedDate != null) { - map['modified_date'] = Variable(modifiedDate); - } - { - map['tags'] = - Variable($MatchEntityTable.$convertertags.toSql(tags)); - } - { - map['teams'] = - Variable($MatchEntityTable.$converterteams.toSql(teams)); - } - { - map['improvisations'] = Variable( - $MatchEntityTable.$converterimprovisations.toSql(improvisations)); - } - { - map['penalties'] = Variable( - $MatchEntityTable.$converterpenalties.toSql(penalties)); - } - { - map['points'] = - Variable($MatchEntityTable.$converterpoints.toSql(points)); - } - { - map['stars'] = - Variable($MatchEntityTable.$converterstars.toSql(stars)); - } + map['created_date'] = Variable(createdDate); + map['modified_date'] = Variable(modifiedDate); map['enable_statistics'] = Variable(enableStatistics); map['enable_penalties_impact_points'] = Variable(enablePenaltiesImpactPoints); @@ -1128,18 +912,8 @@ class MatchEntityData extends DataClass implements Insertable { return MatchEntityCompanion( id: Value(id), name: Value(name), - createdDate: createdDate == null && nullToAbsent - ? const Value.absent() - : Value(createdDate), - modifiedDate: modifiedDate == null && nullToAbsent - ? const Value.absent() - : Value(modifiedDate), - tags: Value(tags), - teams: Value(teams), - improvisations: Value(improvisations), - penalties: Value(penalties), - points: Value(points), - stars: Value(stars), + createdDate: Value(createdDate), + modifiedDate: Value(modifiedDate), enableStatistics: Value(enableStatistics), enablePenaltiesImpactPoints: Value(enablePenaltiesImpactPoints), penaltiesImpactType: Value(penaltiesImpactType), @@ -1181,20 +955,8 @@ class MatchEntityData extends DataClass implements Insertable { return MatchEntityData( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), - createdDate: serializer.fromJson(json['createdDate']), - modifiedDate: serializer.fromJson(json['modifiedDate']), - tags: $MatchEntityTable.$convertertags - .fromJson(serializer.fromJson(json['tags'])), - teams: $MatchEntityTable.$converterteams - .fromJson(serializer.fromJson(json['teams'])), - improvisations: $MatchEntityTable.$converterimprovisations - .fromJson(serializer.fromJson(json['improvisations'])), - penalties: $MatchEntityTable.$converterpenalties - .fromJson(serializer.fromJson(json['penalties'])), - points: $MatchEntityTable.$converterpoints - .fromJson(serializer.fromJson(json['points'])), - stars: $MatchEntityTable.$converterstars - .fromJson(serializer.fromJson(json['stars'])), + createdDate: serializer.fromJson(json['createdDate']), + modifiedDate: serializer.fromJson(json['modifiedDate']), enableStatistics: serializer.fromJson(json['enableStatistics']), enablePenaltiesImpactPoints: serializer.fromJson(json['enablePenaltiesImpactPoints']), @@ -1229,20 +991,8 @@ class MatchEntityData extends DataClass implements Insertable { return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), - 'createdDate': serializer.toJson(createdDate), - 'modifiedDate': serializer.toJson(modifiedDate), - 'tags': serializer - .toJson($MatchEntityTable.$convertertags.toJson(tags)), - 'teams': serializer - .toJson($MatchEntityTable.$converterteams.toJson(teams)), - 'improvisations': serializer.toJson( - $MatchEntityTable.$converterimprovisations.toJson(improvisations)), - 'penalties': serializer.toJson( - $MatchEntityTable.$converterpenalties.toJson(penalties)), - 'points': serializer - .toJson($MatchEntityTable.$converterpoints.toJson(points)), - 'stars': serializer - .toJson($MatchEntityTable.$converterstars.toJson(stars)), + 'createdDate': serializer.toJson(createdDate), + 'modifiedDate': serializer.toJson(modifiedDate), 'enableStatistics': serializer.toJson(enableStatistics), 'enablePenaltiesImpactPoints': serializer.toJson(enablePenaltiesImpactPoints), @@ -1273,14 +1023,8 @@ class MatchEntityData extends DataClass implements Insertable { MatchEntityData copyWith( {int? id, String? name, - Value createdDate = const Value.absent(), - Value modifiedDate = const Value.absent(), - List? tags, - MatchTeamModel? teams, - MatchTeamModel? improvisations, - MatchTeamModel? penalties, - MatchTeamModel? points, - MatchTeamModel? stars, + DateTime? createdDate, + DateTime? modifiedDate, bool? enableStatistics, bool? enablePenaltiesImpactPoints, PenaltiesImpactType? penaltiesImpactType, @@ -1301,15 +1045,8 @@ class MatchEntityData extends DataClass implements Insertable { MatchEntityData( id: id ?? this.id, name: name ?? this.name, - createdDate: createdDate.present ? createdDate.value : this.createdDate, - modifiedDate: - modifiedDate.present ? modifiedDate.value : this.modifiedDate, - tags: tags ?? this.tags, - teams: teams ?? this.teams, - improvisations: improvisations ?? this.improvisations, - penalties: penalties ?? this.penalties, - points: points ?? this.points, - stars: stars ?? this.stars, + createdDate: createdDate ?? this.createdDate, + modifiedDate: modifiedDate ?? this.modifiedDate, enableStatistics: enableStatistics ?? this.enableStatistics, enablePenaltiesImpactPoints: enablePenaltiesImpactPoints ?? this.enablePenaltiesImpactPoints, @@ -1352,14 +1089,6 @@ class MatchEntityData extends DataClass implements Insertable { modifiedDate: data.modifiedDate.present ? data.modifiedDate.value : this.modifiedDate, - tags: data.tags.present ? data.tags.value : this.tags, - teams: data.teams.present ? data.teams.value : this.teams, - improvisations: data.improvisations.present - ? data.improvisations.value - : this.improvisations, - penalties: data.penalties.present ? data.penalties.value : this.penalties, - points: data.points.present ? data.points.value : this.points, - stars: data.stars.present ? data.stars.value : this.stars, enableStatistics: data.enableStatistics.present ? data.enableStatistics.value : this.enableStatistics, @@ -1413,12 +1142,6 @@ class MatchEntityData extends DataClass implements Insertable { ..write('name: $name, ') ..write('createdDate: $createdDate, ') ..write('modifiedDate: $modifiedDate, ') - ..write('tags: $tags, ') - ..write('teams: $teams, ') - ..write('improvisations: $improvisations, ') - ..write('penalties: $penalties, ') - ..write('points: $points, ') - ..write('stars: $stars, ') ..write('enableStatistics: $enableStatistics, ') ..write('enablePenaltiesImpactPoints: $enablePenaltiesImpactPoints, ') ..write('penaltiesImpactType: $penaltiesImpactType, ') @@ -1441,31 +1164,24 @@ class MatchEntityData extends DataClass implements Insertable { } @override - int get hashCode => Object.hashAll([ - id, - name, - createdDate, - modifiedDate, - tags, - teams, - improvisations, - penalties, - points, - stars, - enableStatistics, - enablePenaltiesImpactPoints, - penaltiesImpactType, - penaltiesRequiredToImpactPoints, - enableMatchExpulsion, - penaltiesRequiredToExpel, - integrationId, - integrationEntityId, - integrationAdditionalData, - integrationRestrictMaximumPointPerImprovisation, - integrationMinNumberOfImprovisations, - integrationMaxNumberOfImprovisations, - integrationPenaltyTypes - ]); + int get hashCode => Object.hash( + id, + name, + createdDate, + modifiedDate, + enableStatistics, + enablePenaltiesImpactPoints, + penaltiesImpactType, + penaltiesRequiredToImpactPoints, + enableMatchExpulsion, + penaltiesRequiredToExpel, + integrationId, + integrationEntityId, + integrationAdditionalData, + integrationRestrictMaximumPointPerImprovisation, + integrationMinNumberOfImprovisations, + integrationMaxNumberOfImprovisations, + integrationPenaltyTypes); @override bool operator ==(Object other) => identical(this, other) || @@ -1474,12 +1190,6 @@ class MatchEntityData extends DataClass implements Insertable { other.name == this.name && other.createdDate == this.createdDate && other.modifiedDate == this.modifiedDate && - other.tags == this.tags && - other.teams == this.teams && - other.improvisations == this.improvisations && - other.penalties == this.penalties && - other.points == this.points && - other.stars == this.stars && other.enableStatistics == this.enableStatistics && other.enablePenaltiesImpactPoints == this.enablePenaltiesImpactPoints && @@ -1503,14 +1213,8 @@ class MatchEntityData extends DataClass implements Insertable { class MatchEntityCompanion extends UpdateCompanion { final Value id; final Value name; - final Value createdDate; - final Value modifiedDate; - final Value> tags; - final Value teams; - final Value improvisations; - final Value penalties; - final Value points; - final Value stars; + final Value createdDate; + final Value modifiedDate; final Value enableStatistics; final Value enablePenaltiesImpactPoints; final Value penaltiesImpactType; @@ -1529,12 +1233,6 @@ class MatchEntityCompanion extends UpdateCompanion { this.name = const Value.absent(), this.createdDate = const Value.absent(), this.modifiedDate = const Value.absent(), - this.tags = const Value.absent(), - this.teams = const Value.absent(), - this.improvisations = const Value.absent(), - this.penalties = const Value.absent(), - this.points = const Value.absent(), - this.stars = const Value.absent(), this.enableStatistics = const Value.absent(), this.enablePenaltiesImpactPoints = const Value.absent(), this.penaltiesImpactType = const Value.absent(), @@ -1554,12 +1252,6 @@ class MatchEntityCompanion extends UpdateCompanion { required String name, this.createdDate = const Value.absent(), this.modifiedDate = const Value.absent(), - required List tags, - required MatchTeamModel teams, - required MatchTeamModel improvisations, - required MatchTeamModel penalties, - required MatchTeamModel points, - required MatchTeamModel stars, this.enableStatistics = const Value.absent(), this.enablePenaltiesImpactPoints = const Value.absent(), this.penaltiesImpactType = const Value.absent(), @@ -1573,24 +1265,12 @@ class MatchEntityCompanion extends UpdateCompanion { this.integrationMinNumberOfImprovisations = const Value.absent(), this.integrationMaxNumberOfImprovisations = const Value.absent(), this.integrationPenaltyTypes = const Value.absent(), - }) : name = Value(name), - tags = Value(tags), - teams = Value(teams), - improvisations = Value(improvisations), - penalties = Value(penalties), - points = Value(points), - stars = Value(stars); + }) : name = Value(name); static Insertable custom({ Expression? id, Expression? name, Expression? createdDate, Expression? modifiedDate, - Expression? tags, - Expression? teams, - Expression? improvisations, - Expression? penalties, - Expression? points, - Expression? stars, Expression? enableStatistics, Expression? enablePenaltiesImpactPoints, Expression? penaltiesImpactType, @@ -1610,12 +1290,6 @@ class MatchEntityCompanion extends UpdateCompanion { if (name != null) 'name': name, if (createdDate != null) 'created_date': createdDate, if (modifiedDate != null) 'modified_date': modifiedDate, - if (tags != null) 'tags': tags, - if (teams != null) 'teams': teams, - if (improvisations != null) 'improvisations': improvisations, - if (penalties != null) 'penalties': penalties, - if (points != null) 'points': points, - if (stars != null) 'stars': stars, if (enableStatistics != null) 'enable_statistics': enableStatistics, if (enablePenaltiesImpactPoints != null) 'enable_penalties_impact_points': enablePenaltiesImpactPoints, @@ -1649,14 +1323,8 @@ class MatchEntityCompanion extends UpdateCompanion { MatchEntityCompanion copyWith( {Value? id, Value? name, - Value? createdDate, - Value? modifiedDate, - Value>? tags, - Value? teams, - Value? improvisations, - Value? penalties, - Value? points, - Value? stars, + Value? createdDate, + Value? modifiedDate, Value? enableStatistics, Value? enablePenaltiesImpactPoints, Value? penaltiesImpactType, @@ -1675,12 +1343,6 @@ class MatchEntityCompanion extends UpdateCompanion { name: name ?? this.name, createdDate: createdDate ?? this.createdDate, modifiedDate: modifiedDate ?? this.modifiedDate, - tags: tags ?? this.tags, - teams: teams ?? this.teams, - improvisations: improvisations ?? this.improvisations, - penalties: penalties ?? this.penalties, - points: points ?? this.points, - stars: stars ?? this.stars, enableStatistics: enableStatistics ?? this.enableStatistics, enablePenaltiesImpactPoints: enablePenaltiesImpactPoints ?? this.enablePenaltiesImpactPoints, @@ -1723,31 +1385,6 @@ class MatchEntityCompanion extends UpdateCompanion { if (modifiedDate.present) { map['modified_date'] = Variable(modifiedDate.value); } - if (tags.present) { - map['tags'] = - Variable($MatchEntityTable.$convertertags.toSql(tags.value)); - } - if (teams.present) { - map['teams'] = Variable( - $MatchEntityTable.$converterteams.toSql(teams.value)); - } - if (improvisations.present) { - map['improvisations'] = Variable($MatchEntityTable - .$converterimprovisations - .toSql(improvisations.value)); - } - if (penalties.present) { - map['penalties'] = Variable( - $MatchEntityTable.$converterpenalties.toSql(penalties.value)); - } - if (points.present) { - map['points'] = Variable( - $MatchEntityTable.$converterpoints.toSql(points.value)); - } - if (stars.present) { - map['stars'] = Variable( - $MatchEntityTable.$converterstars.toSql(stars.value)); - } if (enableStatistics.present) { map['enable_statistics'] = Variable(enableStatistics.value); } @@ -1810,12 +1447,6 @@ class MatchEntityCompanion extends UpdateCompanion { ..write('name: $name, ') ..write('createdDate: $createdDate, ') ..write('modifiedDate: $modifiedDate, ') - ..write('tags: $tags, ') - ..write('teams: $teams, ') - ..write('improvisations: $improvisations, ') - ..write('penalties: $penalties, ') - ..write('points: $points, ') - ..write('stars: $stars, ') ..write('enableStatistics: $enableStatistics, ') ..write('enablePenaltiesImpactPoints: $enablePenaltiesImpactPoints, ') ..write('penaltiesImpactType: $penaltiesImpactType, ') @@ -1862,35 +1493,26 @@ class $TeamEntityTable extends TeamEntity const VerificationMeta('createdDate'); @override late final GeneratedColumn createdDate = GeneratedColumn( - 'created_date', aliasedName, true, - type: DriftSqlType.dateTime, requiredDuringInsert: false); + 'created_date', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Constant(DateTime.now())); static const VerificationMeta _modifiedDateMeta = const VerificationMeta('modifiedDate'); @override late final GeneratedColumn modifiedDate = GeneratedColumn( - 'modified_date', aliasedName, true, - type: DriftSqlType.dateTime, requiredDuringInsert: false); + 'modified_date', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Constant(DateTime.now())); static const VerificationMeta _colorMeta = const VerificationMeta('color'); @override late final GeneratedColumn color = GeneratedColumn( 'color', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true); - static const VerificationMeta _performersMeta = - const VerificationMeta('performers'); - @override - late final GeneratedColumnWithTypeConverter - performers = GeneratedColumn('performers', aliasedName, false, - type: DriftSqlType.string, requiredDuringInsert: true) - .withConverter($TeamEntityTable.$converterperformers); - static const VerificationMeta _tagsMeta = const VerificationMeta('tags'); - @override - late final GeneratedColumnWithTypeConverter, String> tags = - GeneratedColumn('tags', aliasedName, false, - type: DriftSqlType.string, requiredDuringInsert: true) - .withConverter>($TeamEntityTable.$convertertags); @override List get $columns => - [id, name, createdDate, modifiedDate, color, performers, tags]; + [id, name, createdDate, modifiedDate, color]; @override String get aliasedName => _alias ?? actualTableName; @override @@ -1928,8 +1550,6 @@ class $TeamEntityTable extends TeamEntity } else if (isInserting) { context.missing(_colorMeta); } - context.handle(_performersMeta, const VerificationResult.success()); - context.handle(_tagsMeta, const VerificationResult.success()); return context; } @@ -1944,16 +1564,11 @@ class $TeamEntityTable extends TeamEntity name: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}name'])!, createdDate: attachedDatabase.typeMapping - .read(DriftSqlType.dateTime, data['${effectivePrefix}created_date']), - modifiedDate: attachedDatabase.typeMapping - .read(DriftSqlType.dateTime, data['${effectivePrefix}modified_date']), + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_date'])!, + modifiedDate: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, data['${effectivePrefix}modified_date'])!, color: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}color'])!, - performers: $TeamEntityTable.$converterperformers.fromSql(attachedDatabase - .typeMapping - .read(DriftSqlType.string, data['${effectivePrefix}performers'])!), - tags: $TeamEntityTable.$convertertags.fromSql(attachedDatabase.typeMapping - .read(DriftSqlType.string, data['${effectivePrefix}tags'])!), ); } @@ -1961,49 +1576,28 @@ class $TeamEntityTable extends TeamEntity $TeamEntityTable createAlias(String alias) { return $TeamEntityTable(attachedDatabase, alias); } - - static JsonTypeConverter2 - $converterperformers = PerformerModel.converter; - static JsonTypeConverter2, String, String> $convertertags = - const TagsConverter(); } class TeamEntityData extends DataClass implements Insertable { final int id; final String name; - final DateTime? createdDate; - final DateTime? modifiedDate; + final DateTime createdDate; + final DateTime modifiedDate; final int color; - final PerformerModel performers; - final List tags; const TeamEntityData( {required this.id, required this.name, - this.createdDate, - this.modifiedDate, - required this.color, - required this.performers, - required this.tags}); + required this.createdDate, + required this.modifiedDate, + required this.color}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); - if (!nullToAbsent || createdDate != null) { - map['created_date'] = Variable(createdDate); - } - if (!nullToAbsent || modifiedDate != null) { - map['modified_date'] = Variable(modifiedDate); - } + map['created_date'] = Variable(createdDate); + map['modified_date'] = Variable(modifiedDate); map['color'] = Variable(color); - { - map['performers'] = Variable( - $TeamEntityTable.$converterperformers.toSql(performers)); - } - { - map['tags'] = - Variable($TeamEntityTable.$convertertags.toSql(tags)); - } return map; } @@ -2011,15 +1605,9 @@ class TeamEntityData extends DataClass implements Insertable { return TeamEntityCompanion( id: Value(id), name: Value(name), - createdDate: createdDate == null && nullToAbsent - ? const Value.absent() - : Value(createdDate), - modifiedDate: modifiedDate == null && nullToAbsent - ? const Value.absent() - : Value(modifiedDate), + createdDate: Value(createdDate), + modifiedDate: Value(modifiedDate), color: Value(color), - performers: Value(performers), - tags: Value(tags), ); } @@ -2029,13 +1617,9 @@ class TeamEntityData extends DataClass implements Insertable { return TeamEntityData( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), - createdDate: serializer.fromJson(json['createdDate']), - modifiedDate: serializer.fromJson(json['modifiedDate']), + createdDate: serializer.fromJson(json['createdDate']), + modifiedDate: serializer.fromJson(json['modifiedDate']), color: serializer.fromJson(json['color']), - performers: $TeamEntityTable.$converterperformers - .fromJson(serializer.fromJson(json['performers'])), - tags: $TeamEntityTable.$convertertags - .fromJson(serializer.fromJson(json['tags'])), ); } @override @@ -2044,33 +1628,24 @@ class TeamEntityData extends DataClass implements Insertable { return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), - 'createdDate': serializer.toJson(createdDate), - 'modifiedDate': serializer.toJson(modifiedDate), + 'createdDate': serializer.toJson(createdDate), + 'modifiedDate': serializer.toJson(modifiedDate), 'color': serializer.toJson(color), - 'performers': serializer.toJson( - $TeamEntityTable.$converterperformers.toJson(performers)), - 'tags': serializer - .toJson($TeamEntityTable.$convertertags.toJson(tags)), }; } TeamEntityData copyWith( {int? id, String? name, - Value createdDate = const Value.absent(), - Value modifiedDate = const Value.absent(), - int? color, - PerformerModel? performers, - List? tags}) => + DateTime? createdDate, + DateTime? modifiedDate, + int? color}) => TeamEntityData( id: id ?? this.id, name: name ?? this.name, - createdDate: createdDate.present ? createdDate.value : this.createdDate, - modifiedDate: - modifiedDate.present ? modifiedDate.value : this.modifiedDate, + createdDate: createdDate ?? this.createdDate, + modifiedDate: modifiedDate ?? this.modifiedDate, color: color ?? this.color, - performers: performers ?? this.performers, - tags: tags ?? this.tags, ); TeamEntityData copyWithCompanion(TeamEntityCompanion data) { return TeamEntityData( @@ -2082,9 +1657,6 @@ class TeamEntityData extends DataClass implements Insertable { ? data.modifiedDate.value : this.modifiedDate, color: data.color.present ? data.color.value : this.color, - performers: - data.performers.present ? data.performers.value : this.performers, - tags: data.tags.present ? data.tags.value : this.tags, ); } @@ -2095,16 +1667,13 @@ class TeamEntityData extends DataClass implements Insertable { ..write('name: $name, ') ..write('createdDate: $createdDate, ') ..write('modifiedDate: $modifiedDate, ') - ..write('color: $color, ') - ..write('performers: $performers, ') - ..write('tags: $tags') + ..write('color: $color') ..write(')')) .toString(); } @override - int get hashCode => - Object.hash(id, name, createdDate, modifiedDate, color, performers, tags); + int get hashCode => Object.hash(id, name, createdDate, modifiedDate, color); @override bool operator ==(Object other) => identical(this, other) || @@ -2113,27 +1682,21 @@ class TeamEntityData extends DataClass implements Insertable { other.name == this.name && other.createdDate == this.createdDate && other.modifiedDate == this.modifiedDate && - other.color == this.color && - other.performers == this.performers && - other.tags == this.tags); + other.color == this.color); } class TeamEntityCompanion extends UpdateCompanion { final Value id; final Value name; - final Value createdDate; - final Value modifiedDate; + final Value createdDate; + final Value modifiedDate; final Value color; - final Value performers; - final Value> tags; const TeamEntityCompanion({ this.id = const Value.absent(), this.name = const Value.absent(), this.createdDate = const Value.absent(), this.modifiedDate = const Value.absent(), this.color = const Value.absent(), - this.performers = const Value.absent(), - this.tags = const Value.absent(), }); TeamEntityCompanion.insert({ this.id = const Value.absent(), @@ -2141,20 +1704,14 @@ class TeamEntityCompanion extends UpdateCompanion { this.createdDate = const Value.absent(), this.modifiedDate = const Value.absent(), required int color, - required PerformerModel performers, - required List tags, }) : name = Value(name), - color = Value(color), - performers = Value(performers), - tags = Value(tags); + color = Value(color); static Insertable custom({ Expression? id, Expression? name, Expression? createdDate, Expression? modifiedDate, Expression? color, - Expression? performers, - Expression? tags, }) { return RawValuesInsertable({ if (id != null) 'id': id, @@ -2162,27 +1719,21 @@ class TeamEntityCompanion extends UpdateCompanion { if (createdDate != null) 'created_date': createdDate, if (modifiedDate != null) 'modified_date': modifiedDate, if (color != null) 'color': color, - if (performers != null) 'performers': performers, - if (tags != null) 'tags': tags, }); } TeamEntityCompanion copyWith( {Value? id, Value? name, - Value? createdDate, - Value? modifiedDate, - Value? color, - Value? performers, - Value>? tags}) { + Value? createdDate, + Value? modifiedDate, + Value? color}) { return TeamEntityCompanion( id: id ?? this.id, name: name ?? this.name, createdDate: createdDate ?? this.createdDate, modifiedDate: modifiedDate ?? this.modifiedDate, color: color ?? this.color, - performers: performers ?? this.performers, - tags: tags ?? this.tags, ); } @@ -2204,14 +1755,6 @@ class TeamEntityCompanion extends UpdateCompanion { if (color.present) { map['color'] = Variable(color.value); } - if (performers.present) { - map['performers'] = Variable( - $TeamEntityTable.$converterperformers.toSql(performers.value)); - } - if (tags.present) { - map['tags'] = - Variable($TeamEntityTable.$convertertags.toSql(tags.value)); - } return map; } @@ -2222,9 +1765,7 @@ class TeamEntityCompanion extends UpdateCompanion { ..write('name: $name, ') ..write('createdDate: $createdDate, ') ..write('modifiedDate: $modifiedDate, ') - ..write('color: $color, ') - ..write('performers: $performers, ') - ..write('tags: $tags') + ..write('color: $color') ..write(')')) .toString(); } @@ -2248,10 +1789,8 @@ typedef $$PacingEntityTableCreateCompanionBuilder = PacingEntityCompanion Function({ Value id, required String name, - Value createdDate, - Value modifiedDate, - required List tags, - required ImprovisationModel improvisations, + Value createdDate, + Value modifiedDate, Value defaultNumberOfTeams, Value integrationId, Value integrationEntityId, @@ -2261,10 +1800,8 @@ typedef $$PacingEntityTableUpdateCompanionBuilder = PacingEntityCompanion Function({ Value id, Value name, - Value createdDate, - Value modifiedDate, - Value> tags, - Value improvisations, + Value createdDate, + Value modifiedDate, Value defaultNumberOfTeams, Value integrationId, Value integrationEntityId, @@ -2292,16 +1829,6 @@ class $$PacingEntityTableFilterComposer ColumnFilters get modifiedDate => $composableBuilder( column: $table.modifiedDate, builder: (column) => ColumnFilters(column)); - ColumnWithTypeConverterFilters, List, String> get tags => - $composableBuilder( - column: $table.tags, - builder: (column) => ColumnWithTypeConverterFilters(column)); - - ColumnWithTypeConverterFilters - get improvisations => $composableBuilder( - column: $table.improvisations, - builder: (column) => ColumnWithTypeConverterFilters(column)); - ColumnFilters get defaultNumberOfTeams => $composableBuilder( column: $table.defaultNumberOfTeams, builder: (column) => ColumnFilters(column)); @@ -2340,13 +1867,6 @@ class $$PacingEntityTableOrderingComposer column: $table.modifiedDate, builder: (column) => ColumnOrderings(column)); - ColumnOrderings get tags => $composableBuilder( - column: $table.tags, builder: (column) => ColumnOrderings(column)); - - ColumnOrderings get improvisations => $composableBuilder( - column: $table.improvisations, - builder: (column) => ColumnOrderings(column)); - ColumnOrderings get defaultNumberOfTeams => $composableBuilder( column: $table.defaultNumberOfTeams, builder: (column) => ColumnOrderings(column)); @@ -2385,13 +1905,6 @@ class $$PacingEntityTableAnnotationComposer GeneratedColumn get modifiedDate => $composableBuilder( column: $table.modifiedDate, builder: (column) => column); - GeneratedColumnWithTypeConverter, String> get tags => - $composableBuilder(column: $table.tags, builder: (column) => column); - - GeneratedColumnWithTypeConverter - get improvisations => $composableBuilder( - column: $table.improvisations, builder: (column) => column); - GeneratedColumn get defaultNumberOfTeams => $composableBuilder( column: $table.defaultNumberOfTeams, builder: (column) => column); @@ -2433,10 +1946,8 @@ class $$PacingEntityTableTableManager extends RootTableManager< updateCompanionCallback: ({ Value id = const Value.absent(), Value name = const Value.absent(), - Value createdDate = const Value.absent(), - Value modifiedDate = const Value.absent(), - Value> tags = const Value.absent(), - Value improvisations = const Value.absent(), + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), Value defaultNumberOfTeams = const Value.absent(), Value integrationId = const Value.absent(), Value integrationEntityId = const Value.absent(), @@ -2447,8 +1958,6 @@ class $$PacingEntityTableTableManager extends RootTableManager< name: name, createdDate: createdDate, modifiedDate: modifiedDate, - tags: tags, - improvisations: improvisations, defaultNumberOfTeams: defaultNumberOfTeams, integrationId: integrationId, integrationEntityId: integrationEntityId, @@ -2457,10 +1966,8 @@ class $$PacingEntityTableTableManager extends RootTableManager< createCompanionCallback: ({ Value id = const Value.absent(), required String name, - Value createdDate = const Value.absent(), - Value modifiedDate = const Value.absent(), - required List tags, - required ImprovisationModel improvisations, + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), Value defaultNumberOfTeams = const Value.absent(), Value integrationId = const Value.absent(), Value integrationEntityId = const Value.absent(), @@ -2471,8 +1978,6 @@ class $$PacingEntityTableTableManager extends RootTableManager< name: name, createdDate: createdDate, modifiedDate: modifiedDate, - tags: tags, - improvisations: improvisations, defaultNumberOfTeams: defaultNumberOfTeams, integrationId: integrationId, integrationEntityId: integrationEntityId, @@ -2504,14 +2009,8 @@ typedef $$MatchEntityTableCreateCompanionBuilder = MatchEntityCompanion Function({ Value id, required String name, - Value createdDate, - Value modifiedDate, - required List tags, - required MatchTeamModel teams, - required MatchTeamModel improvisations, - required MatchTeamModel penalties, - required MatchTeamModel points, - required MatchTeamModel stars, + Value createdDate, + Value modifiedDate, Value enableStatistics, Value enablePenaltiesImpactPoints, Value penaltiesImpactType, @@ -2530,14 +2029,8 @@ typedef $$MatchEntityTableUpdateCompanionBuilder = MatchEntityCompanion Function({ Value id, Value name, - Value createdDate, - Value modifiedDate, - Value> tags, - Value teams, - Value improvisations, - Value penalties, - Value points, - Value stars, + Value createdDate, + Value modifiedDate, Value enableStatistics, Value enablePenaltiesImpactPoints, Value penaltiesImpactType, @@ -2574,36 +2067,6 @@ class $$MatchEntityTableFilterComposer ColumnFilters get modifiedDate => $composableBuilder( column: $table.modifiedDate, builder: (column) => ColumnFilters(column)); - ColumnWithTypeConverterFilters, List, String> get tags => - $composableBuilder( - column: $table.tags, - builder: (column) => ColumnWithTypeConverterFilters(column)); - - ColumnWithTypeConverterFilters - get teams => $composableBuilder( - column: $table.teams, - builder: (column) => ColumnWithTypeConverterFilters(column)); - - ColumnWithTypeConverterFilters - get improvisations => $composableBuilder( - column: $table.improvisations, - builder: (column) => ColumnWithTypeConverterFilters(column)); - - ColumnWithTypeConverterFilters - get penalties => $composableBuilder( - column: $table.penalties, - builder: (column) => ColumnWithTypeConverterFilters(column)); - - ColumnWithTypeConverterFilters - get points => $composableBuilder( - column: $table.points, - builder: (column) => ColumnWithTypeConverterFilters(column)); - - ColumnWithTypeConverterFilters - get stars => $composableBuilder( - column: $table.stars, - builder: (column) => ColumnWithTypeConverterFilters(column)); - ColumnFilters get enableStatistics => $composableBuilder( column: $table.enableStatistics, builder: (column) => ColumnFilters(column)); @@ -2683,25 +2146,6 @@ class $$MatchEntityTableOrderingComposer column: $table.modifiedDate, builder: (column) => ColumnOrderings(column)); - ColumnOrderings get tags => $composableBuilder( - column: $table.tags, builder: (column) => ColumnOrderings(column)); - - ColumnOrderings get teams => $composableBuilder( - column: $table.teams, builder: (column) => ColumnOrderings(column)); - - ColumnOrderings get improvisations => $composableBuilder( - column: $table.improvisations, - builder: (column) => ColumnOrderings(column)); - - ColumnOrderings get penalties => $composableBuilder( - column: $table.penalties, builder: (column) => ColumnOrderings(column)); - - ColumnOrderings get points => $composableBuilder( - column: $table.points, builder: (column) => ColumnOrderings(column)); - - ColumnOrderings get stars => $composableBuilder( - column: $table.stars, builder: (column) => ColumnOrderings(column)); - ColumnOrderings get enableStatistics => $composableBuilder( column: $table.enableStatistics, builder: (column) => ColumnOrderings(column)); @@ -2780,25 +2224,6 @@ class $$MatchEntityTableAnnotationComposer GeneratedColumn get modifiedDate => $composableBuilder( column: $table.modifiedDate, builder: (column) => column); - GeneratedColumnWithTypeConverter, String> get tags => - $composableBuilder(column: $table.tags, builder: (column) => column); - - GeneratedColumnWithTypeConverter get teams => - $composableBuilder(column: $table.teams, builder: (column) => column); - - GeneratedColumnWithTypeConverter get improvisations => - $composableBuilder( - column: $table.improvisations, builder: (column) => column); - - GeneratedColumnWithTypeConverter get penalties => - $composableBuilder(column: $table.penalties, builder: (column) => column); - - GeneratedColumnWithTypeConverter get points => - $composableBuilder(column: $table.points, builder: (column) => column); - - GeneratedColumnWithTypeConverter get stars => - $composableBuilder(column: $table.stars, builder: (column) => column); - GeneratedColumn get enableStatistics => $composableBuilder( column: $table.enableStatistics, builder: (column) => column); @@ -2877,14 +2302,8 @@ class $$MatchEntityTableTableManager extends RootTableManager< updateCompanionCallback: ({ Value id = const Value.absent(), Value name = const Value.absent(), - Value createdDate = const Value.absent(), - Value modifiedDate = const Value.absent(), - Value> tags = const Value.absent(), - Value teams = const Value.absent(), - Value improvisations = const Value.absent(), - Value penalties = const Value.absent(), - Value points = const Value.absent(), - Value stars = const Value.absent(), + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), Value enableStatistics = const Value.absent(), Value enablePenaltiesImpactPoints = const Value.absent(), Value penaltiesImpactType = @@ -2908,12 +2327,6 @@ class $$MatchEntityTableTableManager extends RootTableManager< name: name, createdDate: createdDate, modifiedDate: modifiedDate, - tags: tags, - teams: teams, - improvisations: improvisations, - penalties: penalties, - points: points, - stars: stars, enableStatistics: enableStatistics, enablePenaltiesImpactPoints: enablePenaltiesImpactPoints, penaltiesImpactType: penaltiesImpactType, @@ -2934,14 +2347,8 @@ class $$MatchEntityTableTableManager extends RootTableManager< createCompanionCallback: ({ Value id = const Value.absent(), required String name, - Value createdDate = const Value.absent(), - Value modifiedDate = const Value.absent(), - required List tags, - required MatchTeamModel teams, - required MatchTeamModel improvisations, - required MatchTeamModel penalties, - required MatchTeamModel points, - required MatchTeamModel stars, + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), Value enableStatistics = const Value.absent(), Value enablePenaltiesImpactPoints = const Value.absent(), Value penaltiesImpactType = @@ -2965,12 +2372,6 @@ class $$MatchEntityTableTableManager extends RootTableManager< name: name, createdDate: createdDate, modifiedDate: modifiedDate, - tags: tags, - teams: teams, - improvisations: improvisations, - penalties: penalties, - points: points, - stars: stars, enableStatistics: enableStatistics, enablePenaltiesImpactPoints: enablePenaltiesImpactPoints, penaltiesImpactType: penaltiesImpactType, @@ -3013,20 +2414,16 @@ typedef $$MatchEntityTableProcessedTableManager = ProcessedTableManager< typedef $$TeamEntityTableCreateCompanionBuilder = TeamEntityCompanion Function({ Value id, required String name, - Value createdDate, - Value modifiedDate, + Value createdDate, + Value modifiedDate, required int color, - required PerformerModel performers, - required List tags, }); typedef $$TeamEntityTableUpdateCompanionBuilder = TeamEntityCompanion Function({ Value id, Value name, - Value createdDate, - Value modifiedDate, + Value createdDate, + Value modifiedDate, Value color, - Value performers, - Value> tags, }); class $$TeamEntityTableFilterComposer @@ -3052,16 +2449,6 @@ class $$TeamEntityTableFilterComposer ColumnFilters get color => $composableBuilder( column: $table.color, builder: (column) => ColumnFilters(column)); - - ColumnWithTypeConverterFilters - get performers => $composableBuilder( - column: $table.performers, - builder: (column) => ColumnWithTypeConverterFilters(column)); - - ColumnWithTypeConverterFilters, List, String> get tags => - $composableBuilder( - column: $table.tags, - builder: (column) => ColumnWithTypeConverterFilters(column)); } class $$TeamEntityTableOrderingComposer @@ -3088,12 +2475,6 @@ class $$TeamEntityTableOrderingComposer ColumnOrderings get color => $composableBuilder( column: $table.color, builder: (column) => ColumnOrderings(column)); - - ColumnOrderings get performers => $composableBuilder( - column: $table.performers, builder: (column) => ColumnOrderings(column)); - - ColumnOrderings get tags => $composableBuilder( - column: $table.tags, builder: (column) => ColumnOrderings(column)); } class $$TeamEntityTableAnnotationComposer @@ -3119,13 +2500,6 @@ class $$TeamEntityTableAnnotationComposer GeneratedColumn get color => $composableBuilder(column: $table.color, builder: (column) => column); - - GeneratedColumnWithTypeConverter get performers => - $composableBuilder( - column: $table.performers, builder: (column) => column); - - GeneratedColumnWithTypeConverter, String> get tags => - $composableBuilder(column: $table.tags, builder: (column) => column); } class $$TeamEntityTableTableManager extends RootTableManager< @@ -3156,11 +2530,9 @@ class $$TeamEntityTableTableManager extends RootTableManager< updateCompanionCallback: ({ Value id = const Value.absent(), Value name = const Value.absent(), - Value createdDate = const Value.absent(), - Value modifiedDate = const Value.absent(), + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), Value color = const Value.absent(), - Value performers = const Value.absent(), - Value> tags = const Value.absent(), }) => TeamEntityCompanion( id: id, @@ -3168,17 +2540,13 @@ class $$TeamEntityTableTableManager extends RootTableManager< createdDate: createdDate, modifiedDate: modifiedDate, color: color, - performers: performers, - tags: tags, ), createCompanionCallback: ({ Value id = const Value.absent(), required String name, - Value createdDate = const Value.absent(), - Value modifiedDate = const Value.absent(), + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), required int color, - required PerformerModel performers, - required List tags, }) => TeamEntityCompanion.insert( id: id, @@ -3186,8 +2554,6 @@ class $$TeamEntityTableTableManager extends RootTableManager< createdDate: createdDate, modifiedDate: modifiedDate, color: color, - performers: performers, - tags: tags, ), withReferenceMapper: (p0) => p0 .map((e) => (e.readTable(table), BaseReferences(db, table, e))) diff --git a/lib/repositories/entities/match_tag_entity.dart b/lib/repositories/entities/match_tag_entity.dart new file mode 100644 index 00000000..73c22a49 --- /dev/null +++ b/lib/repositories/entities/match_tag_entity.dart @@ -0,0 +1,13 @@ +import 'package:drift/drift.dart'; + +import 'match_entity.dart'; +import 'tag_entity.dart'; + +class MatchTagEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + + IntColumn get tag => integer().references(TagEntity, #id)(); + IntColumn get match => integer().references(MatchEntity, #id)(); +} diff --git a/lib/repositories/entities/pacing_tag_entity.dart b/lib/repositories/entities/pacing_tag_entity.dart new file mode 100644 index 00000000..5f72b17e --- /dev/null +++ b/lib/repositories/entities/pacing_tag_entity.dart @@ -0,0 +1,13 @@ +import 'package:drift/drift.dart'; + +import 'pacing_entity.dart'; +import 'tag_entity.dart'; + +class PacingTagEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + + IntColumn get tag => integer().references(TagEntity, #id)(); + IntColumn get pacing => integer().references(PacingEntity, #id)(); +} diff --git a/lib/repositories/entities/team_tag_entity.dart b/lib/repositories/entities/team_tag_entity.dart new file mode 100644 index 00000000..1d463e90 --- /dev/null +++ b/lib/repositories/entities/team_tag_entity.dart @@ -0,0 +1,13 @@ +import 'package:drift/drift.dart'; + +import 'tag_entity.dart'; +import 'team_entity.dart'; + +class TeamTagEntity extends Table { + IntColumn get id => integer().autoIncrement()(); + DateTimeColumn get createdDate => dateTime().withDefault(Constant(DateTime.now()))(); + DateTimeColumn get modifiedDate => dateTime().withDefault(Constant(DateTime.now()))(); + + IntColumn get tag => integer().references(TagEntity, #id)(); + IntColumn get team => integer().references(TeamEntity, #id)(); +} From 176ac8a2c5ae7d405e09735dd9e447a388ae329b Mon Sep 17 00:00:00 2001 From: Frederik St-Onge Date: Sat, 28 Dec 2024 10:25:01 -0500 Subject: [PATCH 5/7] Add app database in bootstrapper --- lib/bootstrapper.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/bootstrapper.dart b/lib/bootstrapper.dart index 5e605945..391cf8c2 100644 --- a/lib/bootstrapper.dart +++ b/lib/bootstrapper.dart @@ -11,6 +11,7 @@ import 'cubits/pacings/pacings_cubit.dart'; import 'cubits/settings/settings_cubit.dart'; import 'cubits/teams/teams_cubit.dart'; import 'cubits/timer/timer_cubit.dart'; +import 'repositories/database_repository.dart'; import 'repositories/legacy_database_repository.dart'; import 'repositories/matches_repository.dart'; import 'repositories/pacings_repository.dart'; @@ -69,6 +70,14 @@ class Bootstrapper extends StatelessWidget { () => LegacyDatabaseRepository(), ), ), + RepositoryProvider( + create: (repositoryContext) => _createOrGetOverride( + () => AppDatabase( + legacyDatabaseRepository: repositoryContext.read(), + toasterService: repositoryContext.read(), + ), + ), + ), RepositoryProvider( create: (repositoryContext) => _createOrGetOverride( () => PacingsRepository( From 4ac343f3a6816c9e794fbe0eadb83faec3c89542 Mon Sep 17 00:00:00 2001 From: Frederik St-Onge Date: Wed, 1 Jan 2025 21:14:26 -0500 Subject: [PATCH 6/7] Rename database class --- lib/bootstrapper.dart | 4 +- ...tory.dart => app_database_repository.dart} | 15 ++-- ....g.dart => app_database_repository.g.dart} | 70 +++++++++++-------- 3 files changed, 49 insertions(+), 40 deletions(-) rename lib/repositories/{database_repository.dart => app_database_repository.dart} (73%) rename lib/repositories/{database_repository.g.dart => app_database_repository.g.dart} (98%) diff --git a/lib/bootstrapper.dart b/lib/bootstrapper.dart index 391cf8c2..95ef6d57 100644 --- a/lib/bootstrapper.dart +++ b/lib/bootstrapper.dart @@ -11,7 +11,7 @@ import 'cubits/pacings/pacings_cubit.dart'; import 'cubits/settings/settings_cubit.dart'; import 'cubits/teams/teams_cubit.dart'; import 'cubits/timer/timer_cubit.dart'; -import 'repositories/database_repository.dart'; +import 'repositories/app_database_repository.dart'; import 'repositories/legacy_database_repository.dart'; import 'repositories/matches_repository.dart'; import 'repositories/pacings_repository.dart'; @@ -72,7 +72,7 @@ class Bootstrapper extends StatelessWidget { ), RepositoryProvider( create: (repositoryContext) => _createOrGetOverride( - () => AppDatabase( + () => AppDatabaseRepository( legacyDatabaseRepository: repositoryContext.read(), toasterService: repositoryContext.read(), ), diff --git a/lib/repositories/database_repository.dart b/lib/repositories/app_database_repository.dart similarity index 73% rename from lib/repositories/database_repository.dart rename to lib/repositories/app_database_repository.dart index 6d777c35..164dde75 100644 --- a/lib/repositories/database_repository.dart +++ b/lib/repositories/app_database_repository.dart @@ -7,14 +7,14 @@ import 'entities/pacing_entity.dart'; import 'entities/team_entity.dart'; import 'legacy_database_repository.dart'; -part 'database_repository.g.dart'; +part 'app_database_repository.g.dart'; @DriftDatabase(tables: [PacingEntity, MatchEntity, TeamEntity]) -class AppDatabase extends _$AppDatabase { +class AppDatabaseRepository extends _$AppDatabaseRepository { final LegacyDatabaseRepository legacyDatabaseRepository; final ToasterService toasterService; - AppDatabase({ + AppDatabaseRepository({ required this.legacyDatabaseRepository, required this.toasterService, }) : super(_openConnection()); @@ -26,14 +26,15 @@ class AppDatabase extends _$AppDatabase { MigrationStrategy get migration => MigrationStrategy( beforeOpen: (details) async { await customStatement('PRAGMA foreign_keys = ON'); + }, + onCreate: (m) async { + await m.createAll(); - if (details.wasCreated) { - // Migrate data from the legacy database - } + // Run migrations from the legacy database }, ); static QueryExecutor _openConnection() { - return driftDatabase(name: 'mon_pacing_drift'); + return driftDatabase(name: 'mon_pacing'); } } diff --git a/lib/repositories/database_repository.g.dart b/lib/repositories/app_database_repository.g.dart similarity index 98% rename from lib/repositories/database_repository.g.dart rename to lib/repositories/app_database_repository.g.dart index 7a95dc12..72b6c2a1 100644 --- a/lib/repositories/database_repository.g.dart +++ b/lib/repositories/app_database_repository.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'database_repository.dart'; +part of 'app_database_repository.dart'; // ignore_for_file: type=lint class $PacingEntityTable extends PacingEntity @@ -1771,9 +1771,10 @@ class TeamEntityCompanion extends UpdateCompanion { } } -abstract class _$AppDatabase extends GeneratedDatabase { - _$AppDatabase(QueryExecutor e) : super(e); - $AppDatabaseManager get managers => $AppDatabaseManager(this); +abstract class _$AppDatabaseRepository extends GeneratedDatabase { + _$AppDatabaseRepository(QueryExecutor e) : super(e); + $AppDatabaseRepositoryManager get managers => + $AppDatabaseRepositoryManager(this); late final $PacingEntityTable pacingEntity = $PacingEntityTable(this); late final $MatchEntityTable matchEntity = $MatchEntityTable(this); late final $TeamEntityTable teamEntity = $TeamEntityTable(this); @@ -1809,7 +1810,7 @@ typedef $$PacingEntityTableUpdateCompanionBuilder = PacingEntityCompanion }); class $$PacingEntityTableFilterComposer - extends Composer<_$AppDatabase, $PacingEntityTable> { + extends Composer<_$AppDatabaseRepository, $PacingEntityTable> { $$PacingEntityTableFilterComposer({ required super.$db, required super.$table, @@ -1846,7 +1847,7 @@ class $$PacingEntityTableFilterComposer } class $$PacingEntityTableOrderingComposer - extends Composer<_$AppDatabase, $PacingEntityTable> { + extends Composer<_$AppDatabaseRepository, $PacingEntityTable> { $$PacingEntityTableOrderingComposer({ required super.$db, required super.$table, @@ -1885,7 +1886,7 @@ class $$PacingEntityTableOrderingComposer } class $$PacingEntityTableAnnotationComposer - extends Composer<_$AppDatabase, $PacingEntityTable> { + extends Composer<_$AppDatabaseRepository, $PacingEntityTable> { $$PacingEntityTableAnnotationComposer({ required super.$db, required super.$table, @@ -1919,7 +1920,7 @@ class $$PacingEntityTableAnnotationComposer } class $$PacingEntityTableTableManager extends RootTableManager< - _$AppDatabase, + _$AppDatabaseRepository, $PacingEntityTable, PacingEntityData, $$PacingEntityTableFilterComposer, @@ -1929,11 +1930,13 @@ class $$PacingEntityTableTableManager extends RootTableManager< $$PacingEntityTableUpdateCompanionBuilder, ( PacingEntityData, - BaseReferences<_$AppDatabase, $PacingEntityTable, PacingEntityData> + BaseReferences<_$AppDatabaseRepository, $PacingEntityTable, + PacingEntityData> ), PacingEntityData, PrefetchHooks Function()> { - $$PacingEntityTableTableManager(_$AppDatabase db, $PacingEntityTable table) + $$PacingEntityTableTableManager( + _$AppDatabaseRepository db, $PacingEntityTable table) : super(TableManagerState( db: db, table: table, @@ -1991,7 +1994,7 @@ class $$PacingEntityTableTableManager extends RootTableManager< } typedef $$PacingEntityTableProcessedTableManager = ProcessedTableManager< - _$AppDatabase, + _$AppDatabaseRepository, $PacingEntityTable, PacingEntityData, $$PacingEntityTableFilterComposer, @@ -2001,7 +2004,8 @@ typedef $$PacingEntityTableProcessedTableManager = ProcessedTableManager< $$PacingEntityTableUpdateCompanionBuilder, ( PacingEntityData, - BaseReferences<_$AppDatabase, $PacingEntityTable, PacingEntityData> + BaseReferences<_$AppDatabaseRepository, $PacingEntityTable, + PacingEntityData> ), PacingEntityData, PrefetchHooks Function()>; @@ -2047,7 +2051,7 @@ typedef $$MatchEntityTableUpdateCompanionBuilder = MatchEntityCompanion }); class $$MatchEntityTableFilterComposer - extends Composer<_$AppDatabase, $MatchEntityTable> { + extends Composer<_$AppDatabaseRepository, $MatchEntityTable> { $$MatchEntityTableFilterComposer({ required super.$db, required super.$table, @@ -2125,7 +2129,7 @@ class $$MatchEntityTableFilterComposer } class $$MatchEntityTableOrderingComposer - extends Composer<_$AppDatabase, $MatchEntityTable> { + extends Composer<_$AppDatabaseRepository, $MatchEntityTable> { $$MatchEntityTableOrderingComposer({ required super.$db, required super.$table, @@ -2204,7 +2208,7 @@ class $$MatchEntityTableOrderingComposer } class $$MatchEntityTableAnnotationComposer - extends Composer<_$AppDatabase, $MatchEntityTable> { + extends Composer<_$AppDatabaseRepository, $MatchEntityTable> { $$MatchEntityTableAnnotationComposer({ required super.$db, required super.$table, @@ -2275,7 +2279,7 @@ class $$MatchEntityTableAnnotationComposer } class $$MatchEntityTableTableManager extends RootTableManager< - _$AppDatabase, + _$AppDatabaseRepository, $MatchEntityTable, MatchEntityData, $$MatchEntityTableFilterComposer, @@ -2285,11 +2289,13 @@ class $$MatchEntityTableTableManager extends RootTableManager< $$MatchEntityTableUpdateCompanionBuilder, ( MatchEntityData, - BaseReferences<_$AppDatabase, $MatchEntityTable, MatchEntityData> + BaseReferences<_$AppDatabaseRepository, $MatchEntityTable, + MatchEntityData> ), MatchEntityData, PrefetchHooks Function()> { - $$MatchEntityTableTableManager(_$AppDatabase db, $MatchEntityTable table) + $$MatchEntityTableTableManager( + _$AppDatabaseRepository db, $MatchEntityTable table) : super(TableManagerState( db: db, table: table, @@ -2397,7 +2403,7 @@ class $$MatchEntityTableTableManager extends RootTableManager< } typedef $$MatchEntityTableProcessedTableManager = ProcessedTableManager< - _$AppDatabase, + _$AppDatabaseRepository, $MatchEntityTable, MatchEntityData, $$MatchEntityTableFilterComposer, @@ -2407,7 +2413,8 @@ typedef $$MatchEntityTableProcessedTableManager = ProcessedTableManager< $$MatchEntityTableUpdateCompanionBuilder, ( MatchEntityData, - BaseReferences<_$AppDatabase, $MatchEntityTable, MatchEntityData> + BaseReferences<_$AppDatabaseRepository, $MatchEntityTable, + MatchEntityData> ), MatchEntityData, PrefetchHooks Function()>; @@ -2427,7 +2434,7 @@ typedef $$TeamEntityTableUpdateCompanionBuilder = TeamEntityCompanion Function({ }); class $$TeamEntityTableFilterComposer - extends Composer<_$AppDatabase, $TeamEntityTable> { + extends Composer<_$AppDatabaseRepository, $TeamEntityTable> { $$TeamEntityTableFilterComposer({ required super.$db, required super.$table, @@ -2452,7 +2459,7 @@ class $$TeamEntityTableFilterComposer } class $$TeamEntityTableOrderingComposer - extends Composer<_$AppDatabase, $TeamEntityTable> { + extends Composer<_$AppDatabaseRepository, $TeamEntityTable> { $$TeamEntityTableOrderingComposer({ required super.$db, required super.$table, @@ -2478,7 +2485,7 @@ class $$TeamEntityTableOrderingComposer } class $$TeamEntityTableAnnotationComposer - extends Composer<_$AppDatabase, $TeamEntityTable> { + extends Composer<_$AppDatabaseRepository, $TeamEntityTable> { $$TeamEntityTableAnnotationComposer({ required super.$db, required super.$table, @@ -2503,7 +2510,7 @@ class $$TeamEntityTableAnnotationComposer } class $$TeamEntityTableTableManager extends RootTableManager< - _$AppDatabase, + _$AppDatabaseRepository, $TeamEntityTable, TeamEntityData, $$TeamEntityTableFilterComposer, @@ -2513,11 +2520,12 @@ class $$TeamEntityTableTableManager extends RootTableManager< $$TeamEntityTableUpdateCompanionBuilder, ( TeamEntityData, - BaseReferences<_$AppDatabase, $TeamEntityTable, TeamEntityData> + BaseReferences<_$AppDatabaseRepository, $TeamEntityTable, TeamEntityData> ), TeamEntityData, PrefetchHooks Function()> { - $$TeamEntityTableTableManager(_$AppDatabase db, $TeamEntityTable table) + $$TeamEntityTableTableManager( + _$AppDatabaseRepository db, $TeamEntityTable table) : super(TableManagerState( db: db, table: table, @@ -2563,7 +2571,7 @@ class $$TeamEntityTableTableManager extends RootTableManager< } typedef $$TeamEntityTableProcessedTableManager = ProcessedTableManager< - _$AppDatabase, + _$AppDatabaseRepository, $TeamEntityTable, TeamEntityData, $$TeamEntityTableFilterComposer, @@ -2573,14 +2581,14 @@ typedef $$TeamEntityTableProcessedTableManager = ProcessedTableManager< $$TeamEntityTableUpdateCompanionBuilder, ( TeamEntityData, - BaseReferences<_$AppDatabase, $TeamEntityTable, TeamEntityData> + BaseReferences<_$AppDatabaseRepository, $TeamEntityTable, TeamEntityData> ), TeamEntityData, PrefetchHooks Function()>; -class $AppDatabaseManager { - final _$AppDatabase _db; - $AppDatabaseManager(this._db); +class $AppDatabaseRepositoryManager { + final _$AppDatabaseRepository _db; + $AppDatabaseRepositoryManager(this._db); $$PacingEntityTableTableManager get pacingEntity => $$PacingEntityTableTableManager(_db, _db.pacingEntity); $$MatchEntityTableTableManager get matchEntity => From 35692a02374d4782f40d02ca39c80d479be861db Mon Sep 17 00:00:00 2001 From: Frederik St-Onge Date: Wed, 1 Jan 2025 22:22:43 -0500 Subject: [PATCH 7/7] Update database file to compile --- lib/bootstrapper.dart | 4 +- ...base_repository.dart => app_database.dart} | 8 ++- ..._repository.g.dart => app_database.g.dart} | 70 ++++++++----------- 3 files changed, 38 insertions(+), 44 deletions(-) rename lib/repositories/{app_database_repository.dart => app_database.dart} (84%) rename lib/repositories/{app_database_repository.g.dart => app_database.g.dart} (98%) diff --git a/lib/bootstrapper.dart b/lib/bootstrapper.dart index 95ef6d57..cf1a3603 100644 --- a/lib/bootstrapper.dart +++ b/lib/bootstrapper.dart @@ -11,7 +11,7 @@ import 'cubits/pacings/pacings_cubit.dart'; import 'cubits/settings/settings_cubit.dart'; import 'cubits/teams/teams_cubit.dart'; import 'cubits/timer/timer_cubit.dart'; -import 'repositories/app_database_repository.dart'; +import 'repositories/app_database.dart'; import 'repositories/legacy_database_repository.dart'; import 'repositories/matches_repository.dart'; import 'repositories/pacings_repository.dart'; @@ -72,7 +72,7 @@ class Bootstrapper extends StatelessWidget { ), RepositoryProvider( create: (repositoryContext) => _createOrGetOverride( - () => AppDatabaseRepository( + () => AppDatabase( legacyDatabaseRepository: repositoryContext.read(), toasterService: repositoryContext.read(), ), diff --git a/lib/repositories/app_database_repository.dart b/lib/repositories/app_database.dart similarity index 84% rename from lib/repositories/app_database_repository.dart rename to lib/repositories/app_database.dart index 164dde75..39013633 100644 --- a/lib/repositories/app_database_repository.dart +++ b/lib/repositories/app_database.dart @@ -1,20 +1,22 @@ import 'package:drift/drift.dart'; import 'package:drift_flutter/drift_flutter.dart'; +import '../models/penalties_impact_type.dart'; import '../services/toaster_service.dart'; +import 'converters/string_list_converter.dart'; import 'entities/match_entity.dart'; import 'entities/pacing_entity.dart'; import 'entities/team_entity.dart'; import 'legacy_database_repository.dart'; -part 'app_database_repository.g.dart'; +part 'app_database.g.dart'; @DriftDatabase(tables: [PacingEntity, MatchEntity, TeamEntity]) -class AppDatabaseRepository extends _$AppDatabaseRepository { +class AppDatabase extends _$AppDatabase { final LegacyDatabaseRepository legacyDatabaseRepository; final ToasterService toasterService; - AppDatabaseRepository({ + AppDatabase({ required this.legacyDatabaseRepository, required this.toasterService, }) : super(_openConnection()); diff --git a/lib/repositories/app_database_repository.g.dart b/lib/repositories/app_database.g.dart similarity index 98% rename from lib/repositories/app_database_repository.g.dart rename to lib/repositories/app_database.g.dart index 72b6c2a1..a3664d60 100644 --- a/lib/repositories/app_database_repository.g.dart +++ b/lib/repositories/app_database.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'app_database_repository.dart'; +part of 'app_database.dart'; // ignore_for_file: type=lint class $PacingEntityTable extends PacingEntity @@ -1771,10 +1771,9 @@ class TeamEntityCompanion extends UpdateCompanion { } } -abstract class _$AppDatabaseRepository extends GeneratedDatabase { - _$AppDatabaseRepository(QueryExecutor e) : super(e); - $AppDatabaseRepositoryManager get managers => - $AppDatabaseRepositoryManager(this); +abstract class _$AppDatabase extends GeneratedDatabase { + _$AppDatabase(QueryExecutor e) : super(e); + $AppDatabaseManager get managers => $AppDatabaseManager(this); late final $PacingEntityTable pacingEntity = $PacingEntityTable(this); late final $MatchEntityTable matchEntity = $MatchEntityTable(this); late final $TeamEntityTable teamEntity = $TeamEntityTable(this); @@ -1810,7 +1809,7 @@ typedef $$PacingEntityTableUpdateCompanionBuilder = PacingEntityCompanion }); class $$PacingEntityTableFilterComposer - extends Composer<_$AppDatabaseRepository, $PacingEntityTable> { + extends Composer<_$AppDatabase, $PacingEntityTable> { $$PacingEntityTableFilterComposer({ required super.$db, required super.$table, @@ -1847,7 +1846,7 @@ class $$PacingEntityTableFilterComposer } class $$PacingEntityTableOrderingComposer - extends Composer<_$AppDatabaseRepository, $PacingEntityTable> { + extends Composer<_$AppDatabase, $PacingEntityTable> { $$PacingEntityTableOrderingComposer({ required super.$db, required super.$table, @@ -1886,7 +1885,7 @@ class $$PacingEntityTableOrderingComposer } class $$PacingEntityTableAnnotationComposer - extends Composer<_$AppDatabaseRepository, $PacingEntityTable> { + extends Composer<_$AppDatabase, $PacingEntityTable> { $$PacingEntityTableAnnotationComposer({ required super.$db, required super.$table, @@ -1920,7 +1919,7 @@ class $$PacingEntityTableAnnotationComposer } class $$PacingEntityTableTableManager extends RootTableManager< - _$AppDatabaseRepository, + _$AppDatabase, $PacingEntityTable, PacingEntityData, $$PacingEntityTableFilterComposer, @@ -1930,13 +1929,11 @@ class $$PacingEntityTableTableManager extends RootTableManager< $$PacingEntityTableUpdateCompanionBuilder, ( PacingEntityData, - BaseReferences<_$AppDatabaseRepository, $PacingEntityTable, - PacingEntityData> + BaseReferences<_$AppDatabase, $PacingEntityTable, PacingEntityData> ), PacingEntityData, PrefetchHooks Function()> { - $$PacingEntityTableTableManager( - _$AppDatabaseRepository db, $PacingEntityTable table) + $$PacingEntityTableTableManager(_$AppDatabase db, $PacingEntityTable table) : super(TableManagerState( db: db, table: table, @@ -1994,7 +1991,7 @@ class $$PacingEntityTableTableManager extends RootTableManager< } typedef $$PacingEntityTableProcessedTableManager = ProcessedTableManager< - _$AppDatabaseRepository, + _$AppDatabase, $PacingEntityTable, PacingEntityData, $$PacingEntityTableFilterComposer, @@ -2004,8 +2001,7 @@ typedef $$PacingEntityTableProcessedTableManager = ProcessedTableManager< $$PacingEntityTableUpdateCompanionBuilder, ( PacingEntityData, - BaseReferences<_$AppDatabaseRepository, $PacingEntityTable, - PacingEntityData> + BaseReferences<_$AppDatabase, $PacingEntityTable, PacingEntityData> ), PacingEntityData, PrefetchHooks Function()>; @@ -2051,7 +2047,7 @@ typedef $$MatchEntityTableUpdateCompanionBuilder = MatchEntityCompanion }); class $$MatchEntityTableFilterComposer - extends Composer<_$AppDatabaseRepository, $MatchEntityTable> { + extends Composer<_$AppDatabase, $MatchEntityTable> { $$MatchEntityTableFilterComposer({ required super.$db, required super.$table, @@ -2129,7 +2125,7 @@ class $$MatchEntityTableFilterComposer } class $$MatchEntityTableOrderingComposer - extends Composer<_$AppDatabaseRepository, $MatchEntityTable> { + extends Composer<_$AppDatabase, $MatchEntityTable> { $$MatchEntityTableOrderingComposer({ required super.$db, required super.$table, @@ -2208,7 +2204,7 @@ class $$MatchEntityTableOrderingComposer } class $$MatchEntityTableAnnotationComposer - extends Composer<_$AppDatabaseRepository, $MatchEntityTable> { + extends Composer<_$AppDatabase, $MatchEntityTable> { $$MatchEntityTableAnnotationComposer({ required super.$db, required super.$table, @@ -2279,7 +2275,7 @@ class $$MatchEntityTableAnnotationComposer } class $$MatchEntityTableTableManager extends RootTableManager< - _$AppDatabaseRepository, + _$AppDatabase, $MatchEntityTable, MatchEntityData, $$MatchEntityTableFilterComposer, @@ -2289,13 +2285,11 @@ class $$MatchEntityTableTableManager extends RootTableManager< $$MatchEntityTableUpdateCompanionBuilder, ( MatchEntityData, - BaseReferences<_$AppDatabaseRepository, $MatchEntityTable, - MatchEntityData> + BaseReferences<_$AppDatabase, $MatchEntityTable, MatchEntityData> ), MatchEntityData, PrefetchHooks Function()> { - $$MatchEntityTableTableManager( - _$AppDatabaseRepository db, $MatchEntityTable table) + $$MatchEntityTableTableManager(_$AppDatabase db, $MatchEntityTable table) : super(TableManagerState( db: db, table: table, @@ -2403,7 +2397,7 @@ class $$MatchEntityTableTableManager extends RootTableManager< } typedef $$MatchEntityTableProcessedTableManager = ProcessedTableManager< - _$AppDatabaseRepository, + _$AppDatabase, $MatchEntityTable, MatchEntityData, $$MatchEntityTableFilterComposer, @@ -2413,8 +2407,7 @@ typedef $$MatchEntityTableProcessedTableManager = ProcessedTableManager< $$MatchEntityTableUpdateCompanionBuilder, ( MatchEntityData, - BaseReferences<_$AppDatabaseRepository, $MatchEntityTable, - MatchEntityData> + BaseReferences<_$AppDatabase, $MatchEntityTable, MatchEntityData> ), MatchEntityData, PrefetchHooks Function()>; @@ -2434,7 +2427,7 @@ typedef $$TeamEntityTableUpdateCompanionBuilder = TeamEntityCompanion Function({ }); class $$TeamEntityTableFilterComposer - extends Composer<_$AppDatabaseRepository, $TeamEntityTable> { + extends Composer<_$AppDatabase, $TeamEntityTable> { $$TeamEntityTableFilterComposer({ required super.$db, required super.$table, @@ -2459,7 +2452,7 @@ class $$TeamEntityTableFilterComposer } class $$TeamEntityTableOrderingComposer - extends Composer<_$AppDatabaseRepository, $TeamEntityTable> { + extends Composer<_$AppDatabase, $TeamEntityTable> { $$TeamEntityTableOrderingComposer({ required super.$db, required super.$table, @@ -2485,7 +2478,7 @@ class $$TeamEntityTableOrderingComposer } class $$TeamEntityTableAnnotationComposer - extends Composer<_$AppDatabaseRepository, $TeamEntityTable> { + extends Composer<_$AppDatabase, $TeamEntityTable> { $$TeamEntityTableAnnotationComposer({ required super.$db, required super.$table, @@ -2510,7 +2503,7 @@ class $$TeamEntityTableAnnotationComposer } class $$TeamEntityTableTableManager extends RootTableManager< - _$AppDatabaseRepository, + _$AppDatabase, $TeamEntityTable, TeamEntityData, $$TeamEntityTableFilterComposer, @@ -2520,12 +2513,11 @@ class $$TeamEntityTableTableManager extends RootTableManager< $$TeamEntityTableUpdateCompanionBuilder, ( TeamEntityData, - BaseReferences<_$AppDatabaseRepository, $TeamEntityTable, TeamEntityData> + BaseReferences<_$AppDatabase, $TeamEntityTable, TeamEntityData> ), TeamEntityData, PrefetchHooks Function()> { - $$TeamEntityTableTableManager( - _$AppDatabaseRepository db, $TeamEntityTable table) + $$TeamEntityTableTableManager(_$AppDatabase db, $TeamEntityTable table) : super(TableManagerState( db: db, table: table, @@ -2571,7 +2563,7 @@ class $$TeamEntityTableTableManager extends RootTableManager< } typedef $$TeamEntityTableProcessedTableManager = ProcessedTableManager< - _$AppDatabaseRepository, + _$AppDatabase, $TeamEntityTable, TeamEntityData, $$TeamEntityTableFilterComposer, @@ -2581,14 +2573,14 @@ typedef $$TeamEntityTableProcessedTableManager = ProcessedTableManager< $$TeamEntityTableUpdateCompanionBuilder, ( TeamEntityData, - BaseReferences<_$AppDatabaseRepository, $TeamEntityTable, TeamEntityData> + BaseReferences<_$AppDatabase, $TeamEntityTable, TeamEntityData> ), TeamEntityData, PrefetchHooks Function()>; -class $AppDatabaseRepositoryManager { - final _$AppDatabaseRepository _db; - $AppDatabaseRepositoryManager(this._db); +class $AppDatabaseManager { + final _$AppDatabase _db; + $AppDatabaseManager(this._db); $$PacingEntityTableTableManager get pacingEntity => $$PacingEntityTableTableManager(_db, _db.pacingEntity); $$MatchEntityTableTableManager get matchEntity =>