Finalized and updated team implementation, updated team dao, tests, and ex-/import

This commit is contained in:
2026-05-01 14:31:15 +02:00
parent be6b968a43
commit f49440367c
9 changed files with 480 additions and 553 deletions

View File

@@ -2122,7 +2122,7 @@ class $PlayerMatchTableTable extends PlayerMatchTable
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES team_table (id)',
'REFERENCES team_table (id) ON DELETE SET NULL',
),
);
@override
@@ -2820,6 +2820,13 @@ abstract class _$AppDatabase extends GeneratedDatabase {
),
result: [TableUpdate('player_match_table', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'team_table',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('player_match_table', kind: UpdateKind.update)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'player_table',

View File

@@ -8,7 +8,9 @@ class PlayerMatchTable extends Table {
text().references(PlayerTable, #id, onDelete: KeyAction.cascade)();
TextColumn get matchId =>
text().references(MatchTable, #id, onDelete: KeyAction.cascade)();
TextColumn get teamId => text().references(TeamTable, #id).nullable()();
TextColumn get teamId => text()
.references(TeamTable, #id, onDelete: KeyAction.setNull)
.nullable()();
@override
Set<Column<Object>> get primaryKey => {playerId, matchId};