mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03: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 {
|
Future<void> write<T extends Object, U extends T>(MetadataKey<T> key, U value) async {
|
||||||
if (_read(key) == value) return;
|
if (_read(key) == value) return;
|
||||||
|
if (value == key.defaultValue) {
|
||||||
|
return delete(key);
|
||||||
|
}
|
||||||
|
|
||||||
await _db
|
await _db
|
||||||
.into(_db.metadataEntity)
|
.into(_db.metadataEntity)
|
||||||
|
|||||||
@@ -241,6 +241,9 @@ class _StoreMigrator {
|
|||||||
Future<void> complete() async {
|
Future<void> complete() async {
|
||||||
await _db.batch((batch) {
|
await _db.batch((batch) {
|
||||||
for (final entry in _cache.entries) {
|
for (final entry in _cache.entries) {
|
||||||
|
if (entry.value == entry.key.defaultValue) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
batch.insert(
|
batch.insert(
|
||||||
_db.metadataEntity,
|
_db.metadataEntity,
|
||||||
MetadataEntityCompanion(key: Value(entry.key.key), value: Value(entry.key.encode(entry.value))),
|
MetadataEntityCompanion(key: Value(entry.key.key), value: Value(entry.key.encode(entry.value))),
|
||||||
|
|||||||
Reference in New Issue
Block a user