diff --git a/lib/bootstrapper.dart b/lib/bootstrapper.dart index 3a69df43..cf1a3603 100644 --- a/lib/bootstrapper.dart +++ b/lib/bootstrapper.dart @@ -11,7 +11,8 @@ 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.dart'; +import 'repositories/legacy_database_repository.dart'; import 'repositories/matches_repository.dart'; import 'repositories/pacings_repository.dart'; import 'repositories/teams_repository.dart'; @@ -66,27 +67,35 @@ class Bootstrapper extends StatelessWidget { ), RepositoryProvider( create: (repositoryContext) => _createOrGetOverride( - () => DatabaseRepository(), + () => LegacyDatabaseRepository(), + ), + ), + RepositoryProvider( + create: (repositoryContext) => _createOrGetOverride( + () => AppDatabase( + legacyDatabaseRepository: repositoryContext.read(), + toasterService: repositoryContext.read(), + ), ), ), 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/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/repositories/app_database.dart b/lib/repositories/app_database.dart new file mode 100644 index 00000000..39013633 --- /dev/null +++ b/lib/repositories/app_database.dart @@ -0,0 +1,42 @@ +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.g.dart'; + +@DriftDatabase(tables: [PacingEntity, MatchEntity, TeamEntity]) +class AppDatabase extends _$AppDatabase { + final LegacyDatabaseRepository legacyDatabaseRepository; + final ToasterService toasterService; + + AppDatabase({ + required this.legacyDatabaseRepository, + required this.toasterService, + }) : super(_openConnection()); + + @override + int get schemaVersion => 1; + + @override + MigrationStrategy get migration => MigrationStrategy( + beforeOpen: (details) async { + await customStatement('PRAGMA foreign_keys = ON'); + }, + onCreate: (m) async { + await m.createAll(); + + // Run migrations from the legacy database + }, + ); + + static QueryExecutor _openConnection() { + return driftDatabase(name: 'mon_pacing'); + } +} diff --git a/lib/repositories/app_database.g.dart b/lib/repositories/app_database.g.dart new file mode 100644 index 00000000..a3664d60 --- /dev/null +++ b/lib/repositories/app_database.g.dart @@ -0,0 +1,2590 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'app_database.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, 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, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Constant(DateTime.now())); + 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, + 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)); + } + 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'])!, + 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); + } +} + +class PacingEntityData extends DataClass + implements Insertable { + final int id; + final String name; + final DateTime createdDate; + final DateTime modifiedDate; + final int defaultNumberOfTeams; + final String? integrationId; + final String? integrationEntityId; + final String? integrationAdditionalData; + const PacingEntityData( + {required this.id, + required this.name, + required this.createdDate, + required this.modifiedDate, + required this.defaultNumberOfTeams, + this.integrationId, + this.integrationEntityId, + this.integrationAdditionalData}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['name'] = Variable(name); + 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); + } + 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: Value(createdDate), + modifiedDate: Value(modifiedDate), + 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']), + 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), + 'defaultNumberOfTeams': serializer.toJson(defaultNumberOfTeams), + 'integrationId': serializer.toJson(integrationId), + 'integrationEntityId': serializer.toJson(integrationEntityId), + 'integrationAdditionalData': + serializer.toJson(integrationAdditionalData), + }; + } + + PacingEntityData copyWith( + {int? id, + String? name, + DateTime? createdDate, + DateTime? modifiedDate, + 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 ?? this.createdDate, + modifiedDate: modifiedDate ?? this.modifiedDate, + 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, + 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('defaultNumberOfTeams: $defaultNumberOfTeams, ') + ..write('integrationId: $integrationId, ') + ..write('integrationEntityId: $integrationEntityId, ') + ..write('integrationAdditionalData: $integrationAdditionalData') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + name, + createdDate, + modifiedDate, + 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.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 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.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(), + this.defaultNumberOfTeams = const Value.absent(), + this.integrationId = const Value.absent(), + this.integrationEntityId = const Value.absent(), + this.integrationAdditionalData = const Value.absent(), + }) : name = Value(name); + static Insertable custom({ + Expression? id, + Expression? name, + Expression? createdDate, + Expression? modifiedDate, + 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 (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? 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, + 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 (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('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, 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, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: Constant(DateTime.now())); + 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, + 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)); + } + 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'])!, + 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 + $converterpenaltiesImpactType = + const EnumIndexConverter(PenaltiesImpactType.values); + static JsonTypeConverter2, String, String> + $converterintegrationPenaltyTypes = const StringListConverter(); + 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 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, + required this.createdDate, + required this.modifiedDate, + 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); + map['created_date'] = Variable(createdDate); + map['modified_date'] = Variable(modifiedDate); + 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: Value(createdDate), + modifiedDate: Value(modifiedDate), + 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']), + 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), + '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, + DateTime? createdDate, + DateTime? modifiedDate, + 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 ?? this.createdDate, + modifiedDate: modifiedDate ?? this.modifiedDate, + 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, + 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('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.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) || + (other is MatchEntityData && + other.id == this.id && + other.name == this.name && + other.createdDate == this.createdDate && + other.modifiedDate == this.modifiedDate && + 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 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.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(), + 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); + static Insertable custom({ + Expression? id, + Expression? name, + Expression? createdDate, + Expression? modifiedDate, + 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 (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? 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, + 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 (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('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, 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, 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); + @override + List get $columns => + [id, name, createdDate, modifiedDate, color]; + @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); + } + 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'])!, + ); + } + + @override + $TeamEntityTable createAlias(String alias) { + return $TeamEntityTable(attachedDatabase, alias); + } +} + +class TeamEntityData extends DataClass implements Insertable { + final int id; + final String name; + final DateTime createdDate; + final DateTime modifiedDate; + final int color; + const TeamEntityData( + {required this.id, + required this.name, + required this.createdDate, + required this.modifiedDate, + required this.color}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['name'] = Variable(name); + map['created_date'] = Variable(createdDate); + map['modified_date'] = Variable(modifiedDate); + map['color'] = Variable(color); + return map; + } + + TeamEntityCompanion toCompanion(bool nullToAbsent) { + return TeamEntityCompanion( + id: Value(id), + name: Value(name), + createdDate: Value(createdDate), + modifiedDate: Value(modifiedDate), + color: Value(color), + ); + } + + 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']), + ); + } + @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), + }; + } + + TeamEntityData copyWith( + {int? id, + String? name, + DateTime? createdDate, + DateTime? modifiedDate, + int? color}) => + TeamEntityData( + id: id ?? this.id, + name: name ?? this.name, + createdDate: createdDate ?? this.createdDate, + modifiedDate: modifiedDate ?? this.modifiedDate, + color: color ?? this.color, + ); + 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, + ); + } + + @override + String toString() { + return (StringBuffer('TeamEntityData(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('createdDate: $createdDate, ') + ..write('modifiedDate: $modifiedDate, ') + ..write('color: $color') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, name, createdDate, modifiedDate, color); + @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); +} + +class TeamEntityCompanion extends UpdateCompanion { + final Value id; + final Value name; + final Value createdDate; + final Value modifiedDate; + final Value color; + 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(), + }); + TeamEntityCompanion.insert({ + this.id = const Value.absent(), + required String name, + this.createdDate = const Value.absent(), + this.modifiedDate = const Value.absent(), + required int color, + }) : name = Value(name), + color = Value(color); + static Insertable custom({ + Expression? id, + Expression? name, + Expression? createdDate, + Expression? modifiedDate, + Expression? color, + }) { + 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, + }); + } + + TeamEntityCompanion copyWith( + {Value? id, + Value? name, + 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, + ); + } + + @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); + } + return map; + } + + @override + String toString() { + return (StringBuffer('TeamEntityCompanion(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('createdDate: $createdDate, ') + ..write('modifiedDate: $modifiedDate, ') + ..write('color: $color') + ..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, + Value defaultNumberOfTeams, + Value integrationId, + Value integrationEntityId, + Value integrationAdditionalData, +}); +typedef $$PacingEntityTableUpdateCompanionBuilder = PacingEntityCompanion + Function({ + Value id, + Value name, + Value createdDate, + Value modifiedDate, + 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)); + + 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 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); + + 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 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, + 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(), + 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, + 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, + 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 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)); + + 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 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); + + 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 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, + 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(), + 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, + 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, +}); +typedef $$TeamEntityTableUpdateCompanionBuilder = TeamEntityCompanion Function({ + Value id, + Value name, + Value createdDate, + Value modifiedDate, + Value color, +}); + +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)); +} + +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)); +} + +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); +} + +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(), + }) => + TeamEntityCompanion( + id: id, + name: name, + createdDate: createdDate, + modifiedDate: modifiedDate, + color: color, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required String name, + Value createdDate = const Value.absent(), + Value modifiedDate = const Value.absent(), + required int color, + }) => + TeamEntityCompanion.insert( + id: id, + name: name, + createdDate: createdDate, + modifiedDate: modifiedDate, + color: color, + ), + 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/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/entities/improvisation_entity.dart b/lib/repositories/entities/improvisation_entity.dart new file mode 100644 index 00000000..dd4e1ea6 --- /dev/null +++ b/lib/repositories/entities/improvisation_entity.dart @@ -0,0 +1,25 @@ +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 ImprovisationEntity 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).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 new file mode 100644 index 00000000..c96333b9 --- /dev/null +++ b/lib/repositories/entities/match_entity.dart @@ -0,0 +1,24 @@ +import 'package:drift/drift.dart'; + +import '../../models/penalties_impact_type.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()))(); + 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_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_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_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/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/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..a0e1b736 --- /dev/null +++ b/lib/repositories/entities/team_entity.dart @@ -0,0 +1,9 @@ +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()(); +} 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)(); +} diff --git a/lib/repositories/database_repository.dart b/lib/repositories/legacy_database_repository.dart similarity index 94% rename from lib/repositories/database_repository.dart rename to lib/repositories/legacy_database_repository.dart index c33d28a5..ca3d093b 100644 --- a/lib/repositories/database_repository.dart +++ b/lib/repositories/legacy_database_repository.dart @@ -5,7 +5,7 @@ import '../models/match_model.dart'; import '../models/pacing_model.dart'; import '../models/team_model.dart'; -class DatabaseRepository { +class LegacyDatabaseRepository { Isar? _database; Future get database async { 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