mirror of
https://github.com/immich-app/immich.git
synced 2025-12-10 07:05:29 -05:00
rename cloud id
This commit is contained in:
parent
84fcbd4df8
commit
89bb0ca0c9
2
mobile/drift_schemas/main/drift_schema_v11.json
generated
2
mobile/drift_schemas/main/drift_schema_v11.json
generated
File diff suppressed because one or more lines are too long
@ -45,7 +45,7 @@ Future<void> syncCloudIds(ProviderContainer ref) async {
|
||||
Future<void> _populateCloudIds(Drift drift) async {
|
||||
final query = drift.localAssetEntity.selectOnly()
|
||||
..addColumns([drift.localAssetEntity.id])
|
||||
..where(drift.localAssetEntity.cloudId.isNull());
|
||||
..where(drift.localAssetEntity.iCloudId.isNull());
|
||||
final ids = await query.map((row) => row.read(drift.localAssetEntity.id)!).get();
|
||||
final cloudMapping = await NativeSyncApi().getCloudIdForAssetIds(ids);
|
||||
await DriftLocalAlbumRepository(drift).updateCloudMapping(cloudMapping);
|
||||
@ -63,20 +63,20 @@ Future<List<_CloudIdMapping>> _fetchCloudIdMappings(Drift drift, String userId)
|
||||
),
|
||||
leftOuterJoin(
|
||||
drift.remoteAssetCloudIdEntity,
|
||||
drift.localAssetEntity.cloudId.equalsExp(drift.remoteAssetCloudIdEntity.cloudId),
|
||||
drift.localAssetEntity.iCloudId.equalsExp(drift.remoteAssetCloudIdEntity.cloudId),
|
||||
useColumns: false,
|
||||
),
|
||||
])
|
||||
..addColumns([drift.remoteAssetEntity.id, drift.localAssetEntity.cloudId])
|
||||
..addColumns([drift.remoteAssetEntity.id, drift.localAssetEntity.iCloudId])
|
||||
..where(
|
||||
drift.localAssetEntity.id.isNotNull() &
|
||||
drift.localAssetEntity.cloudId.isNotNull() &
|
||||
drift.localAssetEntity.iCloudId.isNotNull() &
|
||||
drift.remoteAssetEntity.ownerId.equals(userId) &
|
||||
drift.remoteAssetCloudIdEntity.cloudId.isNull(),
|
||||
);
|
||||
return query
|
||||
.map(
|
||||
(row) => (assetId: row.read(drift.remoteAssetEntity.id)!, cloudId: row.read(drift.localAssetEntity.cloudId)!),
|
||||
(row) => (assetId: row.read(drift.remoteAssetEntity.id)!, cloudId: row.read(drift.localAssetEntity.iCloudId)!),
|
||||
)
|
||||
.get();
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ class LocalAssetEntity extends Table with DriftDefaultsMixin, AssetEntityMixin {
|
||||
|
||||
IntColumn get orientation => integer().withDefault(const Constant(0))();
|
||||
|
||||
TextColumn get cloudId => text().nullable()();
|
||||
TextColumn get iCloudId => text().nullable()();
|
||||
|
||||
@override
|
||||
Set<Column> get primaryKey => {id};
|
||||
@ -37,6 +37,6 @@ extension LocalAssetEntityDataDomainExtension on LocalAssetEntityData {
|
||||
width: width,
|
||||
remoteId: null,
|
||||
orientation: orientation,
|
||||
cloudId: cloudId,
|
||||
cloudId: iCloudId,
|
||||
);
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ typedef $$LocalAssetEntityTableCreateCompanionBuilder =
|
||||
i0.Value<String?> checksum,
|
||||
i0.Value<bool> isFavorite,
|
||||
i0.Value<int> orientation,
|
||||
i0.Value<String?> cloudId,
|
||||
i0.Value<String?> iCloudId,
|
||||
});
|
||||
typedef $$LocalAssetEntityTableUpdateCompanionBuilder =
|
||||
i1.LocalAssetEntityCompanion Function({
|
||||
@ -36,7 +36,7 @@ typedef $$LocalAssetEntityTableUpdateCompanionBuilder =
|
||||
i0.Value<String?> checksum,
|
||||
i0.Value<bool> isFavorite,
|
||||
i0.Value<int> orientation,
|
||||
i0.Value<String?> cloudId,
|
||||
i0.Value<String?> iCloudId,
|
||||
});
|
||||
|
||||
class $$LocalAssetEntityTableFilterComposer
|
||||
@ -104,8 +104,8 @@ class $$LocalAssetEntityTableFilterComposer
|
||||
builder: (column) => i0.ColumnFilters(column),
|
||||
);
|
||||
|
||||
i0.ColumnFilters<String> get cloudId => $composableBuilder(
|
||||
column: $table.cloudId,
|
||||
i0.ColumnFilters<String> get iCloudId => $composableBuilder(
|
||||
column: $table.iCloudId,
|
||||
builder: (column) => i0.ColumnFilters(column),
|
||||
);
|
||||
}
|
||||
@ -174,8 +174,8 @@ class $$LocalAssetEntityTableOrderingComposer
|
||||
builder: (column) => i0.ColumnOrderings(column),
|
||||
);
|
||||
|
||||
i0.ColumnOrderings<String> get cloudId => $composableBuilder(
|
||||
column: $table.cloudId,
|
||||
i0.ColumnOrderings<String> get iCloudId => $composableBuilder(
|
||||
column: $table.iCloudId,
|
||||
builder: (column) => i0.ColumnOrderings(column),
|
||||
);
|
||||
}
|
||||
@ -228,8 +228,8 @@ class $$LocalAssetEntityTableAnnotationComposer
|
||||
builder: (column) => column,
|
||||
);
|
||||
|
||||
i0.GeneratedColumn<String> get cloudId =>
|
||||
$composableBuilder(column: $table.cloudId, builder: (column) => column);
|
||||
i0.GeneratedColumn<String> get iCloudId =>
|
||||
$composableBuilder(column: $table.iCloudId, builder: (column) => column);
|
||||
}
|
||||
|
||||
class $$LocalAssetEntityTableTableManager
|
||||
@ -283,7 +283,7 @@ class $$LocalAssetEntityTableTableManager
|
||||
i0.Value<String?> checksum = const i0.Value.absent(),
|
||||
i0.Value<bool> isFavorite = const i0.Value.absent(),
|
||||
i0.Value<int> orientation = const i0.Value.absent(),
|
||||
i0.Value<String?> cloudId = const i0.Value.absent(),
|
||||
i0.Value<String?> iCloudId = const i0.Value.absent(),
|
||||
}) => i1.LocalAssetEntityCompanion(
|
||||
name: name,
|
||||
type: type,
|
||||
@ -296,7 +296,7 @@ class $$LocalAssetEntityTableTableManager
|
||||
checksum: checksum,
|
||||
isFavorite: isFavorite,
|
||||
orientation: orientation,
|
||||
cloudId: cloudId,
|
||||
iCloudId: iCloudId,
|
||||
),
|
||||
createCompanionCallback:
|
||||
({
|
||||
@ -311,7 +311,7 @@ class $$LocalAssetEntityTableTableManager
|
||||
i0.Value<String?> checksum = const i0.Value.absent(),
|
||||
i0.Value<bool> isFavorite = const i0.Value.absent(),
|
||||
i0.Value<int> orientation = const i0.Value.absent(),
|
||||
i0.Value<String?> cloudId = const i0.Value.absent(),
|
||||
i0.Value<String?> iCloudId = const i0.Value.absent(),
|
||||
}) => i1.LocalAssetEntityCompanion.insert(
|
||||
name: name,
|
||||
type: type,
|
||||
@ -324,7 +324,7 @@ class $$LocalAssetEntityTableTableManager
|
||||
checksum: checksum,
|
||||
isFavorite: isFavorite,
|
||||
orientation: orientation,
|
||||
cloudId: cloudId,
|
||||
iCloudId: iCloudId,
|
||||
),
|
||||
withReferenceMapper: (p0) => p0
|
||||
.map((e) => (e.readTable(table), i0.BaseReferences(db, table, e)))
|
||||
@ -492,12 +492,12 @@ class $LocalAssetEntityTable extends i3.LocalAssetEntity
|
||||
requiredDuringInsert: false,
|
||||
defaultValue: const i4.Constant(0),
|
||||
);
|
||||
static const i0.VerificationMeta _cloudIdMeta = const i0.VerificationMeta(
|
||||
'cloudId',
|
||||
static const i0.VerificationMeta _iCloudIdMeta = const i0.VerificationMeta(
|
||||
'iCloudId',
|
||||
);
|
||||
@override
|
||||
late final i0.GeneratedColumn<String> cloudId = i0.GeneratedColumn<String>(
|
||||
'cloud_id',
|
||||
late final i0.GeneratedColumn<String> iCloudId = i0.GeneratedColumn<String>(
|
||||
'i_cloud_id',
|
||||
aliasedName,
|
||||
true,
|
||||
type: i0.DriftSqlType.string,
|
||||
@ -516,7 +516,7 @@ class $LocalAssetEntityTable extends i3.LocalAssetEntity
|
||||
checksum,
|
||||
isFavorite,
|
||||
orientation,
|
||||
cloudId,
|
||||
iCloudId,
|
||||
];
|
||||
@override
|
||||
String get aliasedName => _alias ?? actualTableName;
|
||||
@ -597,10 +597,10 @@ class $LocalAssetEntityTable extends i3.LocalAssetEntity
|
||||
),
|
||||
);
|
||||
}
|
||||
if (data.containsKey('cloud_id')) {
|
||||
if (data.containsKey('i_cloud_id')) {
|
||||
context.handle(
|
||||
_cloudIdMeta,
|
||||
cloudId.isAcceptableOrUnknown(data['cloud_id']!, _cloudIdMeta),
|
||||
_iCloudIdMeta,
|
||||
iCloudId.isAcceptableOrUnknown(data['i_cloud_id']!, _iCloudIdMeta),
|
||||
);
|
||||
}
|
||||
return context;
|
||||
@ -661,9 +661,9 @@ class $LocalAssetEntityTable extends i3.LocalAssetEntity
|
||||
i0.DriftSqlType.int,
|
||||
data['${effectivePrefix}orientation'],
|
||||
)!,
|
||||
cloudId: attachedDatabase.typeMapping.read(
|
||||
iCloudId: attachedDatabase.typeMapping.read(
|
||||
i0.DriftSqlType.string,
|
||||
data['${effectivePrefix}cloud_id'],
|
||||
data['${effectivePrefix}i_cloud_id'],
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -694,7 +694,7 @@ class LocalAssetEntityData extends i0.DataClass
|
||||
final String? checksum;
|
||||
final bool isFavorite;
|
||||
final int orientation;
|
||||
final String? cloudId;
|
||||
final String? iCloudId;
|
||||
const LocalAssetEntityData({
|
||||
required this.name,
|
||||
required this.type,
|
||||
@ -707,7 +707,7 @@ class LocalAssetEntityData extends i0.DataClass
|
||||
this.checksum,
|
||||
required this.isFavorite,
|
||||
required this.orientation,
|
||||
this.cloudId,
|
||||
this.iCloudId,
|
||||
});
|
||||
@override
|
||||
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||
@ -735,8 +735,8 @@ class LocalAssetEntityData extends i0.DataClass
|
||||
}
|
||||
map['is_favorite'] = i0.Variable<bool>(isFavorite);
|
||||
map['orientation'] = i0.Variable<int>(orientation);
|
||||
if (!nullToAbsent || cloudId != null) {
|
||||
map['cloud_id'] = i0.Variable<String>(cloudId);
|
||||
if (!nullToAbsent || iCloudId != null) {
|
||||
map['i_cloud_id'] = i0.Variable<String>(iCloudId);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@ -760,7 +760,7 @@ class LocalAssetEntityData extends i0.DataClass
|
||||
checksum: serializer.fromJson<String?>(json['checksum']),
|
||||
isFavorite: serializer.fromJson<bool>(json['isFavorite']),
|
||||
orientation: serializer.fromJson<int>(json['orientation']),
|
||||
cloudId: serializer.fromJson<String?>(json['cloudId']),
|
||||
iCloudId: serializer.fromJson<String?>(json['iCloudId']),
|
||||
);
|
||||
}
|
||||
@override
|
||||
@ -780,7 +780,7 @@ class LocalAssetEntityData extends i0.DataClass
|
||||
'checksum': serializer.toJson<String?>(checksum),
|
||||
'isFavorite': serializer.toJson<bool>(isFavorite),
|
||||
'orientation': serializer.toJson<int>(orientation),
|
||||
'cloudId': serializer.toJson<String?>(cloudId),
|
||||
'iCloudId': serializer.toJson<String?>(iCloudId),
|
||||
};
|
||||
}
|
||||
|
||||
@ -796,7 +796,7 @@ class LocalAssetEntityData extends i0.DataClass
|
||||
i0.Value<String?> checksum = const i0.Value.absent(),
|
||||
bool? isFavorite,
|
||||
int? orientation,
|
||||
i0.Value<String?> cloudId = const i0.Value.absent(),
|
||||
i0.Value<String?> iCloudId = const i0.Value.absent(),
|
||||
}) => i1.LocalAssetEntityData(
|
||||
name: name ?? this.name,
|
||||
type: type ?? this.type,
|
||||
@ -811,7 +811,7 @@ class LocalAssetEntityData extends i0.DataClass
|
||||
checksum: checksum.present ? checksum.value : this.checksum,
|
||||
isFavorite: isFavorite ?? this.isFavorite,
|
||||
orientation: orientation ?? this.orientation,
|
||||
cloudId: cloudId.present ? cloudId.value : this.cloudId,
|
||||
iCloudId: iCloudId.present ? iCloudId.value : this.iCloudId,
|
||||
);
|
||||
LocalAssetEntityData copyWithCompanion(i1.LocalAssetEntityCompanion data) {
|
||||
return LocalAssetEntityData(
|
||||
@ -832,7 +832,7 @@ class LocalAssetEntityData extends i0.DataClass
|
||||
orientation: data.orientation.present
|
||||
? data.orientation.value
|
||||
: this.orientation,
|
||||
cloudId: data.cloudId.present ? data.cloudId.value : this.cloudId,
|
||||
iCloudId: data.iCloudId.present ? data.iCloudId.value : this.iCloudId,
|
||||
);
|
||||
}
|
||||
|
||||
@ -850,7 +850,7 @@ class LocalAssetEntityData extends i0.DataClass
|
||||
..write('checksum: $checksum, ')
|
||||
..write('isFavorite: $isFavorite, ')
|
||||
..write('orientation: $orientation, ')
|
||||
..write('cloudId: $cloudId')
|
||||
..write('iCloudId: $iCloudId')
|
||||
..write(')'))
|
||||
.toString();
|
||||
}
|
||||
@ -868,7 +868,7 @@ class LocalAssetEntityData extends i0.DataClass
|
||||
checksum,
|
||||
isFavorite,
|
||||
orientation,
|
||||
cloudId,
|
||||
iCloudId,
|
||||
);
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
@ -885,7 +885,7 @@ class LocalAssetEntityData extends i0.DataClass
|
||||
other.checksum == this.checksum &&
|
||||
other.isFavorite == this.isFavorite &&
|
||||
other.orientation == this.orientation &&
|
||||
other.cloudId == this.cloudId);
|
||||
other.iCloudId == this.iCloudId);
|
||||
}
|
||||
|
||||
class LocalAssetEntityCompanion
|
||||
@ -901,7 +901,7 @@ class LocalAssetEntityCompanion
|
||||
final i0.Value<String?> checksum;
|
||||
final i0.Value<bool> isFavorite;
|
||||
final i0.Value<int> orientation;
|
||||
final i0.Value<String?> cloudId;
|
||||
final i0.Value<String?> iCloudId;
|
||||
const LocalAssetEntityCompanion({
|
||||
this.name = const i0.Value.absent(),
|
||||
this.type = const i0.Value.absent(),
|
||||
@ -914,7 +914,7 @@ class LocalAssetEntityCompanion
|
||||
this.checksum = const i0.Value.absent(),
|
||||
this.isFavorite = const i0.Value.absent(),
|
||||
this.orientation = const i0.Value.absent(),
|
||||
this.cloudId = const i0.Value.absent(),
|
||||
this.iCloudId = const i0.Value.absent(),
|
||||
});
|
||||
LocalAssetEntityCompanion.insert({
|
||||
required String name,
|
||||
@ -928,7 +928,7 @@ class LocalAssetEntityCompanion
|
||||
this.checksum = const i0.Value.absent(),
|
||||
this.isFavorite = const i0.Value.absent(),
|
||||
this.orientation = const i0.Value.absent(),
|
||||
this.cloudId = const i0.Value.absent(),
|
||||
this.iCloudId = const i0.Value.absent(),
|
||||
}) : name = i0.Value(name),
|
||||
type = i0.Value(type),
|
||||
id = i0.Value(id);
|
||||
@ -944,7 +944,7 @@ class LocalAssetEntityCompanion
|
||||
i0.Expression<String>? checksum,
|
||||
i0.Expression<bool>? isFavorite,
|
||||
i0.Expression<int>? orientation,
|
||||
i0.Expression<String>? cloudId,
|
||||
i0.Expression<String>? iCloudId,
|
||||
}) {
|
||||
return i0.RawValuesInsertable({
|
||||
if (name != null) 'name': name,
|
||||
@ -958,7 +958,7 @@ class LocalAssetEntityCompanion
|
||||
if (checksum != null) 'checksum': checksum,
|
||||
if (isFavorite != null) 'is_favorite': isFavorite,
|
||||
if (orientation != null) 'orientation': orientation,
|
||||
if (cloudId != null) 'cloud_id': cloudId,
|
||||
if (iCloudId != null) 'i_cloud_id': iCloudId,
|
||||
});
|
||||
}
|
||||
|
||||
@ -974,7 +974,7 @@ class LocalAssetEntityCompanion
|
||||
i0.Value<String?>? checksum,
|
||||
i0.Value<bool>? isFavorite,
|
||||
i0.Value<int>? orientation,
|
||||
i0.Value<String?>? cloudId,
|
||||
i0.Value<String?>? iCloudId,
|
||||
}) {
|
||||
return i1.LocalAssetEntityCompanion(
|
||||
name: name ?? this.name,
|
||||
@ -988,7 +988,7 @@ class LocalAssetEntityCompanion
|
||||
checksum: checksum ?? this.checksum,
|
||||
isFavorite: isFavorite ?? this.isFavorite,
|
||||
orientation: orientation ?? this.orientation,
|
||||
cloudId: cloudId ?? this.cloudId,
|
||||
iCloudId: iCloudId ?? this.iCloudId,
|
||||
);
|
||||
}
|
||||
|
||||
@ -1030,8 +1030,8 @@ class LocalAssetEntityCompanion
|
||||
if (orientation.present) {
|
||||
map['orientation'] = i0.Variable<int>(orientation.value);
|
||||
}
|
||||
if (cloudId.present) {
|
||||
map['cloud_id'] = i0.Variable<String>(cloudId.value);
|
||||
if (iCloudId.present) {
|
||||
map['i_cloud_id'] = i0.Variable<String>(iCloudId.value);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@ -1050,7 +1050,7 @@ class LocalAssetEntityCompanion
|
||||
..write('checksum: $checksum, ')
|
||||
..write('isFavorite: $isFavorite, ')
|
||||
..write('orientation: $orientation, ')
|
||||
..write('cloudId: $cloudId')
|
||||
..write('iCloudId: $iCloudId')
|
||||
..write(')'))
|
||||
.toString();
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ SELECT
|
||||
rae.live_photo_video_id,
|
||||
0 as orientation,
|
||||
rae.stack_id,
|
||||
NULL as cloud_id
|
||||
NULL as i_cloud_id
|
||||
FROM
|
||||
remote_asset_entity rae
|
||||
LEFT JOIN
|
||||
@ -55,7 +55,7 @@ SELECT
|
||||
NULL as live_photo_video_id,
|
||||
lae.orientation,
|
||||
NULL as stack_id,
|
||||
lae.cloud_id
|
||||
lae.i_cloud_id
|
||||
FROM
|
||||
local_asset_entity lae
|
||||
WHERE NOT EXISTS (
|
||||
|
||||
@ -29,7 +29,7 @@ class MergedAssetDrift extends i1.ModularAccessor {
|
||||
);
|
||||
$arrayStartIndex += generatedlimit.amountOfVariables;
|
||||
return customSelect(
|
||||
'SELECT rae.id AS remote_id, (SELECT lae.id FROM local_asset_entity AS lae WHERE lae.checksum = rae.checksum LIMIT 1) AS local_id, rae.name, rae.type, rae.created_at AS created_at, rae.updated_at, rae.width, rae.height, rae.duration_in_seconds, rae.is_favorite, rae.thumb_hash, rae.checksum, rae.owner_id, rae.live_photo_video_id, 0 AS orientation, rae.stack_id, NULL AS cloud_id FROM remote_asset_entity AS rae LEFT JOIN stack_entity AS se ON rae.stack_id = se.id WHERE rae.deleted_at IS NULL AND rae.visibility = 0 AND rae.owner_id IN ($expandeduserIds) AND(rae.stack_id IS NULL OR rae.id = se.primary_asset_id)UNION ALL SELECT NULL AS remote_id, lae.id AS local_id, lae.name, lae.type, lae.created_at AS created_at, lae.updated_at, lae.width, lae.height, lae.duration_in_seconds, lae.is_favorite, NULL AS thumb_hash, lae.checksum, NULL AS owner_id, NULL AS live_photo_video_id, lae.orientation, NULL AS stack_id, lae.cloud_id FROM local_asset_entity AS lae WHERE NOT EXISTS (SELECT 1 FROM remote_asset_entity AS rae WHERE rae.checksum = lae.checksum AND rae.owner_id IN ($expandeduserIds)) AND EXISTS (SELECT 1 FROM local_album_asset_entity AS laa INNER JOIN local_album_entity AS la ON laa.album_id = la.id WHERE laa.asset_id = lae.id AND la.backup_selection = 0) AND NOT EXISTS (SELECT 1 FROM local_album_asset_entity AS laa INNER JOIN local_album_entity AS la ON laa.album_id = la.id WHERE laa.asset_id = lae.id AND la.backup_selection = 2) ORDER BY created_at DESC ${generatedlimit.sql}',
|
||||
'SELECT rae.id AS remote_id, (SELECT lae.id FROM local_asset_entity AS lae WHERE lae.checksum = rae.checksum LIMIT 1) AS local_id, rae.name, rae.type, rae.created_at AS created_at, rae.updated_at, rae.width, rae.height, rae.duration_in_seconds, rae.is_favorite, rae.thumb_hash, rae.checksum, rae.owner_id, rae.live_photo_video_id, 0 AS orientation, rae.stack_id, NULL AS i_cloud_id FROM remote_asset_entity AS rae LEFT JOIN stack_entity AS se ON rae.stack_id = se.id WHERE rae.deleted_at IS NULL AND rae.visibility = 0 AND rae.owner_id IN ($expandeduserIds) AND(rae.stack_id IS NULL OR rae.id = se.primary_asset_id)UNION ALL SELECT NULL AS remote_id, lae.id AS local_id, lae.name, lae.type, lae.created_at AS created_at, lae.updated_at, lae.width, lae.height, lae.duration_in_seconds, lae.is_favorite, NULL AS thumb_hash, lae.checksum, NULL AS owner_id, NULL AS live_photo_video_id, lae.orientation, NULL AS stack_id, lae.i_cloud_id FROM local_asset_entity AS lae WHERE NOT EXISTS (SELECT 1 FROM remote_asset_entity AS rae WHERE rae.checksum = lae.checksum AND rae.owner_id IN ($expandeduserIds)) AND EXISTS (SELECT 1 FROM local_album_asset_entity AS laa INNER JOIN local_album_entity AS la ON laa.album_id = la.id WHERE laa.asset_id = lae.id AND la.backup_selection = 0) AND NOT EXISTS (SELECT 1 FROM local_album_asset_entity AS laa INNER JOIN local_album_entity AS la ON laa.album_id = la.id WHERE laa.asset_id = lae.id AND la.backup_selection = 2) ORDER BY created_at DESC ${generatedlimit.sql}',
|
||||
variables: [
|
||||
for (var $ in userIds) i0.Variable<String>($),
|
||||
...generatedlimit.introducedVariables,
|
||||
@ -62,7 +62,7 @@ class MergedAssetDrift extends i1.ModularAccessor {
|
||||
livePhotoVideoId: row.readNullable<String>('live_photo_video_id'),
|
||||
orientation: row.read<int>('orientation'),
|
||||
stackId: row.readNullable<String>('stack_id'),
|
||||
cloudId: row.readNullable<String>('cloud_id'),
|
||||
iCloudId: row.readNullable<String>('i_cloud_id'),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -130,7 +130,7 @@ class MergedAssetResult {
|
||||
final String? livePhotoVideoId;
|
||||
final int orientation;
|
||||
final String? stackId;
|
||||
final String? cloudId;
|
||||
final String? iCloudId;
|
||||
MergedAssetResult({
|
||||
this.remoteId,
|
||||
this.localId,
|
||||
@ -148,7 +148,7 @@ class MergedAssetResult {
|
||||
this.livePhotoVideoId,
|
||||
required this.orientation,
|
||||
this.stackId,
|
||||
this.cloudId,
|
||||
this.iCloudId,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -137,7 +137,7 @@ class Drift extends $Drift implements IDatabaseRepository {
|
||||
},
|
||||
from10To11: (m, v11) async {
|
||||
// Add cloud_id to local and remote asset tables
|
||||
await m.addColumn(v11.localAssetEntity, v11.localAssetEntity.cloudId);
|
||||
await m.addColumn(v11.localAssetEntity, v11.localAssetEntity.iCloudId);
|
||||
await m.createIndex(v11.idxLocalAssetCloudId);
|
||||
await m.createTable(v11.remoteAssetCloudIdEntity);
|
||||
},
|
||||
|
||||
@ -4691,13 +4691,13 @@ class Shape22 extends i0.VersionedTable {
|
||||
columnsByName['is_favorite']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<int> get orientation =>
|
||||
columnsByName['orientation']! as i1.GeneratedColumn<int>;
|
||||
i1.GeneratedColumn<String> get cloudId =>
|
||||
columnsByName['cloud_id']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get iCloudId =>
|
||||
columnsByName['i_cloud_id']! as i1.GeneratedColumn<String>;
|
||||
}
|
||||
|
||||
i1.GeneratedColumn<String> _column_95(String aliasedName) =>
|
||||
i1.GeneratedColumn<String>(
|
||||
'cloud_id',
|
||||
'i_cloud_id',
|
||||
aliasedName,
|
||||
true,
|
||||
type: i1.DriftSqlType.string,
|
||||
|
||||
@ -243,7 +243,7 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
||||
|
||||
batch.update(
|
||||
_db.localAssetEntity,
|
||||
LocalAssetEntityCompanion(cloudId: Value(cloudId)),
|
||||
LocalAssetEntityCompanion(iCloudId: Value(cloudId)),
|
||||
where: (f) => f.id.equals(assetId),
|
||||
);
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
|
||||
_db.localAssetEntity.selectOnly().join([
|
||||
leftOuterJoin(
|
||||
_db.remoteAssetCloudIdEntity,
|
||||
_db.localAssetEntity.cloudId.equalsExp(_db.remoteAssetCloudIdEntity.cloudId),
|
||||
_db.localAssetEntity.iCloudId.equalsExp(_db.remoteAssetCloudIdEntity.cloudId),
|
||||
useColumns: false,
|
||||
),
|
||||
leftOuterJoin(
|
||||
|
||||
@ -87,7 +87,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
||||
isFavorite: row.isFavorite,
|
||||
durationInSeconds: row.durationInSeconds,
|
||||
orientation: row.orientation,
|
||||
cloudId: row.cloudId,
|
||||
cloudId: row.iCloudId,
|
||||
),
|
||||
)
|
||||
.get();
|
||||
|
||||
54
mobile/test/drift/main/generated/schema_v11.dart
generated
54
mobile/test/drift/main/generated/schema_v11.dart
generated
@ -1486,8 +1486,8 @@ class LocalAssetEntity extends Table
|
||||
requiredDuringInsert: false,
|
||||
defaultValue: const CustomExpression('0'),
|
||||
);
|
||||
late final GeneratedColumn<String> cloudId = GeneratedColumn<String>(
|
||||
'cloud_id',
|
||||
late final GeneratedColumn<String> iCloudId = GeneratedColumn<String>(
|
||||
'i_cloud_id',
|
||||
aliasedName,
|
||||
true,
|
||||
type: DriftSqlType.string,
|
||||
@ -1506,7 +1506,7 @@ class LocalAssetEntity extends Table
|
||||
checksum,
|
||||
isFavorite,
|
||||
orientation,
|
||||
cloudId,
|
||||
iCloudId,
|
||||
];
|
||||
@override
|
||||
String get aliasedName => _alias ?? actualTableName;
|
||||
@ -1563,9 +1563,9 @@ class LocalAssetEntity extends Table
|
||||
DriftSqlType.int,
|
||||
data['${effectivePrefix}orientation'],
|
||||
)!,
|
||||
cloudId: attachedDatabase.typeMapping.read(
|
||||
iCloudId: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}cloud_id'],
|
||||
data['${effectivePrefix}i_cloud_id'],
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -1594,7 +1594,7 @@ class LocalAssetEntityData extends DataClass
|
||||
final String? checksum;
|
||||
final bool isFavorite;
|
||||
final int orientation;
|
||||
final String? cloudId;
|
||||
final String? iCloudId;
|
||||
const LocalAssetEntityData({
|
||||
required this.name,
|
||||
required this.type,
|
||||
@ -1607,7 +1607,7 @@ class LocalAssetEntityData extends DataClass
|
||||
this.checksum,
|
||||
required this.isFavorite,
|
||||
required this.orientation,
|
||||
this.cloudId,
|
||||
this.iCloudId,
|
||||
});
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
@ -1631,8 +1631,8 @@ class LocalAssetEntityData extends DataClass
|
||||
}
|
||||
map['is_favorite'] = Variable<bool>(isFavorite);
|
||||
map['orientation'] = Variable<int>(orientation);
|
||||
if (!nullToAbsent || cloudId != null) {
|
||||
map['cloud_id'] = Variable<String>(cloudId);
|
||||
if (!nullToAbsent || iCloudId != null) {
|
||||
map['i_cloud_id'] = Variable<String>(iCloudId);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@ -1654,7 +1654,7 @@ class LocalAssetEntityData extends DataClass
|
||||
checksum: serializer.fromJson<String?>(json['checksum']),
|
||||
isFavorite: serializer.fromJson<bool>(json['isFavorite']),
|
||||
orientation: serializer.fromJson<int>(json['orientation']),
|
||||
cloudId: serializer.fromJson<String?>(json['cloudId']),
|
||||
iCloudId: serializer.fromJson<String?>(json['iCloudId']),
|
||||
);
|
||||
}
|
||||
@override
|
||||
@ -1672,7 +1672,7 @@ class LocalAssetEntityData extends DataClass
|
||||
'checksum': serializer.toJson<String?>(checksum),
|
||||
'isFavorite': serializer.toJson<bool>(isFavorite),
|
||||
'orientation': serializer.toJson<int>(orientation),
|
||||
'cloudId': serializer.toJson<String?>(cloudId),
|
||||
'iCloudId': serializer.toJson<String?>(iCloudId),
|
||||
};
|
||||
}
|
||||
|
||||
@ -1688,7 +1688,7 @@ class LocalAssetEntityData extends DataClass
|
||||
Value<String?> checksum = const Value.absent(),
|
||||
bool? isFavorite,
|
||||
int? orientation,
|
||||
Value<String?> cloudId = const Value.absent(),
|
||||
Value<String?> iCloudId = const Value.absent(),
|
||||
}) => LocalAssetEntityData(
|
||||
name: name ?? this.name,
|
||||
type: type ?? this.type,
|
||||
@ -1703,7 +1703,7 @@ class LocalAssetEntityData extends DataClass
|
||||
checksum: checksum.present ? checksum.value : this.checksum,
|
||||
isFavorite: isFavorite ?? this.isFavorite,
|
||||
orientation: orientation ?? this.orientation,
|
||||
cloudId: cloudId.present ? cloudId.value : this.cloudId,
|
||||
iCloudId: iCloudId.present ? iCloudId.value : this.iCloudId,
|
||||
);
|
||||
LocalAssetEntityData copyWithCompanion(LocalAssetEntityCompanion data) {
|
||||
return LocalAssetEntityData(
|
||||
@ -1724,7 +1724,7 @@ class LocalAssetEntityData extends DataClass
|
||||
orientation: data.orientation.present
|
||||
? data.orientation.value
|
||||
: this.orientation,
|
||||
cloudId: data.cloudId.present ? data.cloudId.value : this.cloudId,
|
||||
iCloudId: data.iCloudId.present ? data.iCloudId.value : this.iCloudId,
|
||||
);
|
||||
}
|
||||
|
||||
@ -1742,7 +1742,7 @@ class LocalAssetEntityData extends DataClass
|
||||
..write('checksum: $checksum, ')
|
||||
..write('isFavorite: $isFavorite, ')
|
||||
..write('orientation: $orientation, ')
|
||||
..write('cloudId: $cloudId')
|
||||
..write('iCloudId: $iCloudId')
|
||||
..write(')'))
|
||||
.toString();
|
||||
}
|
||||
@ -1760,7 +1760,7 @@ class LocalAssetEntityData extends DataClass
|
||||
checksum,
|
||||
isFavorite,
|
||||
orientation,
|
||||
cloudId,
|
||||
iCloudId,
|
||||
);
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
@ -1777,7 +1777,7 @@ class LocalAssetEntityData extends DataClass
|
||||
other.checksum == this.checksum &&
|
||||
other.isFavorite == this.isFavorite &&
|
||||
other.orientation == this.orientation &&
|
||||
other.cloudId == this.cloudId);
|
||||
other.iCloudId == this.iCloudId);
|
||||
}
|
||||
|
||||
class LocalAssetEntityCompanion extends UpdateCompanion<LocalAssetEntityData> {
|
||||
@ -1792,7 +1792,7 @@ class LocalAssetEntityCompanion extends UpdateCompanion<LocalAssetEntityData> {
|
||||
final Value<String?> checksum;
|
||||
final Value<bool> isFavorite;
|
||||
final Value<int> orientation;
|
||||
final Value<String?> cloudId;
|
||||
final Value<String?> iCloudId;
|
||||
const LocalAssetEntityCompanion({
|
||||
this.name = const Value.absent(),
|
||||
this.type = const Value.absent(),
|
||||
@ -1805,7 +1805,7 @@ class LocalAssetEntityCompanion extends UpdateCompanion<LocalAssetEntityData> {
|
||||
this.checksum = const Value.absent(),
|
||||
this.isFavorite = const Value.absent(),
|
||||
this.orientation = const Value.absent(),
|
||||
this.cloudId = const Value.absent(),
|
||||
this.iCloudId = const Value.absent(),
|
||||
});
|
||||
LocalAssetEntityCompanion.insert({
|
||||
required String name,
|
||||
@ -1819,7 +1819,7 @@ class LocalAssetEntityCompanion extends UpdateCompanion<LocalAssetEntityData> {
|
||||
this.checksum = const Value.absent(),
|
||||
this.isFavorite = const Value.absent(),
|
||||
this.orientation = const Value.absent(),
|
||||
this.cloudId = const Value.absent(),
|
||||
this.iCloudId = const Value.absent(),
|
||||
}) : name = Value(name),
|
||||
type = Value(type),
|
||||
id = Value(id);
|
||||
@ -1835,7 +1835,7 @@ class LocalAssetEntityCompanion extends UpdateCompanion<LocalAssetEntityData> {
|
||||
Expression<String>? checksum,
|
||||
Expression<bool>? isFavorite,
|
||||
Expression<int>? orientation,
|
||||
Expression<String>? cloudId,
|
||||
Expression<String>? iCloudId,
|
||||
}) {
|
||||
return RawValuesInsertable({
|
||||
if (name != null) 'name': name,
|
||||
@ -1849,7 +1849,7 @@ class LocalAssetEntityCompanion extends UpdateCompanion<LocalAssetEntityData> {
|
||||
if (checksum != null) 'checksum': checksum,
|
||||
if (isFavorite != null) 'is_favorite': isFavorite,
|
||||
if (orientation != null) 'orientation': orientation,
|
||||
if (cloudId != null) 'cloud_id': cloudId,
|
||||
if (iCloudId != null) 'i_cloud_id': iCloudId,
|
||||
});
|
||||
}
|
||||
|
||||
@ -1865,7 +1865,7 @@ class LocalAssetEntityCompanion extends UpdateCompanion<LocalAssetEntityData> {
|
||||
Value<String?>? checksum,
|
||||
Value<bool>? isFavorite,
|
||||
Value<int>? orientation,
|
||||
Value<String?>? cloudId,
|
||||
Value<String?>? iCloudId,
|
||||
}) {
|
||||
return LocalAssetEntityCompanion(
|
||||
name: name ?? this.name,
|
||||
@ -1879,7 +1879,7 @@ class LocalAssetEntityCompanion extends UpdateCompanion<LocalAssetEntityData> {
|
||||
checksum: checksum ?? this.checksum,
|
||||
isFavorite: isFavorite ?? this.isFavorite,
|
||||
orientation: orientation ?? this.orientation,
|
||||
cloudId: cloudId ?? this.cloudId,
|
||||
iCloudId: iCloudId ?? this.iCloudId,
|
||||
);
|
||||
}
|
||||
|
||||
@ -1919,8 +1919,8 @@ class LocalAssetEntityCompanion extends UpdateCompanion<LocalAssetEntityData> {
|
||||
if (orientation.present) {
|
||||
map['orientation'] = Variable<int>(orientation.value);
|
||||
}
|
||||
if (cloudId.present) {
|
||||
map['cloud_id'] = Variable<String>(cloudId.value);
|
||||
if (iCloudId.present) {
|
||||
map['i_cloud_id'] = Variable<String>(iCloudId.value);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@ -1939,7 +1939,7 @@ class LocalAssetEntityCompanion extends UpdateCompanion<LocalAssetEntityData> {
|
||||
..write('checksum: $checksum, ')
|
||||
..write('isFavorite: $isFavorite, ')
|
||||
..write('orientation: $orientation, ')
|
||||
..write('cloudId: $cloudId')
|
||||
..write('iCloudId: $iCloudId')
|
||||
..write(')'))
|
||||
.toString();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user