Made match notes non nullable
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 44s
Pull Request Pipeline / lint (pull_request) Successful in 46s

This commit is contained in:
2026-05-02 01:28:00 +02:00
parent 078daeffc9
commit 9e4f44491c
3 changed files with 27 additions and 28 deletions

View File

@@ -30,7 +30,7 @@ class MatchDao extends DatabaseAccessor<AppDatabase> with _$MatchDaoMixin {
gameId: match.game.id,
groupId: Value(match.group?.id),
name: match.name,
notes: Value(match.notes),
notes: match.notes,
createdAt: match.createdAt,
endedAt: Value(match.endedAt),
),
@@ -142,7 +142,7 @@ class MatchDao extends DatabaseAccessor<AppDatabase> with _$MatchDaoMixin {
gameId: match.game.id,
groupId: Value(match.group?.id),
name: match.name,
notes: Value(match.notes),
notes: match.notes,
createdAt: match.createdAt,
endedAt: Value(match.endedAt),
),
@@ -300,7 +300,7 @@ class MatchDao extends DatabaseAccessor<AppDatabase> with _$MatchDaoMixin {
group: group,
players: players,
teams: teams.isEmpty ? null : teams,
notes: row.notes ?? '',
notes: row.notes,
createdAt: row.createdAt,
endedAt: row.endedAt,
scores: scores,
@@ -334,7 +334,7 @@ class MatchDao extends DatabaseAccessor<AppDatabase> with _$MatchDaoMixin {
group: group,
players: players,
teams: teams.isEmpty ? null : teams,
notes: result.notes ?? '',
notes: result.notes,
createdAt: result.createdAt,
endedAt: result.endedAt,
scores: scores,
@@ -362,7 +362,7 @@ class MatchDao extends DatabaseAccessor<AppDatabase> with _$MatchDaoMixin {
group: group,
players: players,
teams: teams.isEmpty ? null : teams,
notes: row.notes ?? '',
notes: row.notes,
createdAt: row.createdAt,
endedAt: row.endedAt,
);

View File

@@ -1190,9 +1190,9 @@ class $MatchTableTable extends MatchTable
late final GeneratedColumn<String> notes = GeneratedColumn<String>(
'notes',
aliasedName,
true,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
requiredDuringInsert: true,
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
@@ -1270,6 +1270,8 @@ class $MatchTableTable extends MatchTable
_notesMeta,
notes.isAcceptableOrUnknown(data['notes']!, _notesMeta),
);
} else if (isInserting) {
context.missing(_notesMeta);
}
if (data.containsKey('created_at')) {
context.handle(
@@ -1313,7 +1315,7 @@ class $MatchTableTable extends MatchTable
notes: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}notes'],
),
)!,
createdAt: attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}created_at'],
@@ -1336,7 +1338,7 @@ class MatchTableData extends DataClass implements Insertable<MatchTableData> {
final String gameId;
final String? groupId;
final String name;
final String? notes;
final String notes;
final DateTime createdAt;
final DateTime? endedAt;
const MatchTableData({
@@ -1344,7 +1346,7 @@ class MatchTableData extends DataClass implements Insertable<MatchTableData> {
required this.gameId,
this.groupId,
required this.name,
this.notes,
required this.notes,
required this.createdAt,
this.endedAt,
});
@@ -1357,9 +1359,7 @@ class MatchTableData extends DataClass implements Insertable<MatchTableData> {
map['group_id'] = Variable<String>(groupId);
}
map['name'] = Variable<String>(name);
if (!nullToAbsent || notes != null) {
map['notes'] = Variable<String>(notes);
}
map['notes'] = Variable<String>(notes);
map['created_at'] = Variable<DateTime>(createdAt);
if (!nullToAbsent || endedAt != null) {
map['ended_at'] = Variable<DateTime>(endedAt);
@@ -1375,9 +1375,7 @@ class MatchTableData extends DataClass implements Insertable<MatchTableData> {
? const Value.absent()
: Value(groupId),
name: Value(name),
notes: notes == null && nullToAbsent
? const Value.absent()
: Value(notes),
notes: Value(notes),
createdAt: Value(createdAt),
endedAt: endedAt == null && nullToAbsent
? const Value.absent()
@@ -1395,7 +1393,7 @@ class MatchTableData extends DataClass implements Insertable<MatchTableData> {
gameId: serializer.fromJson<String>(json['gameId']),
groupId: serializer.fromJson<String?>(json['groupId']),
name: serializer.fromJson<String>(json['name']),
notes: serializer.fromJson<String?>(json['notes']),
notes: serializer.fromJson<String>(json['notes']),
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
endedAt: serializer.fromJson<DateTime?>(json['endedAt']),
);
@@ -1408,7 +1406,7 @@ class MatchTableData extends DataClass implements Insertable<MatchTableData> {
'gameId': serializer.toJson<String>(gameId),
'groupId': serializer.toJson<String?>(groupId),
'name': serializer.toJson<String>(name),
'notes': serializer.toJson<String?>(notes),
'notes': serializer.toJson<String>(notes),
'createdAt': serializer.toJson<DateTime>(createdAt),
'endedAt': serializer.toJson<DateTime?>(endedAt),
};
@@ -1419,7 +1417,7 @@ class MatchTableData extends DataClass implements Insertable<MatchTableData> {
String? gameId,
Value<String?> groupId = const Value.absent(),
String? name,
Value<String?> notes = const Value.absent(),
String? notes,
DateTime? createdAt,
Value<DateTime?> endedAt = const Value.absent(),
}) => MatchTableData(
@@ -1427,7 +1425,7 @@ class MatchTableData extends DataClass implements Insertable<MatchTableData> {
gameId: gameId ?? this.gameId,
groupId: groupId.present ? groupId.value : this.groupId,
name: name ?? this.name,
notes: notes.present ? notes.value : this.notes,
notes: notes ?? this.notes,
createdAt: createdAt ?? this.createdAt,
endedAt: endedAt.present ? endedAt.value : this.endedAt,
);
@@ -1478,7 +1476,7 @@ class MatchTableCompanion extends UpdateCompanion<MatchTableData> {
final Value<String> gameId;
final Value<String?> groupId;
final Value<String> name;
final Value<String?> notes;
final Value<String> notes;
final Value<DateTime> createdAt;
final Value<DateTime?> endedAt;
final Value<int> rowid;
@@ -1497,13 +1495,14 @@ class MatchTableCompanion extends UpdateCompanion<MatchTableData> {
required String gameId,
this.groupId = const Value.absent(),
required String name,
this.notes = const Value.absent(),
required String notes,
required DateTime createdAt,
this.endedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : id = Value(id),
gameId = Value(gameId),
name = Value(name),
notes = Value(notes),
createdAt = Value(createdAt);
static Insertable<MatchTableData> custom({
Expression<String>? id,
@@ -1532,7 +1531,7 @@ class MatchTableCompanion extends UpdateCompanion<MatchTableData> {
Value<String>? gameId,
Value<String?>? groupId,
Value<String>? name,
Value<String?>? notes,
Value<String>? notes,
Value<DateTime>? createdAt,
Value<DateTime?>? endedAt,
Value<int>? rowid,
@@ -4093,7 +4092,7 @@ typedef $$MatchTableTableCreateCompanionBuilder =
required String gameId,
Value<String?> groupId,
required String name,
Value<String?> notes,
required String notes,
required DateTime createdAt,
Value<DateTime?> endedAt,
Value<int> rowid,
@@ -4104,7 +4103,7 @@ typedef $$MatchTableTableUpdateCompanionBuilder =
Value<String> gameId,
Value<String?> groupId,
Value<String> name,
Value<String?> notes,
Value<String> notes,
Value<DateTime> createdAt,
Value<DateTime?> endedAt,
Value<int> rowid,
@@ -4567,7 +4566,7 @@ class $$MatchTableTableTableManager
Value<String> gameId = const Value.absent(),
Value<String?> groupId = const Value.absent(),
Value<String> name = const Value.absent(),
Value<String?> notes = const Value.absent(),
Value<String> notes = const Value.absent(),
Value<DateTime> createdAt = const Value.absent(),
Value<DateTime?> endedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
@@ -4587,7 +4586,7 @@ class $$MatchTableTableTableManager
required String gameId,
Value<String?> groupId = const Value.absent(),
required String name,
Value<String?> notes = const Value.absent(),
required String notes,
required DateTime createdAt,
Value<DateTime?> endedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),

View File

@@ -12,7 +12,7 @@ class MatchTable extends Table {
.references(GroupTable, #id, onDelete: KeyAction.setNull)
.nullable()();
TextColumn get name => text()();
TextColumn get notes => text().nullable()();
TextColumn get notes => text()();
DateTimeColumn get createdAt => dateTime()();
DateTimeColumn get endedAt => dateTime().nullable()();