mirror of
https://github.com/immich-app/immich.git
synced 2026-10-26 04:19:42 +08:00
* 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
23 lines
851 B
Dart
23 lines
851 B
Dart
import 'package:drift/drift.dart';
|
|
import 'package:immich_mobile/data/db/main/table/user/user.dart';
|
|
import 'package:immich_mobile/data/db/util/datetime_clamp_type.dart';
|
|
import 'package:immich_mobile/data/db/util/defaults_mixin.dart';
|
|
|
|
@TableIndex.sql('CREATE INDEX IF NOT EXISTS idx_stack_primary_asset_id ON stack_entity (primary_asset_id)')
|
|
class StackEntity extends Table with DriftDefaultsMixin {
|
|
const StackEntity();
|
|
|
|
TextColumn get id => text()();
|
|
|
|
DateTimeColumn get createdAt => customType(clampedDateTime).withDefault(currentDateAndTime)();
|
|
|
|
DateTimeColumn get updatedAt => customType(clampedDateTime).withDefault(currentDateAndTime)();
|
|
|
|
TextColumn get ownerId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
|
|
|
TextColumn get primaryAssetId => text()();
|
|
|
|
@override
|
|
Set<Column> get primaryKey => {id};
|
|
}
|