Files
game-tracker/lib/data/db/tables/match_table.dart
gelbeinhalb 81b73beeef
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 46s
Pull Request Pipeline / lint (pull_request) Successful in 53s
Merge remote-tracking branch 'origin/development' into bug/195-datenbank-onDelete-ueberpruefen
# Conflicts:
#	assets/schema.json
#	lib/data/db/tables/player_match_table.dart
#	lib/data/models/game.dart
2026-05-12 20:19:50 +02:00

23 lines
886 B
Dart

import 'package:drift/drift.dart';
import 'package:tallee/data/db/tables/game_table.dart';
import 'package:tallee/data/db/tables/group_table.dart';
class MatchTable extends Table {
TextColumn get id => text()();
TextColumn get gameId =>
text().references(GameTable, #id, onDelete: KeyAction.cascade)();
// Nullable if there is no group associated with the match
// onDelete: If a group gets deleted, groupId in the match gets set to null
TextColumn get groupId => text()
.references(GroupTable, #id, onDelete: KeyAction.setNull)
.nullable()();
TextColumn get name => text()();
TextColumn get notes => text()();
DateTimeColumn get createdAt => dateTime()();
DateTimeColumn get endedAt => dateTime().nullable()();
BoolColumn get deleted => boolean().withDefault(const Constant(false))();
@override
Set<Column<Object>> get primaryKey => {id};
}