mirror of
https://github.com/immich-app/immich.git
synced 2026-05-20 14:52:34 -04:00
do not write default values
This commit is contained in:
@@ -50,6 +50,9 @@ class MetadataRepository extends DriftDatabaseRepository {
|
||||
|
||||
Future<void> write<T extends Object, U extends T>(MetadataKey<T> key, U value) async {
|
||||
if (_read(key) == value) return;
|
||||
if (value == key.defaultValue) {
|
||||
return delete(key);
|
||||
}
|
||||
|
||||
await _db
|
||||
.into(_db.metadataEntity)
|
||||
|
||||
@@ -241,6 +241,9 @@ class _StoreMigrator {
|
||||
Future<void> complete() async {
|
||||
await _db.batch((batch) {
|
||||
for (final entry in _cache.entries) {
|
||||
if (entry.value == entry.key.defaultValue) {
|
||||
continue;
|
||||
}
|
||||
batch.insert(
|
||||
_db.metadataEntity,
|
||||
MetadataEntityCompanion(key: Value(entry.key.key), value: Value(entry.key.encode(entry.value))),
|
||||
|
||||
Reference in New Issue
Block a user