Files
Immich/mobile/lib/data/db/main/table/remote/album.dart
T
Santo ShakilandGitHub 909b8aac93 fix(mobile): clamp out of range datetimes so timeline queries cannot crash (#30490)
* fix(mobile): clamp out of range datetimes so timeline queries cannot crash

* replace the per column converters with a clamping custom type

* heal each table in one statement, rename the clamp type, read dates as stored

* one medium test for the clamp, drop the dart side bounds, private clamp type
2026-09-18 17:41:15 +00:00

30 lines
1.0 KiB
Dart

import 'package:drift/drift.dart';
import 'package:immich_mobile/data/db/main/table/remote/asset.dart';
import 'package:immich_mobile/data/db/util/datetime_clamp_type.dart';
import 'package:immich_mobile/data/db/util/defaults_mixin.dart';
import 'package:immich_mobile/domain/models/album/album.model.dart';
class RemoteAlbumEntity extends Table with DriftDefaultsMixin {
const RemoteAlbumEntity();
TextColumn get id => text()();
TextColumn get name => text()();
TextColumn get description => text().withDefault(const Constant(''))();
DateTimeColumn get createdAt => customType(clampedDateTime).withDefault(currentDateAndTime)();
DateTimeColumn get updatedAt => customType(clampedDateTime).withDefault(currentDateAndTime)();
TextColumn get thumbnailAssetId =>
text().references(RemoteAssetEntity, #id, onDelete: KeyAction.setNull).nullable()();
BoolColumn get isActivityEnabled => boolean().withDefault(const Constant(true))();
IntColumn get order => intEnum<AlbumAssetOrder>()();
@override
Set<Column> get primaryKey => {id};
}