update onDelete behavior for groupId in match_table to set null
This commit is contained in:
@@ -1123,7 +1123,7 @@ class $MatchTableTable extends MatchTable
|
|||||||
type: DriftSqlType.string,
|
type: DriftSqlType.string,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
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');
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
||||||
@@ -2780,7 +2780,7 @@ abstract class _$AppDatabase extends GeneratedDatabase {
|
|||||||
'group_table',
|
'group_table',
|
||||||
limitUpdateKind: UpdateKind.delete,
|
limitUpdateKind: UpdateKind.delete,
|
||||||
),
|
),
|
||||||
result: [TableUpdate('match_table', kind: UpdateKind.delete)],
|
result: [TableUpdate('match_table', kind: UpdateKind.update)],
|
||||||
),
|
),
|
||||||
WritePropagation(
|
WritePropagation(
|
||||||
on: TableUpdateQuery.onTableName(
|
on: TableUpdateQuery.onTableName(
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ class MatchTable extends Table {
|
|||||||
TextColumn get gameId =>
|
TextColumn get gameId =>
|
||||||
text().references(GameTable, #id, onDelete: KeyAction.cascade)();
|
text().references(GameTable, #id, onDelete: KeyAction.cascade)();
|
||||||
// Nullable if there is no group associated with the match
|
// Nullable if there is no group associated with the match
|
||||||
TextColumn get groupId =>
|
// onDelete: If a group gets deleted, groupId in the match gets set to null
|
||||||
text().references(GroupTable, #id, onDelete: KeyAction.cascade).nullable()();
|
TextColumn get groupId => text()
|
||||||
|
.references(GroupTable, #id, onDelete: KeyAction.setNull)
|
||||||
|
.nullable()();
|
||||||
TextColumn get name => text().nullable()();
|
TextColumn get name => text().nullable()();
|
||||||
TextColumn get notes => text().nullable()();
|
TextColumn get notes => text().nullable()();
|
||||||
DateTimeColumn get createdAt => dateTime()();
|
DateTimeColumn get createdAt => dateTime()();
|
||||||
|
|||||||
Reference in New Issue
Block a user