Bearbeiten und Löschen von Gruppen #148

Merged
sneeex merged 20 commits from feature/118-bearbeiten-und-löschen-von-gruppen into development 2026-03-09 20:30:38 +00:00
2 changed files with 7 additions and 5 deletions
Showing only changes of commit 3fe421676c - Show all commits

View File

@@ -1123,7 +1123,7 @@ class $MatchTableTable extends MatchTable
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES group_table (id) ON DELETE CASCADE',
'REFERENCES group_table (id) ON DELETE SET NULL',
),
);
static const VerificationMeta _nameMeta = const VerificationMeta('name');
@@ -2780,7 +2780,7 @@ abstract class _$AppDatabase extends GeneratedDatabase {
'group_table',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('match_table', kind: UpdateKind.delete)],
result: [TableUpdate('match_table', kind: UpdateKind.update)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(

View File

@@ -7,8 +7,10 @@ class MatchTable extends Table {
TextColumn get gameId =>
text().references(GameTable, #id, onDelete: KeyAction.cascade)();
// Nullable if there is no group associated with the match
TextColumn get groupId =>
text().references(GroupTable, #id, onDelete: KeyAction.cascade).nullable()();
// 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().nullable()();
TextColumn get notes => text().nullable()();
DateTimeColumn get createdAt => dateTime()();
@@ -16,4 +18,4 @@ class MatchTable extends Table {
@override
Set<Column<Object>> get primaryKey => {id};
}
}