mirror of
https://github.com/immich-app/immich.git
synced 2025-07-31 15:08:44 -04:00
fix(mobile): add partial index based on library ID to remote assets (#20214)
* feat: add libraryId to SyncAssetV1 * add partial index # Conflicts: # mobile/drift_schemas/main/drift_schema_v5.json # mobile/lib/infrastructure/repositories/db.repository.dart # mobile/lib/infrastructure/repositories/db.repository.steps.dart # mobile/test/drift/main/generated/schema_v5.dart * chore: make build * rebase --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
f85d8add01
commit
641a3baadd
1
mobile/drift_schemas/main/drift_schema_v6.json
generated
Normal file
1
mobile/drift_schemas/main/drift_schema_v6.json
generated
Normal file
File diff suppressed because one or more lines are too long
@ -5,7 +5,17 @@ import 'package:immich_mobile/infrastructure/entities/user.entity.dart';
|
|||||||
import 'package:immich_mobile/infrastructure/utils/asset.mixin.dart';
|
import 'package:immich_mobile/infrastructure/utils/asset.mixin.dart';
|
||||||
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
||||||
|
|
||||||
@TableIndex(name: 'UQ_remote_asset_owner_checksum', columns: {#checksum, #ownerId}, unique: true)
|
@TableIndex(name: 'idx_remote_asset_owner_checksum', columns: {#ownerId, #checksum})
|
||||||
|
@TableIndex.sql('''
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS UQ_remote_assets_owner_checksum
|
||||||
|
ON remote_asset_entity (owner_id, checksum)
|
||||||
|
WHERE (library_id IS NULL);
|
||||||
|
''')
|
||||||
|
@TableIndex.sql('''
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS UQ_remote_assets_owner_library_checksum
|
||||||
|
ON remote_asset_entity (owner_id, library_id, checksum)
|
||||||
|
WHERE (library_id IS NOT NULL);
|
||||||
|
''')
|
||||||
@TableIndex(name: 'idx_remote_asset_checksum', columns: {#checksum})
|
@TableIndex(name: 'idx_remote_asset_checksum', columns: {#checksum})
|
||||||
class RemoteAssetEntity extends Table with DriftDefaultsMixin, AssetEntityMixin {
|
class RemoteAssetEntity extends Table with DriftDefaultsMixin, AssetEntityMixin {
|
||||||
const RemoteAssetEntity();
|
const RemoteAssetEntity();
|
||||||
@ -30,6 +40,8 @@ class RemoteAssetEntity extends Table with DriftDefaultsMixin, AssetEntityMixin
|
|||||||
|
|
||||||
TextColumn get stackId => text().nullable()();
|
TextColumn get stackId => text().nullable()();
|
||||||
|
|
||||||
|
TextColumn get libraryId => text().nullable()();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column> get primaryKey => {id};
|
Set<Column> get primaryKey => {id};
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ typedef $$RemoteAssetEntityTableCreateCompanionBuilder =
|
|||||||
i0.Value<String?> livePhotoVideoId,
|
i0.Value<String?> livePhotoVideoId,
|
||||||
required i2.AssetVisibility visibility,
|
required i2.AssetVisibility visibility,
|
||||||
i0.Value<String?> stackId,
|
i0.Value<String?> stackId,
|
||||||
|
i0.Value<String?> libraryId,
|
||||||
});
|
});
|
||||||
typedef $$RemoteAssetEntityTableUpdateCompanionBuilder =
|
typedef $$RemoteAssetEntityTableUpdateCompanionBuilder =
|
||||||
i1.RemoteAssetEntityCompanion Function({
|
i1.RemoteAssetEntityCompanion Function({
|
||||||
@ -50,6 +51,7 @@ typedef $$RemoteAssetEntityTableUpdateCompanionBuilder =
|
|||||||
i0.Value<String?> livePhotoVideoId,
|
i0.Value<String?> livePhotoVideoId,
|
||||||
i0.Value<i2.AssetVisibility> visibility,
|
i0.Value<i2.AssetVisibility> visibility,
|
||||||
i0.Value<String?> stackId,
|
i0.Value<String?> stackId,
|
||||||
|
i0.Value<String?> libraryId,
|
||||||
});
|
});
|
||||||
|
|
||||||
final class $$RemoteAssetEntityTableReferences
|
final class $$RemoteAssetEntityTableReferences
|
||||||
@ -189,6 +191,11 @@ class $$RemoteAssetEntityTableFilterComposer
|
|||||||
builder: (column) => i0.ColumnFilters(column),
|
builder: (column) => i0.ColumnFilters(column),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
i0.ColumnFilters<String> get libraryId => $composableBuilder(
|
||||||
|
column: $table.libraryId,
|
||||||
|
builder: (column) => i0.ColumnFilters(column),
|
||||||
|
);
|
||||||
|
|
||||||
i5.$$UserEntityTableFilterComposer get ownerId {
|
i5.$$UserEntityTableFilterComposer get ownerId {
|
||||||
final i5.$$UserEntityTableFilterComposer composer = $composerBuilder(
|
final i5.$$UserEntityTableFilterComposer composer = $composerBuilder(
|
||||||
composer: this,
|
composer: this,
|
||||||
@ -306,6 +313,11 @@ class $$RemoteAssetEntityTableOrderingComposer
|
|||||||
builder: (column) => i0.ColumnOrderings(column),
|
builder: (column) => i0.ColumnOrderings(column),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
i0.ColumnOrderings<String> get libraryId => $composableBuilder(
|
||||||
|
column: $table.libraryId,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column),
|
||||||
|
);
|
||||||
|
|
||||||
i5.$$UserEntityTableOrderingComposer get ownerId {
|
i5.$$UserEntityTableOrderingComposer get ownerId {
|
||||||
final i5.$$UserEntityTableOrderingComposer composer = $composerBuilder(
|
final i5.$$UserEntityTableOrderingComposer composer = $composerBuilder(
|
||||||
composer: this,
|
composer: this,
|
||||||
@ -402,6 +414,9 @@ class $$RemoteAssetEntityTableAnnotationComposer
|
|||||||
i0.GeneratedColumn<String> get stackId =>
|
i0.GeneratedColumn<String> get stackId =>
|
||||||
$composableBuilder(column: $table.stackId, builder: (column) => column);
|
$composableBuilder(column: $table.stackId, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<String> get libraryId =>
|
||||||
|
$composableBuilder(column: $table.libraryId, builder: (column) => column);
|
||||||
|
|
||||||
i5.$$UserEntityTableAnnotationComposer get ownerId {
|
i5.$$UserEntityTableAnnotationComposer get ownerId {
|
||||||
final i5.$$UserEntityTableAnnotationComposer composer = $composerBuilder(
|
final i5.$$UserEntityTableAnnotationComposer composer = $composerBuilder(
|
||||||
composer: this,
|
composer: this,
|
||||||
@ -481,6 +496,7 @@ class $$RemoteAssetEntityTableTableManager
|
|||||||
i0.Value<i2.AssetVisibility> visibility =
|
i0.Value<i2.AssetVisibility> visibility =
|
||||||
const i0.Value.absent(),
|
const i0.Value.absent(),
|
||||||
i0.Value<String?> stackId = const i0.Value.absent(),
|
i0.Value<String?> stackId = const i0.Value.absent(),
|
||||||
|
i0.Value<String?> libraryId = const i0.Value.absent(),
|
||||||
}) => i1.RemoteAssetEntityCompanion(
|
}) => i1.RemoteAssetEntityCompanion(
|
||||||
name: name,
|
name: name,
|
||||||
type: type,
|
type: type,
|
||||||
@ -499,6 +515,7 @@ class $$RemoteAssetEntityTableTableManager
|
|||||||
livePhotoVideoId: livePhotoVideoId,
|
livePhotoVideoId: livePhotoVideoId,
|
||||||
visibility: visibility,
|
visibility: visibility,
|
||||||
stackId: stackId,
|
stackId: stackId,
|
||||||
|
libraryId: libraryId,
|
||||||
),
|
),
|
||||||
createCompanionCallback:
|
createCompanionCallback:
|
||||||
({
|
({
|
||||||
@ -519,6 +536,7 @@ class $$RemoteAssetEntityTableTableManager
|
|||||||
i0.Value<String?> livePhotoVideoId = const i0.Value.absent(),
|
i0.Value<String?> livePhotoVideoId = const i0.Value.absent(),
|
||||||
required i2.AssetVisibility visibility,
|
required i2.AssetVisibility visibility,
|
||||||
i0.Value<String?> stackId = const i0.Value.absent(),
|
i0.Value<String?> stackId = const i0.Value.absent(),
|
||||||
|
i0.Value<String?> libraryId = const i0.Value.absent(),
|
||||||
}) => i1.RemoteAssetEntityCompanion.insert(
|
}) => i1.RemoteAssetEntityCompanion.insert(
|
||||||
name: name,
|
name: name,
|
||||||
type: type,
|
type: type,
|
||||||
@ -537,6 +555,7 @@ class $$RemoteAssetEntityTableTableManager
|
|||||||
livePhotoVideoId: livePhotoVideoId,
|
livePhotoVideoId: livePhotoVideoId,
|
||||||
visibility: visibility,
|
visibility: visibility,
|
||||||
stackId: stackId,
|
stackId: stackId,
|
||||||
|
libraryId: libraryId,
|
||||||
),
|
),
|
||||||
withReferenceMapper: (p0) => p0
|
withReferenceMapper: (p0) => p0
|
||||||
.map(
|
.map(
|
||||||
@ -607,9 +626,9 @@ typedef $$RemoteAssetEntityTableProcessedTableManager =
|
|||||||
i1.RemoteAssetEntityData,
|
i1.RemoteAssetEntityData,
|
||||||
i0.PrefetchHooks Function({bool ownerId})
|
i0.PrefetchHooks Function({bool ownerId})
|
||||||
>;
|
>;
|
||||||
i0.Index get uQRemoteAssetOwnerChecksum => i0.Index(
|
i0.Index get idxRemoteAssetOwnerChecksum => i0.Index(
|
||||||
'UQ_remote_asset_owner_checksum',
|
'idx_remote_asset_owner_checksum',
|
||||||
'CREATE UNIQUE INDEX UQ_remote_asset_owner_checksum ON remote_asset_entity (checksum, owner_id)',
|
'CREATE INDEX idx_remote_asset_owner_checksum ON remote_asset_entity (owner_id, checksum)',
|
||||||
);
|
);
|
||||||
|
|
||||||
class $RemoteAssetEntityTable extends i3.RemoteAssetEntity
|
class $RemoteAssetEntityTable extends i3.RemoteAssetEntity
|
||||||
@ -814,6 +833,17 @@ class $RemoteAssetEntityTable extends i3.RemoteAssetEntity
|
|||||||
type: i0.DriftSqlType.string,
|
type: i0.DriftSqlType.string,
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
);
|
);
|
||||||
|
static const i0.VerificationMeta _libraryIdMeta = const i0.VerificationMeta(
|
||||||
|
'libraryId',
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> libraryId = i0.GeneratedColumn<String>(
|
||||||
|
'library_id',
|
||||||
|
aliasedName,
|
||||||
|
true,
|
||||||
|
type: i0.DriftSqlType.string,
|
||||||
|
requiredDuringInsert: false,
|
||||||
|
);
|
||||||
@override
|
@override
|
||||||
List<i0.GeneratedColumn> get $columns => [
|
List<i0.GeneratedColumn> get $columns => [
|
||||||
name,
|
name,
|
||||||
@ -833,6 +863,7 @@ class $RemoteAssetEntityTable extends i3.RemoteAssetEntity
|
|||||||
livePhotoVideoId,
|
livePhotoVideoId,
|
||||||
visibility,
|
visibility,
|
||||||
stackId,
|
stackId,
|
||||||
|
libraryId,
|
||||||
];
|
];
|
||||||
@override
|
@override
|
||||||
String get aliasedName => _alias ?? actualTableName;
|
String get aliasedName => _alias ?? actualTableName;
|
||||||
@ -950,6 +981,12 @@ class $RemoteAssetEntityTable extends i3.RemoteAssetEntity
|
|||||||
stackId.isAcceptableOrUnknown(data['stack_id']!, _stackIdMeta),
|
stackId.isAcceptableOrUnknown(data['stack_id']!, _stackIdMeta),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (data.containsKey('library_id')) {
|
||||||
|
context.handle(
|
||||||
|
_libraryIdMeta,
|
||||||
|
libraryId.isAcceptableOrUnknown(data['library_id']!, _libraryIdMeta),
|
||||||
|
);
|
||||||
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1034,6 +1071,10 @@ class $RemoteAssetEntityTable extends i3.RemoteAssetEntity
|
|||||||
i0.DriftSqlType.string,
|
i0.DriftSqlType.string,
|
||||||
data['${effectivePrefix}stack_id'],
|
data['${effectivePrefix}stack_id'],
|
||||||
),
|
),
|
||||||
|
libraryId: attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.string,
|
||||||
|
data['${effectivePrefix}library_id'],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1073,6 +1114,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
|||||||
final String? livePhotoVideoId;
|
final String? livePhotoVideoId;
|
||||||
final i2.AssetVisibility visibility;
|
final i2.AssetVisibility visibility;
|
||||||
final String? stackId;
|
final String? stackId;
|
||||||
|
final String? libraryId;
|
||||||
const RemoteAssetEntityData({
|
const RemoteAssetEntityData({
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.type,
|
required this.type,
|
||||||
@ -1091,6 +1133,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
|||||||
this.livePhotoVideoId,
|
this.livePhotoVideoId,
|
||||||
required this.visibility,
|
required this.visibility,
|
||||||
this.stackId,
|
this.stackId,
|
||||||
|
this.libraryId,
|
||||||
});
|
});
|
||||||
@override
|
@override
|
||||||
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||||
@ -1136,6 +1179,9 @@ class RemoteAssetEntityData extends i0.DataClass
|
|||||||
if (!nullToAbsent || stackId != null) {
|
if (!nullToAbsent || stackId != null) {
|
||||||
map['stack_id'] = i0.Variable<String>(stackId);
|
map['stack_id'] = i0.Variable<String>(stackId);
|
||||||
}
|
}
|
||||||
|
if (!nullToAbsent || libraryId != null) {
|
||||||
|
map['library_id'] = i0.Variable<String>(libraryId);
|
||||||
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1166,6 +1212,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
|||||||
serializer.fromJson<int>(json['visibility']),
|
serializer.fromJson<int>(json['visibility']),
|
||||||
),
|
),
|
||||||
stackId: serializer.fromJson<String?>(json['stackId']),
|
stackId: serializer.fromJson<String?>(json['stackId']),
|
||||||
|
libraryId: serializer.fromJson<String?>(json['libraryId']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
@ -1193,6 +1240,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
|||||||
i1.$RemoteAssetEntityTable.$convertervisibility.toJson(visibility),
|
i1.$RemoteAssetEntityTable.$convertervisibility.toJson(visibility),
|
||||||
),
|
),
|
||||||
'stackId': serializer.toJson<String?>(stackId),
|
'stackId': serializer.toJson<String?>(stackId),
|
||||||
|
'libraryId': serializer.toJson<String?>(libraryId),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1214,6 +1262,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
|||||||
i0.Value<String?> livePhotoVideoId = const i0.Value.absent(),
|
i0.Value<String?> livePhotoVideoId = const i0.Value.absent(),
|
||||||
i2.AssetVisibility? visibility,
|
i2.AssetVisibility? visibility,
|
||||||
i0.Value<String?> stackId = const i0.Value.absent(),
|
i0.Value<String?> stackId = const i0.Value.absent(),
|
||||||
|
i0.Value<String?> libraryId = const i0.Value.absent(),
|
||||||
}) => i1.RemoteAssetEntityData(
|
}) => i1.RemoteAssetEntityData(
|
||||||
name: name ?? this.name,
|
name: name ?? this.name,
|
||||||
type: type ?? this.type,
|
type: type ?? this.type,
|
||||||
@ -1238,6 +1287,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
|||||||
: this.livePhotoVideoId,
|
: this.livePhotoVideoId,
|
||||||
visibility: visibility ?? this.visibility,
|
visibility: visibility ?? this.visibility,
|
||||||
stackId: stackId.present ? stackId.value : this.stackId,
|
stackId: stackId.present ? stackId.value : this.stackId,
|
||||||
|
libraryId: libraryId.present ? libraryId.value : this.libraryId,
|
||||||
);
|
);
|
||||||
RemoteAssetEntityData copyWithCompanion(i1.RemoteAssetEntityCompanion data) {
|
RemoteAssetEntityData copyWithCompanion(i1.RemoteAssetEntityCompanion data) {
|
||||||
return RemoteAssetEntityData(
|
return RemoteAssetEntityData(
|
||||||
@ -1268,6 +1318,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
|||||||
? data.visibility.value
|
? data.visibility.value
|
||||||
: this.visibility,
|
: this.visibility,
|
||||||
stackId: data.stackId.present ? data.stackId.value : this.stackId,
|
stackId: data.stackId.present ? data.stackId.value : this.stackId,
|
||||||
|
libraryId: data.libraryId.present ? data.libraryId.value : this.libraryId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1290,7 +1341,8 @@ class RemoteAssetEntityData extends i0.DataClass
|
|||||||
..write('deletedAt: $deletedAt, ')
|
..write('deletedAt: $deletedAt, ')
|
||||||
..write('livePhotoVideoId: $livePhotoVideoId, ')
|
..write('livePhotoVideoId: $livePhotoVideoId, ')
|
||||||
..write('visibility: $visibility, ')
|
..write('visibility: $visibility, ')
|
||||||
..write('stackId: $stackId')
|
..write('stackId: $stackId, ')
|
||||||
|
..write('libraryId: $libraryId')
|
||||||
..write(')'))
|
..write(')'))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
@ -1314,6 +1366,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
|||||||
livePhotoVideoId,
|
livePhotoVideoId,
|
||||||
visibility,
|
visibility,
|
||||||
stackId,
|
stackId,
|
||||||
|
libraryId,
|
||||||
);
|
);
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) =>
|
bool operator ==(Object other) =>
|
||||||
@ -1335,7 +1388,8 @@ class RemoteAssetEntityData extends i0.DataClass
|
|||||||
other.deletedAt == this.deletedAt &&
|
other.deletedAt == this.deletedAt &&
|
||||||
other.livePhotoVideoId == this.livePhotoVideoId &&
|
other.livePhotoVideoId == this.livePhotoVideoId &&
|
||||||
other.visibility == this.visibility &&
|
other.visibility == this.visibility &&
|
||||||
other.stackId == this.stackId);
|
other.stackId == this.stackId &&
|
||||||
|
other.libraryId == this.libraryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
class RemoteAssetEntityCompanion
|
class RemoteAssetEntityCompanion
|
||||||
@ -1357,6 +1411,7 @@ class RemoteAssetEntityCompanion
|
|||||||
final i0.Value<String?> livePhotoVideoId;
|
final i0.Value<String?> livePhotoVideoId;
|
||||||
final i0.Value<i2.AssetVisibility> visibility;
|
final i0.Value<i2.AssetVisibility> visibility;
|
||||||
final i0.Value<String?> stackId;
|
final i0.Value<String?> stackId;
|
||||||
|
final i0.Value<String?> libraryId;
|
||||||
const RemoteAssetEntityCompanion({
|
const RemoteAssetEntityCompanion({
|
||||||
this.name = const i0.Value.absent(),
|
this.name = const i0.Value.absent(),
|
||||||
this.type = const i0.Value.absent(),
|
this.type = const i0.Value.absent(),
|
||||||
@ -1375,6 +1430,7 @@ class RemoteAssetEntityCompanion
|
|||||||
this.livePhotoVideoId = const i0.Value.absent(),
|
this.livePhotoVideoId = const i0.Value.absent(),
|
||||||
this.visibility = const i0.Value.absent(),
|
this.visibility = const i0.Value.absent(),
|
||||||
this.stackId = const i0.Value.absent(),
|
this.stackId = const i0.Value.absent(),
|
||||||
|
this.libraryId = const i0.Value.absent(),
|
||||||
});
|
});
|
||||||
RemoteAssetEntityCompanion.insert({
|
RemoteAssetEntityCompanion.insert({
|
||||||
required String name,
|
required String name,
|
||||||
@ -1394,6 +1450,7 @@ class RemoteAssetEntityCompanion
|
|||||||
this.livePhotoVideoId = const i0.Value.absent(),
|
this.livePhotoVideoId = const i0.Value.absent(),
|
||||||
required i2.AssetVisibility visibility,
|
required i2.AssetVisibility visibility,
|
||||||
this.stackId = const i0.Value.absent(),
|
this.stackId = const i0.Value.absent(),
|
||||||
|
this.libraryId = const i0.Value.absent(),
|
||||||
}) : name = i0.Value(name),
|
}) : name = i0.Value(name),
|
||||||
type = i0.Value(type),
|
type = i0.Value(type),
|
||||||
id = i0.Value(id),
|
id = i0.Value(id),
|
||||||
@ -1418,6 +1475,7 @@ class RemoteAssetEntityCompanion
|
|||||||
i0.Expression<String>? livePhotoVideoId,
|
i0.Expression<String>? livePhotoVideoId,
|
||||||
i0.Expression<int>? visibility,
|
i0.Expression<int>? visibility,
|
||||||
i0.Expression<String>? stackId,
|
i0.Expression<String>? stackId,
|
||||||
|
i0.Expression<String>? libraryId,
|
||||||
}) {
|
}) {
|
||||||
return i0.RawValuesInsertable({
|
return i0.RawValuesInsertable({
|
||||||
if (name != null) 'name': name,
|
if (name != null) 'name': name,
|
||||||
@ -1437,6 +1495,7 @@ class RemoteAssetEntityCompanion
|
|||||||
if (livePhotoVideoId != null) 'live_photo_video_id': livePhotoVideoId,
|
if (livePhotoVideoId != null) 'live_photo_video_id': livePhotoVideoId,
|
||||||
if (visibility != null) 'visibility': visibility,
|
if (visibility != null) 'visibility': visibility,
|
||||||
if (stackId != null) 'stack_id': stackId,
|
if (stackId != null) 'stack_id': stackId,
|
||||||
|
if (libraryId != null) 'library_id': libraryId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1458,6 +1517,7 @@ class RemoteAssetEntityCompanion
|
|||||||
i0.Value<String?>? livePhotoVideoId,
|
i0.Value<String?>? livePhotoVideoId,
|
||||||
i0.Value<i2.AssetVisibility>? visibility,
|
i0.Value<i2.AssetVisibility>? visibility,
|
||||||
i0.Value<String?>? stackId,
|
i0.Value<String?>? stackId,
|
||||||
|
i0.Value<String?>? libraryId,
|
||||||
}) {
|
}) {
|
||||||
return i1.RemoteAssetEntityCompanion(
|
return i1.RemoteAssetEntityCompanion(
|
||||||
name: name ?? this.name,
|
name: name ?? this.name,
|
||||||
@ -1477,6 +1537,7 @@ class RemoteAssetEntityCompanion
|
|||||||
livePhotoVideoId: livePhotoVideoId ?? this.livePhotoVideoId,
|
livePhotoVideoId: livePhotoVideoId ?? this.livePhotoVideoId,
|
||||||
visibility: visibility ?? this.visibility,
|
visibility: visibility ?? this.visibility,
|
||||||
stackId: stackId ?? this.stackId,
|
stackId: stackId ?? this.stackId,
|
||||||
|
libraryId: libraryId ?? this.libraryId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1538,6 +1599,9 @@ class RemoteAssetEntityCompanion
|
|||||||
if (stackId.present) {
|
if (stackId.present) {
|
||||||
map['stack_id'] = i0.Variable<String>(stackId.value);
|
map['stack_id'] = i0.Variable<String>(stackId.value);
|
||||||
}
|
}
|
||||||
|
if (libraryId.present) {
|
||||||
|
map['library_id'] = i0.Variable<String>(libraryId.value);
|
||||||
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1560,12 +1624,21 @@ class RemoteAssetEntityCompanion
|
|||||||
..write('deletedAt: $deletedAt, ')
|
..write('deletedAt: $deletedAt, ')
|
||||||
..write('livePhotoVideoId: $livePhotoVideoId, ')
|
..write('livePhotoVideoId: $livePhotoVideoId, ')
|
||||||
..write('visibility: $visibility, ')
|
..write('visibility: $visibility, ')
|
||||||
..write('stackId: $stackId')
|
..write('stackId: $stackId, ')
|
||||||
|
..write('libraryId: $libraryId')
|
||||||
..write(')'))
|
..write(')'))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i0.Index get uQRemoteAssetsOwnerChecksum => i0.Index(
|
||||||
|
'UQ_remote_assets_owner_checksum',
|
||||||
|
'CREATE UNIQUE INDEX IF NOT EXISTS UQ_remote_assets_owner_checksum ON remote_asset_entity (owner_id, checksum) WHERE(library_id IS NULL)',
|
||||||
|
);
|
||||||
|
i0.Index get uQRemoteAssetsOwnerLibraryChecksum => i0.Index(
|
||||||
|
'UQ_remote_assets_owner_library_checksum',
|
||||||
|
'CREATE UNIQUE INDEX IF NOT EXISTS UQ_remote_assets_owner_library_checksum ON remote_asset_entity (owner_id, library_id, checksum) WHERE(library_id IS NOT NULL)',
|
||||||
|
);
|
||||||
i0.Index get idxRemoteAssetChecksum => i0.Index(
|
i0.Index get idxRemoteAssetChecksum => i0.Index(
|
||||||
'idx_remote_asset_checksum',
|
'idx_remote_asset_checksum',
|
||||||
'CREATE INDEX idx_remote_asset_checksum ON remote_asset_entity (checksum)',
|
'CREATE INDEX idx_remote_asset_checksum ON remote_asset_entity (checksum)',
|
||||||
|
@ -66,7 +66,7 @@ class Drift extends $Drift implements IDatabaseRepository {
|
|||||||
: super(executor ?? driftDatabase(name: 'immich', native: const DriftNativeOptions(shareAcrossIsolates: true)));
|
: super(executor ?? driftDatabase(name: 'immich', native: const DriftNativeOptions(shareAcrossIsolates: true)));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => 5;
|
int get schemaVersion => 6;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MigrationStrategy get migration => MigrationStrategy(
|
MigrationStrategy get migration => MigrationStrategy(
|
||||||
@ -103,6 +103,15 @@ class Drift extends $Drift implements IDatabaseRepository {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
from5To6: (m, v6) async {
|
||||||
|
// Drops the (checksum, ownerId) and adds it back as (ownerId, checksum)
|
||||||
|
await customStatement('DROP INDEX IF EXISTS UQ_remote_asset_owner_checksum');
|
||||||
|
await m.create(v6.idxRemoteAssetOwnerChecksum);
|
||||||
|
// Adds libraryId to remote_asset_entity
|
||||||
|
await m.addColumn(v6.remoteAssetEntity, v6.remoteAssetEntity.libraryId);
|
||||||
|
await m.create(v6.uQRemoteAssetsOwnerChecksum);
|
||||||
|
await m.create(v6.uQRemoteAssetsOwnerLibraryChecksum);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -84,7 +84,9 @@ abstract class $Drift extends i0.GeneratedDatabase {
|
|||||||
localAlbumEntity,
|
localAlbumEntity,
|
||||||
localAlbumAssetEntity,
|
localAlbumAssetEntity,
|
||||||
i4.idxLocalAssetChecksum,
|
i4.idxLocalAssetChecksum,
|
||||||
i2.uQRemoteAssetOwnerChecksum,
|
i2.idxRemoteAssetOwnerChecksum,
|
||||||
|
i2.uQRemoteAssetsOwnerChecksum,
|
||||||
|
i2.uQRemoteAssetsOwnerLibraryChecksum,
|
||||||
i2.idxRemoteAssetChecksum,
|
i2.idxRemoteAssetChecksum,
|
||||||
userMetadataEntity,
|
userMetadataEntity,
|
||||||
partnerEntity,
|
partnerEntity,
|
||||||
|
@ -2319,11 +2319,398 @@ i1.GeneratedColumn<DateTime> _column_85(String aliasedName) =>
|
|||||||
type: i1.DriftSqlType.dateTime,
|
type: i1.DriftSqlType.dateTime,
|
||||||
defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
|
defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final class Schema6 extends i0.VersionedSchema {
|
||||||
|
Schema6({required super.database}) : super(version: 6);
|
||||||
|
@override
|
||||||
|
late final List<i1.DatabaseSchemaEntity> entities = [
|
||||||
|
userEntity,
|
||||||
|
remoteAssetEntity,
|
||||||
|
stackEntity,
|
||||||
|
localAssetEntity,
|
||||||
|
localAlbumEntity,
|
||||||
|
localAlbumAssetEntity,
|
||||||
|
idxLocalAssetChecksum,
|
||||||
|
idxRemoteAssetOwnerChecksum,
|
||||||
|
uQRemoteAssetsOwnerChecksum,
|
||||||
|
uQRemoteAssetsOwnerLibraryChecksum,
|
||||||
|
idxRemoteAssetChecksum,
|
||||||
|
userMetadataEntity,
|
||||||
|
partnerEntity,
|
||||||
|
remoteExifEntity,
|
||||||
|
remoteAlbumEntity,
|
||||||
|
remoteAlbumAssetEntity,
|
||||||
|
remoteAlbumUserEntity,
|
||||||
|
memoryEntity,
|
||||||
|
memoryAssetEntity,
|
||||||
|
personEntity,
|
||||||
|
assetFaceEntity,
|
||||||
|
];
|
||||||
|
late final Shape16 userEntity = Shape16(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'user_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_2,
|
||||||
|
_column_3,
|
||||||
|
_column_84,
|
||||||
|
_column_85,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape17 remoteAssetEntity = Shape17(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_1,
|
||||||
|
_column_8,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_10,
|
||||||
|
_column_11,
|
||||||
|
_column_12,
|
||||||
|
_column_0,
|
||||||
|
_column_13,
|
||||||
|
_column_14,
|
||||||
|
_column_15,
|
||||||
|
_column_16,
|
||||||
|
_column_17,
|
||||||
|
_column_18,
|
||||||
|
_column_19,
|
||||||
|
_column_20,
|
||||||
|
_column_21,
|
||||||
|
_column_86,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape3 stackEntity = Shape3(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'stack_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [_column_0, _column_9, _column_5, _column_15, _column_75],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape2 localAssetEntity = Shape2(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'local_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_1,
|
||||||
|
_column_8,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_10,
|
||||||
|
_column_11,
|
||||||
|
_column_12,
|
||||||
|
_column_0,
|
||||||
|
_column_22,
|
||||||
|
_column_14,
|
||||||
|
_column_23,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape6 localAlbumEntity = Shape6(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'local_album_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_5,
|
||||||
|
_column_31,
|
||||||
|
_column_32,
|
||||||
|
_column_33,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape7 localAlbumAssetEntity = Shape7(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'local_album_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(asset_id, album_id)'],
|
||||||
|
columns: [_column_34, _column_35],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
final i1.Index idxLocalAssetChecksum = i1.Index(
|
||||||
|
'idx_local_asset_checksum',
|
||||||
|
'CREATE INDEX idx_local_asset_checksum ON local_asset_entity (checksum)',
|
||||||
|
);
|
||||||
|
final i1.Index idxRemoteAssetOwnerChecksum = i1.Index(
|
||||||
|
'idx_remote_asset_owner_checksum',
|
||||||
|
'CREATE INDEX idx_remote_asset_owner_checksum ON remote_asset_entity (owner_id, checksum)',
|
||||||
|
);
|
||||||
|
final i1.Index uQRemoteAssetsOwnerChecksum = i1.Index(
|
||||||
|
'UQ_remote_assets_owner_checksum',
|
||||||
|
'CREATE UNIQUE INDEX IF NOT EXISTS UQ_remote_assets_owner_checksum ON remote_asset_entity (owner_id, checksum) WHERE(library_id IS NULL)',
|
||||||
|
);
|
||||||
|
final i1.Index uQRemoteAssetsOwnerLibraryChecksum = i1.Index(
|
||||||
|
'UQ_remote_assets_owner_library_checksum',
|
||||||
|
'CREATE UNIQUE INDEX IF NOT EXISTS UQ_remote_assets_owner_library_checksum ON remote_asset_entity (owner_id, library_id, checksum) WHERE(library_id IS NOT NULL)',
|
||||||
|
);
|
||||||
|
final i1.Index idxRemoteAssetChecksum = i1.Index(
|
||||||
|
'idx_remote_asset_checksum',
|
||||||
|
'CREATE INDEX idx_remote_asset_checksum ON remote_asset_entity (checksum)',
|
||||||
|
);
|
||||||
|
late final Shape4 userMetadataEntity = Shape4(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'user_metadata_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(user_id, "key")'],
|
||||||
|
columns: [_column_25, _column_26, _column_27],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape5 partnerEntity = Shape5(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'partner_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(shared_by_id, shared_with_id)'],
|
||||||
|
columns: [_column_28, _column_29, _column_30],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape8 remoteExifEntity = Shape8(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_exif_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(asset_id)'],
|
||||||
|
columns: [
|
||||||
|
_column_36,
|
||||||
|
_column_37,
|
||||||
|
_column_38,
|
||||||
|
_column_39,
|
||||||
|
_column_40,
|
||||||
|
_column_41,
|
||||||
|
_column_11,
|
||||||
|
_column_10,
|
||||||
|
_column_42,
|
||||||
|
_column_43,
|
||||||
|
_column_44,
|
||||||
|
_column_45,
|
||||||
|
_column_46,
|
||||||
|
_column_47,
|
||||||
|
_column_48,
|
||||||
|
_column_49,
|
||||||
|
_column_50,
|
||||||
|
_column_51,
|
||||||
|
_column_52,
|
||||||
|
_column_53,
|
||||||
|
_column_54,
|
||||||
|
_column_55,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape9 remoteAlbumEntity = Shape9(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_album_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_56,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_15,
|
||||||
|
_column_57,
|
||||||
|
_column_58,
|
||||||
|
_column_59,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape7 remoteAlbumAssetEntity = Shape7(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_album_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(asset_id, album_id)'],
|
||||||
|
columns: [_column_36, _column_60],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape10 remoteAlbumUserEntity = Shape10(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_album_user_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(album_id, user_id)'],
|
||||||
|
columns: [_column_60, _column_25, _column_61],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape11 memoryEntity = Shape11(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'memory_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_18,
|
||||||
|
_column_15,
|
||||||
|
_column_8,
|
||||||
|
_column_62,
|
||||||
|
_column_63,
|
||||||
|
_column_64,
|
||||||
|
_column_65,
|
||||||
|
_column_66,
|
||||||
|
_column_67,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape12 memoryAssetEntity = Shape12(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'memory_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(asset_id, memory_id)'],
|
||||||
|
columns: [_column_36, _column_68],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape14 personEntity = Shape14(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'person_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_15,
|
||||||
|
_column_1,
|
||||||
|
_column_69,
|
||||||
|
_column_71,
|
||||||
|
_column_72,
|
||||||
|
_column_73,
|
||||||
|
_column_74,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape15 assetFaceEntity = Shape15(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'asset_face_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_36,
|
||||||
|
_column_76,
|
||||||
|
_column_77,
|
||||||
|
_column_78,
|
||||||
|
_column_79,
|
||||||
|
_column_80,
|
||||||
|
_column_81,
|
||||||
|
_column_82,
|
||||||
|
_column_83,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Shape17 extends i0.VersionedTable {
|
||||||
|
Shape17({required super.source, required super.alias}) : super.aliased();
|
||||||
|
i1.GeneratedColumn<String> get name =>
|
||||||
|
columnsByName['name']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<int> get type =>
|
||||||
|
columnsByName['type']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<DateTime> get createdAt =>
|
||||||
|
columnsByName['created_at']! as i1.GeneratedColumn<DateTime>;
|
||||||
|
i1.GeneratedColumn<DateTime> get updatedAt =>
|
||||||
|
columnsByName['updated_at']! as i1.GeneratedColumn<DateTime>;
|
||||||
|
i1.GeneratedColumn<int> get width =>
|
||||||
|
columnsByName['width']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get height =>
|
||||||
|
columnsByName['height']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get durationInSeconds =>
|
||||||
|
columnsByName['duration_in_seconds']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<String> get id =>
|
||||||
|
columnsByName['id']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<String> get checksum =>
|
||||||
|
columnsByName['checksum']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<bool> get isFavorite =>
|
||||||
|
columnsByName['is_favorite']! as i1.GeneratedColumn<bool>;
|
||||||
|
i1.GeneratedColumn<String> get ownerId =>
|
||||||
|
columnsByName['owner_id']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<DateTime> get localDateTime =>
|
||||||
|
columnsByName['local_date_time']! as i1.GeneratedColumn<DateTime>;
|
||||||
|
i1.GeneratedColumn<String> get thumbHash =>
|
||||||
|
columnsByName['thumb_hash']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<DateTime> get deletedAt =>
|
||||||
|
columnsByName['deleted_at']! as i1.GeneratedColumn<DateTime>;
|
||||||
|
i1.GeneratedColumn<String> get livePhotoVideoId =>
|
||||||
|
columnsByName['live_photo_video_id']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<int> get visibility =>
|
||||||
|
columnsByName['visibility']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<String> get stackId =>
|
||||||
|
columnsByName['stack_id']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<String> get libraryId =>
|
||||||
|
columnsByName['library_id']! as i1.GeneratedColumn<String>;
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.GeneratedColumn<String> _column_86(String aliasedName) =>
|
||||||
|
i1.GeneratedColumn<String>(
|
||||||
|
'library_id',
|
||||||
|
aliasedName,
|
||||||
|
true,
|
||||||
|
type: i1.DriftSqlType.string,
|
||||||
|
);
|
||||||
i0.MigrationStepWithVersion migrationSteps({
|
i0.MigrationStepWithVersion migrationSteps({
|
||||||
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
||||||
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
||||||
required Future<void> Function(i1.Migrator m, Schema4 schema) from3To4,
|
required Future<void> Function(i1.Migrator m, Schema4 schema) from3To4,
|
||||||
required Future<void> Function(i1.Migrator m, Schema5 schema) from4To5,
|
required Future<void> Function(i1.Migrator m, Schema5 schema) from4To5,
|
||||||
|
required Future<void> Function(i1.Migrator m, Schema6 schema) from5To6,
|
||||||
}) {
|
}) {
|
||||||
return (currentVersion, database) async {
|
return (currentVersion, database) async {
|
||||||
switch (currentVersion) {
|
switch (currentVersion) {
|
||||||
@ -2347,6 +2734,11 @@ i0.MigrationStepWithVersion migrationSteps({
|
|||||||
final migrator = i1.Migrator(database, schema);
|
final migrator = i1.Migrator(database, schema);
|
||||||
await from4To5(migrator, schema);
|
await from4To5(migrator, schema);
|
||||||
return 5;
|
return 5;
|
||||||
|
case 5:
|
||||||
|
final schema = Schema6(database: database);
|
||||||
|
final migrator = i1.Migrator(database, schema);
|
||||||
|
await from5To6(migrator, schema);
|
||||||
|
return 6;
|
||||||
default:
|
default:
|
||||||
throw ArgumentError.value('Unknown migration from $currentVersion');
|
throw ArgumentError.value('Unknown migration from $currentVersion');
|
||||||
}
|
}
|
||||||
@ -2358,11 +2750,13 @@ i1.OnUpgrade stepByStep({
|
|||||||
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
||||||
required Future<void> Function(i1.Migrator m, Schema4 schema) from3To4,
|
required Future<void> Function(i1.Migrator m, Schema4 schema) from3To4,
|
||||||
required Future<void> Function(i1.Migrator m, Schema5 schema) from4To5,
|
required Future<void> Function(i1.Migrator m, Schema5 schema) from4To5,
|
||||||
|
required Future<void> Function(i1.Migrator m, Schema6 schema) from5To6,
|
||||||
}) => i0.VersionedSchema.stepByStepHelper(
|
}) => i0.VersionedSchema.stepByStepHelper(
|
||||||
step: migrationSteps(
|
step: migrationSteps(
|
||||||
from1To2: from1To2,
|
from1To2: from1To2,
|
||||||
from2To3: from2To3,
|
from2To3: from2To3,
|
||||||
from3To4: from3To4,
|
from3To4: from3To4,
|
||||||
from4To5: from4To5,
|
from4To5: from4To5,
|
||||||
|
from5To6: from5To6,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -121,6 +121,7 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
|||||||
visibility: Value(asset.visibility.toAssetVisibility()),
|
visibility: Value(asset.visibility.toAssetVisibility()),
|
||||||
livePhotoVideoId: Value(asset.livePhotoVideoId),
|
livePhotoVideoId: Value(asset.livePhotoVideoId),
|
||||||
stackId: Value(asset.stackId),
|
stackId: Value(asset.stackId),
|
||||||
|
libraryId: Value(asset.libraryId),
|
||||||
);
|
);
|
||||||
|
|
||||||
batch.insert(
|
batch.insert(
|
||||||
|
14
mobile/openapi/lib/model/sync_asset_v1.dart
generated
14
mobile/openapi/lib/model/sync_asset_v1.dart
generated
@ -20,6 +20,7 @@ class SyncAssetV1 {
|
|||||||
required this.fileModifiedAt,
|
required this.fileModifiedAt,
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.isFavorite,
|
required this.isFavorite,
|
||||||
|
required this.libraryId,
|
||||||
required this.livePhotoVideoId,
|
required this.livePhotoVideoId,
|
||||||
required this.localDateTime,
|
required this.localDateTime,
|
||||||
required this.originalFileName,
|
required this.originalFileName,
|
||||||
@ -44,6 +45,8 @@ class SyncAssetV1 {
|
|||||||
|
|
||||||
bool isFavorite;
|
bool isFavorite;
|
||||||
|
|
||||||
|
String? libraryId;
|
||||||
|
|
||||||
String? livePhotoVideoId;
|
String? livePhotoVideoId;
|
||||||
|
|
||||||
DateTime? localDateTime;
|
DateTime? localDateTime;
|
||||||
@ -69,6 +72,7 @@ class SyncAssetV1 {
|
|||||||
other.fileModifiedAt == fileModifiedAt &&
|
other.fileModifiedAt == fileModifiedAt &&
|
||||||
other.id == id &&
|
other.id == id &&
|
||||||
other.isFavorite == isFavorite &&
|
other.isFavorite == isFavorite &&
|
||||||
|
other.libraryId == libraryId &&
|
||||||
other.livePhotoVideoId == livePhotoVideoId &&
|
other.livePhotoVideoId == livePhotoVideoId &&
|
||||||
other.localDateTime == localDateTime &&
|
other.localDateTime == localDateTime &&
|
||||||
other.originalFileName == originalFileName &&
|
other.originalFileName == originalFileName &&
|
||||||
@ -88,6 +92,7 @@ class SyncAssetV1 {
|
|||||||
(fileModifiedAt == null ? 0 : fileModifiedAt!.hashCode) +
|
(fileModifiedAt == null ? 0 : fileModifiedAt!.hashCode) +
|
||||||
(id.hashCode) +
|
(id.hashCode) +
|
||||||
(isFavorite.hashCode) +
|
(isFavorite.hashCode) +
|
||||||
|
(libraryId == null ? 0 : libraryId!.hashCode) +
|
||||||
(livePhotoVideoId == null ? 0 : livePhotoVideoId!.hashCode) +
|
(livePhotoVideoId == null ? 0 : livePhotoVideoId!.hashCode) +
|
||||||
(localDateTime == null ? 0 : localDateTime!.hashCode) +
|
(localDateTime == null ? 0 : localDateTime!.hashCode) +
|
||||||
(originalFileName.hashCode) +
|
(originalFileName.hashCode) +
|
||||||
@ -98,7 +103,7 @@ class SyncAssetV1 {
|
|||||||
(visibility.hashCode);
|
(visibility.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'SyncAssetV1[checksum=$checksum, deletedAt=$deletedAt, duration=$duration, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, id=$id, isFavorite=$isFavorite, livePhotoVideoId=$livePhotoVideoId, localDateTime=$localDateTime, originalFileName=$originalFileName, ownerId=$ownerId, stackId=$stackId, thumbhash=$thumbhash, type=$type, visibility=$visibility]';
|
String toString() => 'SyncAssetV1[checksum=$checksum, deletedAt=$deletedAt, duration=$duration, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, id=$id, isFavorite=$isFavorite, libraryId=$libraryId, livePhotoVideoId=$livePhotoVideoId, localDateTime=$localDateTime, originalFileName=$originalFileName, ownerId=$ownerId, stackId=$stackId, thumbhash=$thumbhash, type=$type, visibility=$visibility]';
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final json = <String, dynamic>{};
|
final json = <String, dynamic>{};
|
||||||
@ -125,6 +130,11 @@ class SyncAssetV1 {
|
|||||||
}
|
}
|
||||||
json[r'id'] = this.id;
|
json[r'id'] = this.id;
|
||||||
json[r'isFavorite'] = this.isFavorite;
|
json[r'isFavorite'] = this.isFavorite;
|
||||||
|
if (this.libraryId != null) {
|
||||||
|
json[r'libraryId'] = this.libraryId;
|
||||||
|
} else {
|
||||||
|
// json[r'libraryId'] = null;
|
||||||
|
}
|
||||||
if (this.livePhotoVideoId != null) {
|
if (this.livePhotoVideoId != null) {
|
||||||
json[r'livePhotoVideoId'] = this.livePhotoVideoId;
|
json[r'livePhotoVideoId'] = this.livePhotoVideoId;
|
||||||
} else {
|
} else {
|
||||||
@ -168,6 +178,7 @@ class SyncAssetV1 {
|
|||||||
fileModifiedAt: mapDateTime(json, r'fileModifiedAt', r''),
|
fileModifiedAt: mapDateTime(json, r'fileModifiedAt', r''),
|
||||||
id: mapValueOfType<String>(json, r'id')!,
|
id: mapValueOfType<String>(json, r'id')!,
|
||||||
isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,
|
isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,
|
||||||
|
libraryId: mapValueOfType<String>(json, r'libraryId'),
|
||||||
livePhotoVideoId: mapValueOfType<String>(json, r'livePhotoVideoId'),
|
livePhotoVideoId: mapValueOfType<String>(json, r'livePhotoVideoId'),
|
||||||
localDateTime: mapDateTime(json, r'localDateTime', r''),
|
localDateTime: mapDateTime(json, r'localDateTime', r''),
|
||||||
originalFileName: mapValueOfType<String>(json, r'originalFileName')!,
|
originalFileName: mapValueOfType<String>(json, r'originalFileName')!,
|
||||||
@ -230,6 +241,7 @@ class SyncAssetV1 {
|
|||||||
'fileModifiedAt',
|
'fileModifiedAt',
|
||||||
'id',
|
'id',
|
||||||
'isFavorite',
|
'isFavorite',
|
||||||
|
'libraryId',
|
||||||
'livePhotoVideoId',
|
'livePhotoVideoId',
|
||||||
'localDateTime',
|
'localDateTime',
|
||||||
'originalFileName',
|
'originalFileName',
|
||||||
|
5
mobile/test/drift/main/generated/schema.dart
generated
5
mobile/test/drift/main/generated/schema.dart
generated
@ -8,6 +8,7 @@ import 'schema_v2.dart' as v2;
|
|||||||
import 'schema_v3.dart' as v3;
|
import 'schema_v3.dart' as v3;
|
||||||
import 'schema_v4.dart' as v4;
|
import 'schema_v4.dart' as v4;
|
||||||
import 'schema_v5.dart' as v5;
|
import 'schema_v5.dart' as v5;
|
||||||
|
import 'schema_v6.dart' as v6;
|
||||||
|
|
||||||
class GeneratedHelper implements SchemaInstantiationHelper {
|
class GeneratedHelper implements SchemaInstantiationHelper {
|
||||||
@override
|
@override
|
||||||
@ -23,10 +24,12 @@ class GeneratedHelper implements SchemaInstantiationHelper {
|
|||||||
return v4.DatabaseAtV4(db);
|
return v4.DatabaseAtV4(db);
|
||||||
case 5:
|
case 5:
|
||||||
return v5.DatabaseAtV5(db);
|
return v5.DatabaseAtV5(db);
|
||||||
|
case 6:
|
||||||
|
return v6.DatabaseAtV6(db);
|
||||||
default:
|
default:
|
||||||
throw MissingSchemaException(version, versions);
|
throw MissingSchemaException(version, versions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const versions = const [1, 2, 3, 4, 5];
|
static const versions = const [1, 2, 3, 4, 5, 6];
|
||||||
}
|
}
|
||||||
|
6448
mobile/test/drift/main/generated/schema_v6.dart
generated
Normal file
6448
mobile/test/drift/main/generated/schema_v6.dart
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -14786,6 +14786,10 @@
|
|||||||
"isFavorite": {
|
"isFavorite": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"libraryId": {
|
||||||
|
"nullable": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"livePhotoVideoId": {
|
"livePhotoVideoId": {
|
||||||
"nullable": true,
|
"nullable": true,
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@ -14832,6 +14836,7 @@
|
|||||||
"fileModifiedAt",
|
"fileModifiedAt",
|
||||||
"id",
|
"id",
|
||||||
"isFavorite",
|
"isFavorite",
|
||||||
|
"libraryId",
|
||||||
"livePhotoVideoId",
|
"livePhotoVideoId",
|
||||||
"localDateTime",
|
"localDateTime",
|
||||||
"originalFileName",
|
"originalFileName",
|
||||||
|
@ -354,6 +354,7 @@ export const columns = {
|
|||||||
'asset.duration',
|
'asset.duration',
|
||||||
'asset.livePhotoVideoId',
|
'asset.livePhotoVideoId',
|
||||||
'asset.stackId',
|
'asset.stackId',
|
||||||
|
'asset.libraryId',
|
||||||
],
|
],
|
||||||
syncAlbumUser: ['album_user.albumsId as albumId', 'album_user.usersId as userId', 'album_user.role'],
|
syncAlbumUser: ['album_user.albumsId as albumId', 'album_user.usersId as userId', 'album_user.role'],
|
||||||
syncStack: ['stack.id', 'stack.createdAt', 'stack.updatedAt', 'stack.primaryAssetId', 'stack.ownerId'],
|
syncStack: ['stack.id', 'stack.createdAt', 'stack.updatedAt', 'stack.primaryAssetId', 'stack.ownerId'],
|
||||||
|
@ -115,6 +115,7 @@ export class SyncAssetV1 {
|
|||||||
visibility!: AssetVisibility;
|
visibility!: AssetVisibility;
|
||||||
livePhotoVideoId!: string | null;
|
livePhotoVideoId!: string | null;
|
||||||
stackId!: string | null;
|
stackId!: string | null;
|
||||||
|
libraryId!: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExtraModel()
|
@ExtraModel()
|
||||||
|
@ -66,6 +66,7 @@ select
|
|||||||
"asset"."duration",
|
"asset"."duration",
|
||||||
"asset"."livePhotoVideoId",
|
"asset"."livePhotoVideoId",
|
||||||
"asset"."stackId",
|
"asset"."stackId",
|
||||||
|
"asset"."libraryId",
|
||||||
"asset"."updateId"
|
"asset"."updateId"
|
||||||
from
|
from
|
||||||
"asset"
|
"asset"
|
||||||
@ -95,6 +96,7 @@ select
|
|||||||
"asset"."duration",
|
"asset"."duration",
|
||||||
"asset"."livePhotoVideoId",
|
"asset"."livePhotoVideoId",
|
||||||
"asset"."stackId",
|
"asset"."stackId",
|
||||||
|
"asset"."libraryId",
|
||||||
"asset"."updateId"
|
"asset"."updateId"
|
||||||
from
|
from
|
||||||
"asset"
|
"asset"
|
||||||
@ -357,6 +359,7 @@ select
|
|||||||
"asset"."duration",
|
"asset"."duration",
|
||||||
"asset"."livePhotoVideoId",
|
"asset"."livePhotoVideoId",
|
||||||
"asset"."stackId",
|
"asset"."stackId",
|
||||||
|
"asset"."libraryId",
|
||||||
"asset"."updateId"
|
"asset"."updateId"
|
||||||
from
|
from
|
||||||
"asset"
|
"asset"
|
||||||
@ -605,6 +608,7 @@ select
|
|||||||
"asset"."duration",
|
"asset"."duration",
|
||||||
"asset"."livePhotoVideoId",
|
"asset"."livePhotoVideoId",
|
||||||
"asset"."stackId",
|
"asset"."stackId",
|
||||||
|
"asset"."libraryId",
|
||||||
"asset"."updateId"
|
"asset"."updateId"
|
||||||
from
|
from
|
||||||
"asset"
|
"asset"
|
||||||
@ -652,6 +656,7 @@ select
|
|||||||
"asset"."duration",
|
"asset"."duration",
|
||||||
"asset"."livePhotoVideoId",
|
"asset"."livePhotoVideoId",
|
||||||
"asset"."stackId",
|
"asset"."stackId",
|
||||||
|
"asset"."libraryId",
|
||||||
"asset"."updateId"
|
"asset"."updateId"
|
||||||
from
|
from
|
||||||
"asset"
|
"asset"
|
||||||
|
@ -382,6 +382,7 @@ export class JobService extends BaseService {
|
|||||||
visibility: asset.visibility,
|
visibility: asset.visibility,
|
||||||
livePhotoVideoId: asset.livePhotoVideoId,
|
livePhotoVideoId: asset.livePhotoVideoId,
|
||||||
stackId: asset.stackId,
|
stackId: asset.stackId,
|
||||||
|
libraryId: asset.libraryId,
|
||||||
},
|
},
|
||||||
exif: {
|
exif: {
|
||||||
assetId: exif.assetId,
|
assetId: exif.assetId,
|
||||||
|
@ -38,6 +38,7 @@ describe(SyncRequestType.AlbumAssetsV1, () => {
|
|||||||
duration: '0:10:00.00000',
|
duration: '0:10:00.00000',
|
||||||
livePhotoVideoId: null,
|
livePhotoVideoId: null,
|
||||||
stackId: null,
|
stackId: null,
|
||||||
|
libraryId: null,
|
||||||
});
|
});
|
||||||
const { album } = await ctx.newAlbum({ ownerId: user2.id });
|
const { album } = await ctx.newAlbum({ ownerId: user2.id });
|
||||||
await ctx.newAlbumAsset({ albumId: album.id, assetId: asset.id });
|
await ctx.newAlbumAsset({ albumId: album.id, assetId: asset.id });
|
||||||
@ -64,6 +65,7 @@ describe(SyncRequestType.AlbumAssetsV1, () => {
|
|||||||
duration: asset.duration,
|
duration: asset.duration,
|
||||||
livePhotoVideoId: asset.livePhotoVideoId,
|
livePhotoVideoId: asset.livePhotoVideoId,
|
||||||
stackId: asset.stackId,
|
stackId: asset.stackId,
|
||||||
|
libraryId: asset.libraryId,
|
||||||
},
|
},
|
||||||
type: SyncEntityType.AlbumAssetV1,
|
type: SyncEntityType.AlbumAssetV1,
|
||||||
},
|
},
|
||||||
|
@ -36,6 +36,7 @@ describe(SyncEntityType.AssetV1, () => {
|
|||||||
localDateTime: date,
|
localDateTime: date,
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
duration: '0:10:00.00000',
|
duration: '0:10:00.00000',
|
||||||
|
libraryId: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = await ctx.syncStream(auth, [SyncRequestType.AssetsV1]);
|
const response = await ctx.syncStream(auth, [SyncRequestType.AssetsV1]);
|
||||||
@ -59,6 +60,7 @@ describe(SyncEntityType.AssetV1, () => {
|
|||||||
duration: asset.duration,
|
duration: asset.duration,
|
||||||
stackId: null,
|
stackId: null,
|
||||||
livePhotoVideoId: null,
|
livePhotoVideoId: null,
|
||||||
|
libraryId: asset.libraryId,
|
||||||
},
|
},
|
||||||
type: 'AssetV1',
|
type: 'AssetV1',
|
||||||
},
|
},
|
||||||
|
@ -40,6 +40,7 @@ describe(SyncRequestType.PartnerAssetsV1, () => {
|
|||||||
localDateTime: date,
|
localDateTime: date,
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
duration: '0:10:00.00000',
|
duration: '0:10:00.00000',
|
||||||
|
libraryId: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
await ctx.newPartner({ sharedById: user2.id, sharedWithId: auth.user.id });
|
await ctx.newPartner({ sharedById: user2.id, sharedWithId: auth.user.id });
|
||||||
@ -65,6 +66,7 @@ describe(SyncRequestType.PartnerAssetsV1, () => {
|
|||||||
duration: asset.duration,
|
duration: asset.duration,
|
||||||
stackId: null,
|
stackId: null,
|
||||||
livePhotoVideoId: null,
|
livePhotoVideoId: null,
|
||||||
|
libraryId: asset.libraryId,
|
||||||
},
|
},
|
||||||
type: SyncEntityType.PartnerAssetV1,
|
type: SyncEntityType.PartnerAssetV1,
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user