High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
feat: opt-in sync of deletes and restores from web to Android (beta timeline) (#20473)
Peter Ombodi493cde9d5535
diff --git a/i18n/en.json b/i18n/en.jsonindex a83cb07d62..644b74e715 100644--- a/i18n/en.json+++ b/i18n/en.json@@ -475,6 +475,7 @@"allow_edits": "Allow edits","allow_public_user_to_download": "Allow public user to download","allow_public_user_to_upload": "Allow public user to upload",+ "allowed": "Allowed","alt_text_qr_code": "QR code image","anti_clockwise": "Anti-clockwise","api_key": "API Key",@@ -1314,6 +1315,10 @@"main_menu": "Main menu","make": "Make","manage_geolocation": "Manage location",+ "manage_media_access_rationale": "This permission is required for proper handling of moving assets to the trash and restoring them from it.",+ "manage_media_access_settings": "Open settings",+ "manage_media_access_subtitle": "Allow the Immich app to manage and move media files.",+ "manage_media_access_title": "Media Management Access","manage_shared_links": "Manage shared links","manage_sharing_with_partners": "Manage sharing with partners","manage_the_app_settings": "Manage the app settings",@@ -1438,6 +1443,7 @@"no_results_description": "Try a synonym or more general keyword","no_shared_albums_message": "Create an album to share photos and videos with people in your network","no_uploads_in_progress": "No uploads in progress",+ "not_allowed": "Not allowed","not_available": "N/A","not_in_any_album": "Not in any album","not_selected": "Not selected",diff --git a/mobile/android/app/src/main/kotlin/app/alextran/immich/BackgroundServicePlugin.kt b/mobile/android/app/src/main/kotlin/app/alextran/immich/BackgroundServicePlugin.ktindex ae2ec22a71..f62f25558d 100644--- a/mobile/android/app/src/main/kotlin/app/alextran/immich/BackgroundServicePlugin.kt+++ b/mobile/android/app/src/main/kotlin/app/alextran/immich/BackgroundServicePlugin.kt@@ -143,7 +143,7 @@ class BackgroundServicePlugin : FlutterPlugin, MethodChannel.MethodCallHandler,val mediaUrls = call.argument<List<String>>("mediaUrls")if (mediaUrls != null) {if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) && hasManageMediaPermission()) {- moveToTrash(mediaUrls, result)+ moveToTrash(mediaUrls, result)} else {result.error("PERMISSION_DENIED", "Media permission required", null)}@@ -155,15 +155,23 @@ class BackgroundServicePlugin : FlutterPlugin, MethodChannel.MethodCallHandler,"restoreFromTrash" -> {val fileName = call.argument<String>("fileName")val type = call.argument<Int>("type")+ val mediaId = call.argument<String>("mediaId")if (fileName != null && type != null) {if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) && hasManageMediaPermission()) {restoreFromTrash(fileName, type, result)} else {result.error("PERMISSION_DENIED", "Media permission required", null)}- } else {- result.error("INVALID_NAME", "The file name is not specified.", null)- }+ } else+ if (mediaId != null && type != null) {+ if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) && hasManageMediaPermission()) {+ restoreFromTrashById(mediaId, type, result)+ } else {+ result.error("PERMISSION_DENIED", "Media permission required", null)+ }+ } else {+ result.error("INVALID_PARAMS", "Required params are not specified.", null)+ }}"requestManageMediaPermission" -> {@@ -175,6 +183,17 @@ class BackgroundServicePlugin : FlutterPlugin, MethodChannel.MethodCallHandler,}}+ "hasManageMediaPermission" -> {+ if (hasManageMediaPermission()) {+ Log.i("Manage storage permission", "Permission already granted")+ result.success(true)+ } else {+ result.success(false)+ }+ }++ "manageMediaPermission" -> requestManageMediaPermission(result)+else -> result.notImplemented()}}@@ -223,26 +242,48 @@ class BackgroundServicePlugin : FlutterPlugin, MethodChannel.MethodCallHandler,uri.let { toggleTrash(listOf(it), false, result) }}+ @RequiresApi(Build.VERSION_CODES.R)+ private fun restoreFromTrashById(mediaId: String, type: Int, result: Result) {+ val id = mediaId.toLongOrNull()+ if (id == null) {+ result.error("INVALID_ID", "The file id is not a valid number: $mediaId", null)+ return+ }+ if (!isInTrash(id)) {+ result.error("TrashNotFound", "Item with id=$id not found in trash", null)+ return+ }++ val uri = ContentUris.withAppendedId(contentUriForType(type), id)++ try {+ Log.i(TAG, "restoreFromTrashById: uri=$uri (type=$type,id=$id)")+ restoreUris(listOf(uri), result)+ } catch (e: Exception) {+ Log.w(TAG, "restoreFromTrashById failed", e)+ }+ }+@RequiresApi(Build.VERSION_CODES.R)private fun toggleTrash(contentUris: List<Uri>, isTrashed: Boolean, result: Result) {- val activity = activityBinding?.activity- val contentResolver = context?.contentResolver- if (activity == null || contentResolver == null) {- result.error("TrashError", "Activity or ContentResolver not available", null)- return- }+ val activity = activityBinding?.activity+ val contentResolver = context?.contentResolver+ if (activity == null || contentResolver == null) {+ result.error("TrashError", "Activity or ContentResolver not available", null)+ return+ }- try {- val pendingIntent = MediaStore.createTrashRequest(contentResolver, contentUris, isTrashed)- pendingResult = result // Store for onActivityResult- activity.startIntentSenderForResult(- pendingIntent.intentSender,- trashRequestCode,- null, 0, 0, 0- )- } catch (e: Exception) {- Log.e("TrashError", "Error creating or starting trash request", e)- result.error("TrashError", "Error creating or starting trash request", null)+ try {+ val pendingIntent = MediaStore.createTrashRequest(contentResolver, contentUris, isTrashed)+ pendingResult = result // Store for onActivityResult+ activity.startIntentSenderForResult(+ pendingIntent.intentSender,+ trashRequestCode,+ null, 0, 0, 0+ )+ } catch (e: Exception) {+ Log.e("TrashError", "Error creating or starting trash request", e)+ result.error("TrashError", "Error creating or starting trash request", null)}}@@ -264,14 +305,7 @@ class BackgroundServicePlugin : FlutterPlugin, MethodChannel.MethodCallHandler,contentResolver.query(queryUri, projection, queryArgs, null)?.use { cursor ->if (cursor.moveToFirst()) {val id = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns._ID))- // same order as AssetType from dart- val contentUri = when (type) {- 1 -> MediaStore.Images.Media.EXTERNAL_CONTENT_URI- 2 -> MediaStore.Video.Media.EXTERNAL_CONTENT_URI- 3 -> MediaStore.Audio.Media.EXTERNAL_CONTENT_URI- else -> queryUri- }- return ContentUris.withAppendedId(contentUri, id)+ return ContentUris.withAppendedId(contentUriForType(type), id)}}return null@@ -315,6 +349,40 @@ class BackgroundServicePlugin : FlutterPlugin, MethodChannel.MethodCallHandler,}return false}++ @RequiresApi(Build.VERSION_CODES.R)+ private fun isInTrash(id: Long): Boolean {+ val contentResolver = context?.contentResolver ?: return false+ val filesUri = MediaStore.Files.getContentUri(MediaStore.VOLUME_EXTERNAL)+ val args = Bundle().apply {+ putString(ContentResolver.QUERY_ARG_SQL_SELECTION, "${MediaStore.Files.FileColumns._ID}=?")+ putStringArray(ContentResolver.QUERY_ARG_SQL_SELECTION_ARGS, arrayOf(id.toString()))+ putInt(MediaStore.QUERY_ARG_MATCH_TRASHED, MediaStore.MATCH_ONLY)+ putInt(ContentResolver.QUERY_ARG_LIMIT, 1)+ }+ return contentResolver.query(filesUri, arrayOf(MediaStore.Files.FileColumns._ID), args, null)+ ?.use { it.moveToFirst() } == true+ }++ @RequiresApi(Build.VERSION_CODES.R)+ private fun restoreUris(uris: List<Uri>, result: Result) {+ if (uris.isEmpty()) {+ result.error("TrashError", "No URIs to restore", null)+ return+ }+ Log.i(TAG, "restoreUris: count=${uris.size}, first=${uris.first()}")+ toggleTrash(uris, false, result)+ }++ @RequiresApi(Build.VERSION_CODES.Q)+ private fun contentUriForType(type: Int): Uri =+ when (type) {+ // same order as AssetType from dart+ 1 -> MediaStore.Images.Media.EXTERNAL_CONTENT_URI+ 2 -> MediaStore.Video.Media.EXTERNAL_CONTENT_URI+ 3 -> MediaStore.Audio.Media.EXTERNAL_CONTENT_URI+ else -> MediaStore.Files.getContentUri(MediaStore.VOLUME_EXTERNAL)+ }}private const val TAG = "BackgroundServicePlugin"diff --git a/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/Messages.g.kt b/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/Messages.g.ktindex 08ff0e821a..e6cf92f573 100644--- a/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/Messages.g.kt+++ b/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/Messages.g.kt@@ -305,6 +305,7 @@ interface NativeSyncApi {fun getAssetsForAlbum(albumId: String, updatedTimeCond: Long?): List<PlatformAsset>fun hashAssets(assetIds: List<String>, allowNetworkAccess: Boolean, callback: (Result<List<HashResult>>) -> Unit)fun cancelHashing()+ fun getTrashedAssets(): Map<String, List<PlatformAsset>>companion object {/** The codec used by NativeSyncApi. */@@ -483,6 +484,21 @@ interface NativeSyncApi {channel.setMessageHandler(null)}}+ run {+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getTrashedAssets$separatedMessageChannelSuffix", codec, taskQueue)+ if (api != null) {+ channel.setMessageHandler { _, reply ->+ val wrapped: List<Any?> = try {+ listOf(api.getTrashedAssets())+ } catch (exception: Throwable) {+ MessagesPigeonUtils.wrapError(exception)+ }+ reply.reply(wrapped)+ }+ } else {+ channel.setMessageHandler(null)+ }+ }}}}diff --git a/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImpl26.kt b/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImpl26.ktindex 5deacc30db..6d2c35d78f 100644--- a/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImpl26.kt+++ b/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImpl26.kt@@ -21,4 +21,9 @@ class NativeSyncApiImpl26(context: Context) : NativeSyncApiImplBase(context), Naoverride fun getMediaChanges(): SyncDelta {throw IllegalStateException("Method not supported on this Android version.")}++ override fun getTrashedAssets(): Map<String, List<PlatformAsset>> {+ //Method not supported on this Android version.+ return emptyMap()+ }}diff --git a/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImpl30.kt b/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImpl30.ktindex 052032e143..ca54c9f823 100644--- a/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImpl30.kt+++ b/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImpl30.kt@@ -1,7 +1,9 @@package app.alextran.immich.sync+import android.content.ContentResolverimport android.content.Contextimport android.os.Build+import android.os.Bundleimport android.provider.MediaStoreimport androidx.annotation.RequiresApiimport androidx.annotation.RequiresExtension@@ -86,4 +88,29 @@ class NativeSyncApiImpl30(context: Context) : NativeSyncApiImplBase(context), Na// Unmounted volumes are handled in dart when the album is removedreturn SyncDelta(hasChanges, changed, deleted, assetAlbums)}++ override fun getTrashedAssets(): Map<String, List<PlatformAsset>> {++ val result = LinkedHashMap<String, MutableList<PlatformAsset>>()+ val volumes = MediaStore.getExternalVolumeNames(ctx)++ for (volume in volumes) {++ val queryArgs = Bundle().apply {+ putString(ContentResolver.QUERY_ARG_SQL_SELECTION, MEDIA_SELECTION)+ putStringArray(ContentResolver.QUERY_ARG_SQL_SELECTION_ARGS, MEDIA_SELECTION_ARGS)+ putInt(MediaStore.QUERY_ARG_MATCH_TRASHED, MediaStore.MATCH_ONLY)+ }++ getCursor(volume, queryArgs).use { cursor ->+ getAssets(cursor).forEach { res ->+ if (res is AssetResult.ValidAsset) {+ result.getOrPut(res.albumId) { mutableListOf() }.add(res.asset)+ }+ }+ }+ }++ return result.mapValues { it.value.toList() }+ }}diff --git a/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImplBase.kt b/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImplBase.ktindex ca2781f7b4..b1e9dd7d44 100644--- a/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImplBase.kt+++ b/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImplBase.kt@@ -4,6 +4,8 @@ import android.annotation.SuppressLintimport android.content.ContentUrisimport android.content.Contextimport android.database.Cursor+import android.net.Uri+import android.os.Bundleimport android.provider.MediaStoreimport android.util.Base64import androidx.core.database.getStringOrNull@@ -81,6 +83,16 @@ open class NativeSyncApiImplBase(context: Context) : ImmichPlugin() {sortOrder,)+ protected fun getCursor(+ volume: String,+ queryArgs: Bundle+ ): Cursor? = ctx.contentResolver.query(+ MediaStore.Files.getContentUri(volume),+ ASSET_PROJECTION,+ queryArgs,+ null+ )+protected fun getAssets(cursor: Cursor?): Sequence<AssetResult> {return sequence {cursor?.use { c ->diff --git a/mobile/drift_schemas/main/drift_schema_v13.json b/mobile/drift_schemas/main/drift_schema_v13.jsonnew file mode 100644index 0000000000..e527e8d78a--- /dev/null+++ b/mobile/drift_schemas/main/drift_schema_v13.json@@ -0,0 +1 @@+{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":true},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"user_entity","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"email","getter_name":"email","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"has_profile_image","getter_name":"hasProfileImage","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"has_profile_image\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"has_profile_image\" IN (0, 1))"},"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]},{"name":"profile_changed_at","getter_name":"profileChangedAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"avatar_color","getter_name":"avatarColor","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter<AvatarColor>(AvatarColor.values)","dart_type_name":"AvatarColor"}}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["id"]}},{"id":1,"references":[0],"type":"table","data":{"name":"remote_asset_entity","was_declared_in_moor":false,"columns":[{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter<AssetType>(AssetType.values)","dart_type_name":"AssetType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"updated_at","getter_name":"updatedAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"width","getter_name":"width","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"height","getter_name":"height","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"duration_in_seconds","getter_name":"durationInSeconds","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"checksum","getter_name":"checksum","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_favorite","getter_name":"isFavorite","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_favorite\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_favorite\" IN (0, 1))"},"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]},{"name":"owner_id","getter_name":"ownerId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES user_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES user_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"local_date_time","getter_name":"localDateTime","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"thumb_hash","getter_name":"thumbHash","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"deleted_at","getter_name":"deletedAt","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"live_photo_video_id","getter_name":"livePhotoVideoId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"visibility","getter_name":"visibility","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter<AssetVisibility>(AssetVisibility.values)","dart_type_name":"AssetVisibility"}},{"name":"stack_id","getter_name":"stackId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"library_id","getter_name":"libraryId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["id"]}},{"id":2,"references":[0],"type":"table","data":{"name":"stack_entity","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"updated_at","getter_name":"updatedAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"owner_id","getter_name":"ownerId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES user_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES user_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"primary_asset_id","getter_name":"primaryAssetId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["id"]}},{"id":3,"references":[],"type":"table","data":{"name":"local_asset_entity","was_declared_in_moor":false,"columns":[{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter<AssetType>(AssetType.values)","dart_type_name":"AssetType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"updated_at","getter_name":"updatedAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"width","getter_name":"width","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"height","getter_name":"height","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"duration_in_seconds","getter_name":"durationInSeconds","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"checksum","getter_name":"checksum","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_favorite","getter_name":"isFavorite","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_favorite\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_favorite\" IN (0, 1))"},"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]},{"name":"orientation","getter_name":"orientation","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["id"]}},{"id":4,"references":[0,1],"type":"table","data":{"name":"remote_album_entity","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"description","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('\\'\\'')","default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"updated_at","getter_name":"updatedAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"owner_id","getter_name":"ownerId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES user_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES user_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"thumbnail_asset_id","getter_name":"thumbnailAssetId","moor_type":"string","nullable":true,"customConstraints":null,"defaultConstraints":"REFERENCES remote_asset_entity (id) ON DELETE SET NULL","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES remote_asset_entity (id) ON DELETE SET NULL"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"is_activity_enabled","getter_name":"isActivityEnabled","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_activity_enabled\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_activity_enabled\" IN (0, 1))"},"default_dart":"const CustomExpression('1')","default_client_dart":null,"dsl_features":[]},{"name":"order","getter_name":"order","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter<AlbumAssetOrder>(AlbumAssetOrder.values)","dart_type_name":"AlbumAssetOrder"}}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["id"]}},{"id":5,"references":[4],"type":"table","data":{"name":"local_album_entity","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"updated_at","getter_name":"updatedAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"backup_selection","getter_name":"backupSelection","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter<BackupSelection>(BackupSelection.values)","dart_type_name":"BackupSelection"}},{"name":"is_ios_shared_album","getter_name":"isIosSharedAlbum","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_ios_shared_album\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_ios_shared_album\" IN (0, 1))"},"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]},{"name":"linked_remote_album_id","getter_name":"linkedRemoteAlbumId","moor_type":"string","nullable":true,"customConstraints":null,"defaultConstraints":"REFERENCES remote_album_entity (id) ON DELETE SET NULL","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES remote_album_entity (id) ON DELETE SET NULL"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"marker","getter_name":"marker_","moor_type":"bool","nullable":true,"customConstraints":null,"defaultConstraints":"CHECK (\"marker\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"marker\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["id"]}},{"id":6,"references":[3,5],"type":"table","data":{"name":"local_album_asset_entity","was_declared_in_moor":false,"columns":[{"name":"asset_id","getter_name":"assetId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES local_asset_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES local_asset_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"album_id","getter_name":"albumId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES local_album_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES local_album_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"marker","getter_name":"marker_","moor_type":"bool","nullable":true,"customConstraints":null,"defaultConstraints":"CHECK (\"marker\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"marker\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["asset_id","album_id"]}},{"id":7,"references":[3],"type":"index","data":{"on":3,"name":"idx_local_asset_checksum","sql":"CREATE INDEX IF NOT EXISTS idx_local_asset_checksum ON local_asset_entity (checksum)","unique":false,"columns":[]}},{"id":8,"references":[1],"type":"index","data":{"on":1,"name":"idx_remote_asset_owner_checksum","sql":"CREATE INDEX IF NOT EXISTS idx_remote_asset_owner_checksum ON remote_asset_entity (owner_id, checksum)","unique":false,"columns":[]}},{"id":9,"references":[1],"type":"index","data":{"on":1,"name":"UQ_remote_assets_owner_checksum","sql":"CREATE UNIQUE INDEX IF NOT EXISTS UQ_remote_assets_owner_checksum\nON remote_asset_entity (owner_id, checksum)\nWHERE (library_id IS NULL);\n","unique":true,"columns":[]}},{"id":10,"references":[1],"type":"index","data":{"on":1,"name":"UQ_remote_assets_owner_library_checksum","sql":"CREATE UNIQUE INDEX IF NOT EXISTS UQ_remote_assets_owner_library_checksum\nON remote_asset_entity (owner_id, library_id, checksum)\nWHERE (library_id IS NOT NULL);\n","unique":true,"columns":[]}},{"id":11,"references":[1],"type":"index","data":{"on":1,"name":"idx_remote_asset_checksum","sql":"CREATE INDEX IF NOT EXISTS idx_remote_asset_checksum ON remote_asset_entity (checksum)","unique":false,"columns":[]}},{"id":12,"references":[],"type":"table","data":{"name":"auth_user_entity","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"email","getter_name":"email","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_admin","getter_name":"isAdmin","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_admin\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_admin\" IN (0, 1))"},"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]},{"name":"has_profile_image","getter_name":"hasProfileImage","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"has_profile_image\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"has_profile_image\" IN (0, 1))"},"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]},{"name":"profile_changed_at","getter_name":"profileChangedAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"avatar_color","getter_name":"avatarColor","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter<AvatarColor>(AvatarColor.values)","dart_type_name":"AvatarColor"}},{"name":"quota_size_in_bytes","getter_name":"quotaSizeInBytes","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]},{"name":"quota_usage_in_bytes","getter_name":"quotaUsageInBytes","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]},{"name":"pin_code","getter_name":"pinCode","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["id"]}},{"id":13,"references":[0],"type":"table","data":{"name":"user_metadata_entity","was_declared_in_moor":false,"columns":[{"name":"user_id","getter_name":"userId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES user_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES user_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"key","getter_name":"key","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter<UserMetadataKey>(UserMetadataKey.values)","dart_type_name":"UserMetadataKey"}},{"name":"value","getter_name":"value","moor_type":"blob","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"userMetadataConverter","dart_type_name":"Map<String, Object?>"}}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["user_id","key"]}},{"id":14,"references":[0],"type":"table","data":{"name":"partner_entity","was_declared_in_moor":false,"columns":[{"name":"shared_by_id","getter_name":"sharedById","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES user_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES user_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"shared_with_id","getter_name":"sharedWithId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES user_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES user_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"in_timeline","getter_name":"inTimeline","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"in_timeline\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"in_timeline\" IN (0, 1))"},"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["shared_by_id","shared_with_id"]}},{"id":15,"references":[1],"type":"table","data":{"name":"remote_exif_entity","was_declared_in_moor":false,"columns":[{"name":"asset_id","getter_name":"assetId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES remote_asset_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES remote_asset_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"city","getter_name":"city","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"state","getter_name":"state","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"country","getter_name":"country","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"date_time_original","getter_name":"dateTimeOriginal","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"description","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"height","getter_name":"height","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"width","getter_name":"width","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"exposure_time","getter_name":"exposureTime","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"f_number","getter_name":"fNumber","moor_type":"double","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"file_size","getter_name":"fileSize","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"focal_length","getter_name":"focalLength","moor_type":"double","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"latitude","getter_name":"latitude","moor_type":"double","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"longitude","getter_name":"longitude","moor_type":"double","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"iso","getter_name":"iso","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"make","getter_name":"make","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"model","getter_name":"model","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"lens","getter_name":"lens","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"orientation","getter_name":"orientation","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"time_zone","getter_name":"timeZone","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rating","getter_name":"rating","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"projection_type","getter_name":"projectionType","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["asset_id"]}},{"id":16,"references":[1,4],"type":"table","data":{"name":"remote_album_asset_entity","was_declared_in_moor":false,"columns":[{"name":"asset_id","getter_name":"assetId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES remote_asset_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES remote_asset_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"album_id","getter_name":"albumId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES remote_album_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES remote_album_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["asset_id","album_id"]}},{"id":17,"references":[4,0],"type":"table","data":{"name":"remote_album_user_entity","was_declared_in_moor":false,"columns":[{"name":"album_id","getter_name":"albumId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES remote_album_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES remote_album_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"user_id","getter_name":"userId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES user_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES user_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"role","getter_name":"role","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter<AlbumUserRole>(AlbumUserRole.values)","dart_type_name":"AlbumUserRole"}}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["album_id","user_id"]}},{"id":18,"references":[0],"type":"table","data":{"name":"memory_entity","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"updated_at","getter_name":"updatedAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"deleted_at","getter_name":"deletedAt","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"owner_id","getter_name":"ownerId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES user_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES user_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"type","getter_name":"type","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter<MemoryTypeEnum>(MemoryTypeEnum.values)","dart_type_name":"MemoryTypeEnum"}},{"name":"data","getter_name":"data","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_saved","getter_name":"isSaved","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_saved\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_saved\" IN (0, 1))"},"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]},{"name":"memory_at","getter_name":"memoryAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"seen_at","getter_name":"seenAt","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"show_at","getter_name":"showAt","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"hide_at","getter_name":"hideAt","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["id"]}},{"id":19,"references":[1,18],"type":"table","data":{"name":"memory_asset_entity","was_declared_in_moor":false,"columns":[{"name":"asset_id","getter_name":"assetId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES remote_asset_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES remote_asset_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"memory_id","getter_name":"memoryId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES memory_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES memory_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["asset_id","memory_id"]}},{"id":20,"references":[0],"type":"table","data":{"name":"person_entity","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"updated_at","getter_name":"updatedAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"owner_id","getter_name":"ownerId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES user_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES user_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"face_asset_id","getter_name":"faceAssetId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_favorite","getter_name":"isFavorite","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_favorite\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_favorite\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_hidden","getter_name":"isHidden","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_hidden\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_hidden\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"color","getter_name":"color","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"birth_date","getter_name":"birthDate","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["id"]}},{"id":21,"references":[1,20],"type":"table","data":{"name":"asset_face_entity","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"asset_id","getter_name":"assetId","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"REFERENCES remote_asset_entity (id) ON DELETE CASCADE","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES remote_asset_entity (id) ON DELETE CASCADE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"person_id","getter_name":"personId","moor_type":"string","nullable":true,"customConstraints":null,"defaultConstraints":"REFERENCES person_entity (id) ON DELETE SET NULL","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES person_entity (id) ON DELETE SET NULL"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"image_width","getter_name":"imageWidth","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"image_height","getter_name":"imageHeight","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"bounding_box_x1","getter_name":"boundingBoxX1","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"bounding_box_y1","getter_name":"boundingBoxY1","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"bounding_box_x2","getter_name":"boundingBoxX2","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"bounding_box_y2","getter_name":"boundingBoxY2","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"source_type","getter_name":"sourceType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["id"]}},{"id":22,"references":[],"type":"table","data":{"name":"store_entity","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"string_value","getter_name":"stringValue","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"int_value","getter_name":"intValue","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["id"]}},{"id":23,"references":[],"type":"table","data":{"name":"trashed_local_asset_entity","was_declared_in_moor":false,"columns":[{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter<AssetType>(AssetType.values)","dart_type_name":"AssetType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"updated_at","getter_name":"updatedAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('CURRENT_TIMESTAMP')","default_client_dart":null,"dsl_features":[]},{"name":"width","getter_name":"width","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"height","getter_name":"height","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"duration_in_seconds","getter_name":"durationInSeconds","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"album_id","getter_name":"albumId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"checksum","getter_name":"checksum","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_favorite","getter_name":"isFavorite","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_favorite\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_favorite\" IN (0, 1))"},"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]},{"name":"orientation","getter_name":"orientation","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":true,"constraints":[],"strict":true,"explicit_pk":["id","album_id"]}},{"id":24,"references":[15],"type":"index","data":{"on":15,"name":"idx_lat_lng","sql":"CREATE INDEX IF NOT EXISTS idx_lat_lng ON remote_exif_entity (latitude, longitude)","unique":false,"columns":[]}},{"id":25,"references":[23],"type":"index","data":{"on":23,"name":"idx_trashed_local_asset_checksum","sql":"CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_checksum ON trashed_local_asset_entity (checksum)","unique":false,"columns":[]}},{"id":26,"references":[23],"type":"index","data":{"on":23,"name":"idx_trashed_local_asset_album","sql":"CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_album ON trashed_local_asset_entity (album_id)","unique":false,"columns":[]}}]}\ No newline at end of filediff --git a/mobile/ios/Runner/Sync/Messages.g.swift b/mobile/ios/Runner/Sync/Messages.g.swiftindex 6bcafb9215..bbe18e7375 100644--- a/mobile/ios/Runner/Sync/Messages.g.swift+++ b/mobile/ios/Runner/Sync/Messages.g.swift@@ -364,6 +364,7 @@ protocol NativeSyncApi {func getAssetsForAlbum(albumId: String, updatedTimeCond: Int64?) throws -> [PlatformAsset]func hashAssets(assetIds: [String], allowNetworkAccess: Bool, completion: @escaping (Result<[HashResult], Error>) -> Void)func cancelHashing() throws+ func getTrashedAssets() throws -> [String: [PlatformAsset]]}/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.@@ -532,5 +533,20 @@ class NativeSyncApiSetup {} else {cancelHashingChannel.setMessageHandler(nil)}+ let getTrashedAssetsChannel = taskQueue == nil+ ? FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getTrashedAssets\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)+ : FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getTrashedAssets\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec, taskQueue: taskQueue)+ if let api = api {+ getTrashedAssetsChannel.setMessageHandler { _, reply in+ do {+ let result = try api.getTrashedAssets()+ reply(wrapResult(result))+ } catch {+ reply(wrapError(error))+ }+ }+ } else {+ getTrashedAssetsChannel.setMessageHandler(nil)+ }}}diff --git a/mobile/ios/Runner/Sync/MessagesImpl.swift b/mobile/ios/Runner/Sync/MessagesImpl.swiftindex 75981fb7ea..03493f57ca 100644--- a/mobile/ios/Runner/Sync/MessagesImpl.swift+++ b/mobile/ios/Runner/Sync/MessagesImpl.swift@@ -3,15 +3,15 @@ import CryptoKitstruct AssetWrapper: Hashable, Equatable {let asset: PlatformAsset-+init(with asset: PlatformAsset) {self.asset = asset}-+func hash(into hasher: inout Hasher) {hasher.combine(self.asset.id)}-+static func == (lhs: AssetWrapper, rhs: AssetWrapper) -> Bool {return lhs.asset.id == rhs.asset.id}@@ -19,31 +19,31 @@ struct AssetWrapper: Hashable, Equatable {class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {static let name = "NativeSyncApi"-+static func register(with registrar: any FlutterPluginRegistrar) {let instance = NativeSyncApiImpl()NativeSyncApiSetup.setUp(binaryMessenger: registrar.messenger(), api: instance)registrar.publish(instance)}-+func detachFromEngine(for registrar: any FlutterPluginRegistrar) {super.detachFromEngine()}-+private let defaults: UserDefaultsprivate let changeTokenKey = "immich:changeToken"private let albumTypes: [PHAssetCollectionType] = [.album, .smartAlbum]private let recoveredAlbumSubType = 1000000219-+private var hashTask: Task<Void?, Error>?private static let hashCancelledCode = "HASH_CANCELLED"private static let hashCancelled = Result<[HashResult], Error>.failure(PigeonError(code: hashCancelledCode, message: "Hashing cancelled", details: nil))--++init(with defaults: UserDefaults = .standard) {self.defaults = defaults}-+@available(iOS 16, *)private func getChangeToken() -> PHPersistentChangeToken? {guard let data = defaults.data(forKey: changeTokenKey) else {@@ -51,7 +51,7 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {}return try? NSKeyedUnarchiver.unarchivedObject(ofClass: PHPersistentChangeToken.self, from: data)}-+@available(iOS 16, *)private func saveChangeToken(token: PHPersistentChangeToken) -> Void {guard let data = try? NSKeyedArchiver.archivedData(withRootObject: token, requiringSecureCoding: true) else {@@ -59,18 +59,18 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {}defaults.set(data, forKey: changeTokenKey)}-+func clearSyncCheckpoint() -> Void {defaults.removeObject(forKey: changeTokenKey)}-+func checkpointSync() {guard #available(iOS 16, *) else {return}saveChangeToken(token: PHPhotoLibrary.shared().currentChangeToken)}-+func shouldFullSync() -> Bool {guard #available(iOS 16, *),PHPhotoLibrary.authorizationStatus(for: .readWrite) == .authorized,@@ -78,36 +78,36 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {// When we do not have access to photo library, older iOS version or No token available, fallback to full syncreturn true}-+guard let _ = try? PHPhotoLibrary.shared().fetchPersistentChanges(since: storedToken) else {// Cannot fetch persistent changesreturn true}-+return false}-+func getAlbums() throws -> [PlatformAlbum] {var albums: [PlatformAlbum] = []-+albumTypes.forEach { type inlet collections = PHAssetCollection.fetchAssetCollections(with: type, subtype: .any, options: nil)for i in 0..<collections.count {let album = collections.object(at: i)-+// Ignore recovered albumif(album.assetCollectionSubtype.rawValue == self.recoveredAlbumSubType) {continue;}-+let options = PHFetchOptions()options.sortDescriptors = [NSSortDescriptor(key: "modificationDate", ascending: false)]options.includeHiddenAssets = false-+let assets = getAssetsFromAlbum(in: album, options: options)-+let isCloud = album.assetCollectionSubtype == .albumCloudShared || album.assetCollectionSubtype == .albumMyPhotoStream-+var domainAlbum = PlatformAlbum(id: album.localIdentifier,name: album.localizedTitle!,@@ -115,57 +115,57 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {isCloud: isCloud,assetCount: Int64(assets.count))-+if let firstAsset = assets.firstObject {domainAlbum.updatedAt = firstAsset.modificationDate.map { Int64($0.timeIntervalSince1970) }}-+albums.append(domainAlbum)}}return albums.sorted { $0.id < $1.id }}-+func getMediaChanges() throws -> SyncDelta {guard #available(iOS 16, *) else {throw PigeonError(code: "UNSUPPORTED_OS", message: "This feature requires iOS 16 or later.", details: nil)}-+guard PHPhotoLibrary.authorizationStatus(for: .readWrite) == .authorized else {throw PigeonError(code: "NO_AUTH", message: "No photo library access", details: nil)}-+guard let storedToken = getChangeToken() else {// No token exists, definitely need a full syncprint("MediaManager::getMediaChanges: No token found")throw PigeonError(code: "NO_TOKEN", message: "No stored change token", details: nil)}-+let currentToken = PHPhotoLibrary.shared().currentChangeTokenif storedToken == currentToken {return SyncDelta(hasChanges: false, updates: [], deletes: [], assetAlbums: [:])}-+do {let changes = try PHPhotoLibrary.shared().fetchPersistentChanges(since: storedToken)-+var updatedAssets: Set<AssetWrapper> = []var deletedAssets: Set<String> = []-+for change in changes {guard let details = try? change.changeDetails(for: PHObjectType.asset) else { continue }-+let updated = details.updatedLocalIdentifiers.union(details.insertedLocalIdentifiers)deletedAssets.formUnion(details.deletedLocalIdentifiers)-+if (updated.isEmpty) { continue }-+let options = PHFetchOptions()options.includeHiddenAssets = falselet result = PHAsset.fetchAssets(withLocalIdentifiers: Array(updated), options: options)for i in 0..<result.count {let asset = result.object(at: i)-+// Asset wrapper only uses the id for comparison. Multiple change can contain the same asset, skip duplicate changeslet predicate = PlatformAsset(id: asset.localIdentifier,@@ -178,25 +178,25 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {if (updatedAssets.contains(AssetWrapper(with: predicate))) {continue}-+let domainAsset = AssetWrapper(with: asset.toPlatformAsset())updatedAssets.insert(domainAsset)}}-+let updates = Array(updatedAssets.map { $0.asset })return SyncDelta(hasChanges: true, updates: updates, deletes: Array(deletedAssets), assetAlbums: buildAssetAlbumsMap(assets: updates))}}--++private func buildAssetAlbumsMap(assets: Array<PlatformAsset>) -> [String: [String]] {guard !assets.isEmpty else {return [:]}-+var albumAssets: [String: [String]] = [:]-+for type in albumTypes {let collections = PHAssetCollection.fetchAssetCollections(with: type, subtype: .any, options: nil)collections.enumerateObjects { (album, _, _) in@@ -211,13 +211,13 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {}return albumAssets}-+func getAssetIdsForAlbum(albumId: String) throws -> [String] {let collections = PHAssetCollection.fetchAssetCollections(withLocalIdentifiers: [albumId], options: nil)guard let album = collections.firstObject else {return []}-+var ids: [String] = []let options = PHFetchOptions()options.includeHiddenAssets = false@@ -227,13 +227,13 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {}return ids}-+func getAssetsCountSince(albumId: String, timestamp: Int64) throws -> Int64 {let collections = PHAssetCollection.fetchAssetCollections(withLocalIdentifiers: [albumId], options: nil)guard let album = collections.firstObject else {return 0}-+let date = NSDate(timeIntervalSince1970: TimeInterval(timestamp))let options = PHFetchOptions()options.predicate = NSPredicate(format: "creationDate > %@ OR modificationDate > %@", date, date)@@ -241,32 +241,32 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {let assets = getAssetsFromAlbum(in: album, options: options)return Int64(assets.count)}-+func getAssetsForAlbum(albumId: String, updatedTimeCond: Int64?) throws -> [PlatformAsset] {let collections = PHAssetCollection.fetchAssetCollections(withLocalIdentifiers: [albumId], options: nil)guard let album = collections.firstObject else {return []}-+let options = PHFetchOptions()options.includeHiddenAssets = falseif(updatedTimeCond != nil) {let date = NSDate(timeIntervalSince1970: TimeInterval(updatedTimeCond!))options.predicate = NSPredicate(format: "creationDate > %@ OR modificationDate > %@", date, date)}-+let result = getAssetsFromAlbum(in: album, options: options)if(result.count == 0) {return []}-+var assets: [PlatformAsset] = []result.enumerateObjects { (asset, _, _) inassets.append(asset.toPlatformAsset())}return assets}-+func hashAssets(assetIds: [String], allowNetworkAccess: Bool, completion: @escaping (Result<[HashResult], Error>) -> Void) {if let prevTask = hashTask {prevTask.cancel()@@ -284,11 +284,11 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {missingAssetIds.remove(asset.localIdentifier)assets.append(asset)}-+if Task.isCancelled {return self?.completeWhenActive(for: completion, with: Self.hashCancelled)}-+await withTaskGroup(of: HashResult?.self) { taskGroup invar results = [HashResult]()results.reserveCapacity(assets.count)@@ -301,28 +301,28 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {return await self.hashAsset(asset, allowNetworkAccess: allowNetworkAccess)}}-+for await result in taskGroup {guard let result = result else {return self?.completeWhenActive(for: completion, with: Self.hashCancelled)}results.append(result)}-+for missing in missingAssetIds {results.append(HashResult(assetId: missing, error: "Asset not found in library", hash: nil))}-+return self?.completeWhenActive(for: completion, with: .success(results))}}}-+func cancelHashing() {hashTask?.cancel()hashTask = nil}-+private func hashAsset(_ asset: PHAsset, allowNetworkAccess: Bool) async -> HashResult? {class RequestRef {var id: PHAssetResourceDataRequestID?@@ -332,21 +332,21 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {if Task.isCancelled {return nil}-+guard let resource = asset.getResource() else {return HashResult(assetId: asset.localIdentifier, error: "Cannot get asset resource", hash: nil)}-+if Task.isCancelled {return nil}-+let options = PHAssetResourceRequestOptions()options.isNetworkAccessAllowed = allowNetworkAccess-+return await withCheckedContinuation { continuation invar hasher = Insecure.SHA1()-+requestRef.id = PHAssetResourceManager.default().requestData(for: resource,options: options,@@ -377,7 +377,11 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {PHAssetResourceManager.default().cancelDataRequest(requestId)})}-++ func getTrashedAssets() throws -> [String: [PlatformAsset]] {+ throw PigeonError(code: "UNSUPPORTED_OS", message: "This feature not supported on iOS.", details: nil)+ }+private func getAssetsFromAlbum(in album: PHAssetCollection, options: PHFetchOptions) -> PHFetchResult<PHAsset> {// Ensure to actually getting all assets for the Recents albumif (album.assetCollectionSubtype == .smartAlbumUserLibrary) {diff --git a/mobile/lib/constants/constants.dart b/mobile/lib/constants/constants.dartindex 03acd6a548..8d4636bbe1 100644--- a/mobile/lib/constants/constants.dart+++ b/mobile/lib/constants/constants.dart@@ -58,3 +58,6 @@ const int kPhotoTabIndex = 0;const int kSearchTabIndex = 1;const int kAlbumTabIndex = 2;const int kLibraryTabIndex = 3;++// Workaround for SQLite's variable limit (SQLITE_MAX_VARIABLE_NUMBER = 32766)+const int kDriftMaxChunk = 32000;diff --git a/mobile/lib/domain/services/hash.service.dart b/mobile/lib/domain/services/hash.service.dartindex 90f29b8bc1..5e81643fc5 100644--- a/mobile/lib/domain/services/hash.service.dart+++ b/mobile/lib/domain/services/hash.service.dart@@ -2,8 +2,10 @@ import 'package:flutter/services.dart';import 'package:immich_mobile/constants/constants.dart';import 'package:immich_mobile/domain/models/album/local_album.model.dart';import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';+import 'package:immich_mobile/extensions/platform_extensions.dart';import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';import 'package:immich_mobile/infrastructure/repositories/local_asset.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/trashed_local_asset.repository.dart';import 'package:immich_mobile/platform/native_sync_api.g.dart';import 'package:logging/logging.dart';@@ -13,6 +15,7 @@ class HashService {final int _batchSize;final DriftLocalAlbumRepository _localAlbumRepository;final DriftLocalAssetRepository _localAssetRepository;+ final DriftTrashedLocalAssetRepository _trashedLocalAssetRepository;final NativeSyncApi _nativeSyncApi;final bool Function()? _cancelChecker;final _log = Logger('HashService');@@ -20,11 +23,13 @@ class HashService {HashService({required DriftLocalAlbumRepository localAlbumRepository,required DriftLocalAssetRepository localAssetRepository,+ required DriftTrashedLocalAssetRepository trashedLocalAssetRepository,required NativeSyncApi nativeSyncApi,bool Function()? cancelChecker,int? batchSize,}) : _localAlbumRepository = localAlbumRepository,_localAssetRepository = localAssetRepository,+ _trashedLocalAssetRepository = trashedLocalAssetRepository,_cancelChecker = cancelChecker,_nativeSyncApi = nativeSyncApi,_batchSize = batchSize ?? kBatchHashFileLimit;@@ -49,6 +54,14 @@ class HashService {await _hashAssets(album, assetsToHash);}}+ if (CurrentPlatform.isAndroid && localAlbums.isNotEmpty) {+ final backupAlbumIds = localAlbums.map((e) => e.id);+ final trashedToHash = await _trashedLocalAssetRepository.getAssetsToHash(backupAlbumIds);+ if (trashedToHash.isNotEmpty) {+ final pseudoAlbum = LocalAlbum(id: '-pseudoAlbum', name: 'Trash', updatedAt: DateTime.now());+ await _hashAssets(pseudoAlbum, trashedToHash, isTrashed: true);+ }+ }} on PlatformException catch (e) {if (e.code == _kHashCancelledCode) {_log.warning("Hashing cancelled by platform");@@ -65,7 +78,7 @@ class HashService {/// Processes a list of [LocalAsset]s, storing their hash and updating the assets in the DB/// with hash for those that were successfully hashed. Hashes are looked up in a table/// [LocalAssetHashEntity] by local id. Only missing entries are newly hashed and added to the DB.- Future<void> _hashAssets(LocalAlbum album, List<LocalAsset> assetsToHash) async {+ Future<void> _hashAssets(LocalAlbum album, List<LocalAsset> assetsToHash, {bool isTrashed = false}) async {final toHash = <String, LocalAsset>{};for (final asset in assetsToHash) {@@ -76,16 +89,16 @@ class HashService {toHash[asset.id] = asset;if (toHash.length == _batchSize) {- await _processBatch(album, toHash);+ await _processBatch(album, toHash, isTrashed);toHash.clear();}}- await _processBatch(album, toHash);+ await _processBatch(album, toHash, isTrashed);}/// Processes a batch of assets.- Future<void> _processBatch(LocalAlbum album, Map<String, LocalAsset> toHash) async {+ Future<void> _processBatch(LocalAlbum album, Map<String, LocalAsset> toHash, bool isTrashed) async {if (toHash.isEmpty) {return;}@@ -120,7 +133,10 @@ class HashService {}_log.fine("Hashed ${hashed.length}/${toHash.length} assets");-- await _localAssetRepository.updateHashes(hashed);+ if (isTrashed) {+ await _trashedLocalAssetRepository.updateHashes(hashed);+ } else {+ await _localAssetRepository.updateHashes(hashed);+ }}}diff --git a/mobile/lib/domain/services/local_sync.service.dart b/mobile/lib/domain/services/local_sync.service.dartindex 94a8a19e73..5cbae9c5a1 100644--- a/mobile/lib/domain/services/local_sync.service.dart+++ b/mobile/lib/domain/services/local_sync.service.dart@@ -4,9 +4,14 @@ import 'package:collection/collection.dart';import 'package:flutter/foundation.dart';import 'package:immich_mobile/domain/models/album/local_album.model.dart';import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';+import 'package:immich_mobile/domain/models/store.model.dart';+import 'package:immich_mobile/entities/store.entity.dart';import 'package:immich_mobile/extensions/platform_extensions.dart';import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/storage.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/trashed_local_asset.repository.dart';import 'package:immich_mobile/platform/native_sync_api.g.dart';+import 'package:immich_mobile/repositories/local_files_manager.repository.dart';import 'package:immich_mobile/utils/datetime_helpers.dart';import 'package:immich_mobile/utils/diff.dart';import 'package:logging/logging.dart';@@ -14,15 +19,34 @@ import 'package:logging/logging.dart';class LocalSyncService {final DriftLocalAlbumRepository _localAlbumRepository;final NativeSyncApi _nativeSyncApi;+ final DriftTrashedLocalAssetRepository _trashedLocalAssetRepository;+ final LocalFilesManagerRepository _localFilesManager;+ final StorageRepository _storageRepository;final Logger _log = Logger("DeviceSyncService");- LocalSyncService({required DriftLocalAlbumRepository localAlbumRepository, required NativeSyncApi nativeSyncApi})- : _localAlbumRepository = localAlbumRepository,- _nativeSyncApi = nativeSyncApi;+ LocalSyncService({+ required DriftLocalAlbumRepository localAlbumRepository,+ required DriftTrashedLocalAssetRepository trashedLocalAssetRepository,+ required LocalFilesManagerRepository localFilesManager,+ required StorageRepository storageRepository,+ required NativeSyncApi nativeSyncApi,+ }) : _localAlbumRepository = localAlbumRepository,+ _trashedLocalAssetRepository = trashedLocalAssetRepository,+ _localFilesManager = localFilesManager,+ _storageRepository = storageRepository,+ _nativeSyncApi = nativeSyncApi;Future<void> sync({bool full = false}) async {final Stopwatch stopwatch = Stopwatch()..start();try {+ if (CurrentPlatform.isAndroid && Store.get(StoreKey.manageLocalMediaAndroid, false)) {+ final hasPermission = await _localFilesManager.hasManageMediaPermission();+ if (hasPermission) {+ await _syncTrashedAssets();+ } else {+ _log.warning("syncTrashedAssets cannot proceed because MANAGE_MEDIA permission is missing");+ }+ }if (full || await _nativeSyncApi.shouldFullSync()) {_log.fine("Full sync request from ${full ? "user" : "native"}");return await fullSync();@@ -69,7 +93,6 @@ class LocalSyncService {await updateAlbum(dbAlbum, album);}}-await _nativeSyncApi.checkpointSync();} catch (e, s) {_log.severe("Error performing device sync", e, s);@@ -273,6 +296,48 @@ class LocalSyncService {bool _albumsEqual(LocalAlbum a, LocalAlbum b) {return a.name == b.name && a.assetCount == b.assetCount && a.updatedAt.isAtSameMomentAs(b.updatedAt);}++ Future<void> _syncTrashedAssets() async {+ final trashedAssetMap = await _nativeSyncApi.getTrashedAssets();+ await processTrashedAssets(trashedAssetMap);+ }++ @visibleForTesting+ Future<void> processTrashedAssets(Map<String, List<PlatformAsset>> trashedAssetMap) async {+ if (trashedAssetMap.isEmpty) {+ _log.info("syncTrashedAssets, No trashed assets found");+ }+ final trashedAssets = trashedAssetMap.cast<String, List<Object?>>().entries.expand(+ (entry) => entry.value.cast<PlatformAsset>().toTrashedAssets(entry.key),+ );++ _log.fine("syncTrashedAssets, trashedAssets: ${trashedAssets.map((e) => e.asset.id)}");+ await _trashedLocalAssetRepository.processTrashSnapshot(trashedAssets);++ final assetsToRestore = await _trashedLocalAssetRepository.getToRestore();+ if (assetsToRestore.isNotEmpty) {+ final restoredIds = await _localFilesManager.restoreAssetsFromTrash(assetsToRestore);+ await _trashedLocalAssetRepository.applyRestoredAssets(restoredIds);+ } else {+ _log.info("syncTrashedAssets, No remote assets found for restoration");+ }++ final localAssetsToTrash = await _trashedLocalAssetRepository.getToTrash();+ if (localAssetsToTrash.isNotEmpty) {+ final mediaUrls = await Future.wait(+ localAssetsToTrash.values+ .expand((e) => e)+ .map((localAsset) => _storageRepository.getAssetEntityForAsset(localAsset).then((e) => e?.getMediaUrl())),+ );+ _log.info("Moving to trash ${mediaUrls.join(", ")} assets");+ final result = await _localFilesManager.moveToTrash(mediaUrls.nonNulls.toList());+ if (result) {+ await _trashedLocalAssetRepository.trashLocalAsset(localAssetsToTrash);+ }+ } else {+ _log.info("syncTrashedAssets, No assets found in backup-enabled albums for move to trash");+ }+ }}extension on Iterable<PlatformAlbum> {@@ -290,20 +355,26 @@ extension on Iterable<PlatformAlbum> {extension on Iterable<PlatformAsset> {List<LocalAsset> toLocalAssets() {- return map(- (e) => LocalAsset(- id: e.id,- name: e.name,- checksum: null,- type: AssetType.values.elementAtOrNull(e.type) ?? AssetType.other,- createdAt: tryFromSecondsSinceEpoch(e.createdAt, isUtc: true) ?? DateTime.timestamp(),- updatedAt: tryFromSecondsSinceEpoch(e.updatedAt, isUtc: true) ?? DateTime.timestamp(),- width: e.width,- height: e.height,- durationInSeconds: e.durationInSeconds,- orientation: e.orientation,- isFavorite: e.isFavorite,- ),- ).toList();+ return map((e) => e.toLocalAsset()).toList();+ }++ Iterable<TrashedAsset> toTrashedAssets(String albumId) {+ return map((e) => (albumId: albumId, asset: e.toLocalAsset()));}}++extension on PlatformAsset {+ LocalAsset toLocalAsset() => LocalAsset(+ id: id,+ name: name,+ checksum: null,+ type: AssetType.values.elementAtOrNull(type) ?? AssetType.other,+ createdAt: tryFromSecondsSinceEpoch(createdAt, isUtc: true) ?? DateTime.timestamp(),+ updatedAt: tryFromSecondsSinceEpoch(createdAt, isUtc: true) ?? DateTime.timestamp(),+ width: width,+ height: height,+ durationInSeconds: durationInSeconds,+ isFavorite: isFavorite,+ orientation: orientation,+ );+}diff --git a/mobile/lib/domain/services/sync_stream.service.dart b/mobile/lib/domain/services/sync_stream.service.dartindex 9af541e3a4..2ff0f18fcf 100644--- a/mobile/lib/domain/services/sync_stream.service.dart+++ b/mobile/lib/domain/services/sync_stream.service.dart@@ -1,8 +1,15 @@import 'dart:async';+import 'package:immich_mobile/domain/models/store.model.dart';import 'package:immich_mobile/domain/models/sync_event.model.dart';+import 'package:immich_mobile/entities/store.entity.dart';+import 'package:immich_mobile/extensions/platform_extensions.dart';+import 'package:immich_mobile/infrastructure/repositories/local_asset.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/storage.repository.dart';import 'package:immich_mobile/infrastructure/repositories/sync_api.repository.dart';import 'package:immich_mobile/infrastructure/repositories/sync_stream.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/trashed_local_asset.repository.dart';+import 'package:immich_mobile/repositories/local_files_manager.repository.dart';import 'package:logging/logging.dart';import 'package:openapi/api.dart';@@ -11,14 +18,26 @@ class SyncStreamService {final SyncApiRepository _syncApiRepository;final SyncStreamRepository _syncStreamRepository;+ final DriftLocalAssetRepository _localAssetRepository;+ final DriftTrashedLocalAssetRepository _trashedLocalAssetRepository;+ final LocalFilesManagerRepository _localFilesManager;+ final StorageRepository _storageRepository;final bool Function()? _cancelChecker;SyncStreamService({required SyncApiRepository syncApiRepository,required SyncStreamRepository syncStreamRepository,+ required DriftLocalAssetRepository localAssetRepository,+ required DriftTrashedLocalAssetRepository trashedLocalAssetRepository,+ required LocalFilesManagerRepository localFilesManager,+ required StorageRepository storageRepository,bool Function()? cancelChecker,}) : _syncApiRepository = syncApiRepository,_syncStreamRepository = syncStreamRepository,+ _localAssetRepository = localAssetRepository,+ _trashedLocalAssetRepository = trashedLocalAssetRepository,+ _localFilesManager = localFilesManager,+ _storageRepository = storageRepository,_cancelChecker = cancelChecker;bool get isCancelled => _cancelChecker?.call() ?? false;@@ -83,7 +102,18 @@ class SyncStreamService {case SyncEntityType.partnerDeleteV1:return _syncStreamRepository.deletePartnerV1(data.cast());case SyncEntityType.assetV1:- return _syncStreamRepository.updateAssetsV1(data.cast());+ final remoteSyncAssets = data.cast<SyncAssetV1>();+ await _syncStreamRepository.updateAssetsV1(remoteSyncAssets);+ if (CurrentPlatform.isAndroid && Store.get(StoreKey.manageLocalMediaAndroid, false)) {+ final hasPermission = await _localFilesManager.hasManageMediaPermission();+ if (hasPermission) {+ await _handleRemoteTrashed(remoteSyncAssets.where((e) => e.deletedAt != null).map((e) => e.checksum));+ await _applyRemoteRestoreToLocal();+ } else {+ _logger.warning("sync Trashed Assets cannot proceed because MANAGE_MEDIA permission is missing");+ }+ }+ return;case SyncEntityType.assetDeleteV1:return _syncStreamRepository.deleteAssetsV1(data.cast());case SyncEntityType.assetExifV1:@@ -212,4 +242,36 @@ class SyncStreamService {_logger.severe("Error processing AssetUploadReadyV1 websocket batch events", error, stackTrace);}}++ Future<void> _handleRemoteTrashed(Iterable<String> checksums) async {+ if (checksums.isEmpty) {+ return Future.value();+ } else {+ final localAssetsToTrash = await _localAssetRepository.getAssetsFromBackupAlbums(checksums);+ if (localAssetsToTrash.isNotEmpty) {+ final mediaUrls = await Future.wait(+ localAssetsToTrash.values+ .expand((e) => e)+ .map((localAsset) => _storageRepository.getAssetEntityForAsset(localAsset).then((e) => e?.getMediaUrl())),+ );+ _logger.info("Moving to trash ${mediaUrls.join(", ")} assets");+ final result = await _localFilesManager.moveToTrash(mediaUrls.nonNulls.toList());+ if (result) {+ await _trashedLocalAssetRepository.trashLocalAsset(localAssetsToTrash);+ }+ } else {+ _logger.info("No assets found in backup-enabled albums for assets: $checksums");+ }+ }+ }++ Future<void> _applyRemoteRestoreToLocal() async {+ final assetsToRestore = await _trashedLocalAssetRepository.getToRestore();+ if (assetsToRestore.isNotEmpty) {+ final restoredIds = await _localFilesManager.restoreAssetsFromTrash(assetsToRestore);+ await _trashedLocalAssetRepository.applyRestoredAssets(restoredIds);+ } else {+ _logger.info("No remote assets found for restoration");+ }+ }}diff --git a/mobile/lib/infrastructure/entities/trashed_local_asset.entity.dart b/mobile/lib/infrastructure/entities/trashed_local_asset.entity.dartnew file mode 100644index 0000000000..308130b9ea--- /dev/null+++ b/mobile/lib/infrastructure/entities/trashed_local_asset.entity.dart@@ -0,0 +1,40 @@+import 'package:drift/drift.dart';+import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';+import 'package:immich_mobile/infrastructure/entities/trashed_local_asset.entity.drift.dart';+import 'package:immich_mobile/infrastructure/utils/asset.mixin.dart';+import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';+[email protected]('CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_checksum ON trashed_local_asset_entity (checksum)')[email protected]('CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_album ON trashed_local_asset_entity (album_id)')+class TrashedLocalAssetEntity extends Table with DriftDefaultsMixin, AssetEntityMixin {+ const TrashedLocalAssetEntity();++ TextColumn get id => text()();++ TextColumn get albumId => text()();++ TextColumn get checksum => text().nullable()();++ BoolColumn get isFavorite => boolean().withDefault(const Constant(false))();++ IntColumn get orientation => integer().withDefault(const Constant(0))();++ @override+ Set<Column> get primaryKey => {id, albumId};+}++extension TrashedLocalAssetEntityDataDomainExtension on TrashedLocalAssetEntityData {+ LocalAsset toLocalAsset() => LocalAsset(+ id: id,+ name: name,+ checksum: checksum,+ type: type,+ createdAt: createdAt,+ updatedAt: updatedAt,+ durationInSeconds: durationInSeconds,+ isFavorite: isFavorite,+ height: height,+ width: width,+ orientation: orientation,+ );+}diff --git a/mobile/lib/infrastructure/entities/trashed_local_asset.entity.drift.dart b/mobile/lib/infrastructure/entities/trashed_local_asset.entity.drift.dartnew file mode 100644index 0000000000..aab226c3a2--- /dev/null+++ b/mobile/lib/infrastructure/entities/trashed_local_asset.entity.drift.dart@@ -0,0 +1,1080 @@+// dart format width=80+// ignore_for_file: type=lint+import 'package:drift/drift.dart' as i0;+import 'package:immich_mobile/infrastructure/entities/trashed_local_asset.entity.drift.dart'+ as i1;+import 'package:immich_mobile/domain/models/asset/base_asset.model.dart' as i2;+import 'package:immich_mobile/infrastructure/entities/trashed_local_asset.entity.dart'+ as i3;+import 'package:drift/src/runtime/query_builder/query_builder.dart' as i4;++typedef $$TrashedLocalAssetEntityTableCreateCompanionBuilder =+ i1.TrashedLocalAssetEntityCompanion Function({+ required String name,+ required i2.AssetType type,+ i0.Value<DateTime> createdAt,+ i0.Value<DateTime> updatedAt,+ i0.Value<int?> width,+ i0.Value<int?> height,+ i0.Value<int?> durationInSeconds,+ required String id,+ required String albumId,+ i0.Value<String?> checksum,+ i0.Value<bool> isFavorite,+ i0.Value<int> orientation,+ });+typedef $$TrashedLocalAssetEntityTableUpdateCompanionBuilder =+ i1.TrashedLocalAssetEntityCompanion Function({+ i0.Value<String> name,+ i0.Value<i2.AssetType> type,+ i0.Value<DateTime> createdAt,+ i0.Value<DateTime> updatedAt,+ i0.Value<int?> width,+ i0.Value<int?> height,+ i0.Value<int?> durationInSeconds,+ i0.Value<String> id,+ i0.Value<String> albumId,+ i0.Value<String?> checksum,+ i0.Value<bool> isFavorite,+ i0.Value<int> orientation,+ });++class $$TrashedLocalAssetEntityTableFilterComposer+ extends+ i0.Composer<i0.GeneratedDatabase, i1.$TrashedLocalAssetEntityTable> {+ $$TrashedLocalAssetEntityTableFilterComposer({+ required super.$db,+ required super.$table,+ super.joinBuilder,+ super.$addJoinBuilderToRootComposer,+ super.$removeJoinBuilderFromRootComposer,+ });+ i0.ColumnFilters<String> get name => $composableBuilder(+ column: $table.name,+ builder: (column) => i0.ColumnFilters(column),+ );++ i0.ColumnWithTypeConverterFilters<i2.AssetType, i2.AssetType, int> get type =>+ $composableBuilder(+ column: $table.type,+ builder: (column) => i0.ColumnWithTypeConverterFilters(column),+ );++ i0.ColumnFilters<DateTime> get createdAt => $composableBuilder(+ column: $table.createdAt,+ builder: (column) => i0.ColumnFilters(column),+ );++ i0.ColumnFilters<DateTime> get updatedAt => $composableBuilder(+ column: $table.updatedAt,+ builder: (column) => i0.ColumnFilters(column),+ );++ i0.ColumnFilters<int> get width => $composableBuilder(+ column: $table.width,+ builder: (column) => i0.ColumnFilters(column),+ );++ i0.ColumnFilters<int> get height => $composableBuilder(+ column: $table.height,+ builder: (column) => i0.ColumnFilters(column),+ );++ i0.ColumnFilters<int> get durationInSeconds => $composableBuilder(+ column: $table.durationInSeconds,+ builder: (column) => i0.ColumnFilters(column),+ );++ i0.ColumnFilters<String> get id => $composableBuilder(+ column: $table.id,+ builder: (column) => i0.ColumnFilters(column),+ );++ i0.ColumnFilters<String> get albumId => $composableBuilder(+ column: $table.albumId,+ builder: (column) => i0.ColumnFilters(column),+ );++ i0.ColumnFilters<String> get checksum => $composableBuilder(+ column: $table.checksum,+ builder: (column) => i0.ColumnFilters(column),+ );++ i0.ColumnFilters<bool> get isFavorite => $composableBuilder(+ column: $table.isFavorite,+ builder: (column) => i0.ColumnFilters(column),+ );++ i0.ColumnFilters<int> get orientation => $composableBuilder(+ column: $table.orientation,+ builder: (column) => i0.ColumnFilters(column),+ );+}++class $$TrashedLocalAssetEntityTableOrderingComposer+ extends+ i0.Composer<i0.GeneratedDatabase, i1.$TrashedLocalAssetEntityTable> {+ $$TrashedLocalAssetEntityTableOrderingComposer({+ required super.$db,+ required super.$table,+ super.joinBuilder,+ super.$addJoinBuilderToRootComposer,+ super.$removeJoinBuilderFromRootComposer,+ });+ i0.ColumnOrderings<String> get name => $composableBuilder(+ column: $table.name,+ builder: (column) => i0.ColumnOrderings(column),+ );++ i0.ColumnOrderings<int> get type => $composableBuilder(+ column: $table.type,+ builder: (column) => i0.ColumnOrderings(column),+ );++ i0.ColumnOrderings<DateTime> get createdAt => $composableBuilder(+ column: $table.createdAt,+ builder: (column) => i0.ColumnOrderings(column),+ );++ i0.ColumnOrderings<DateTime> get updatedAt => $composableBuilder(+ column: $table.updatedAt,+ builder: (column) => i0.ColumnOrderings(column),+ );++ i0.ColumnOrderings<int> get width => $composableBuilder(+ column: $table.width,+ builder: (column) => i0.ColumnOrderings(column),+ );++ i0.ColumnOrderings<int> get height => $composableBuilder(+ column: $table.height,+ builder: (column) => i0.ColumnOrderings(column),+ );++ i0.ColumnOrderings<int> get durationInSeconds => $composableBuilder(+ column: $table.durationInSeconds,+ builder: (column) => i0.ColumnOrderings(column),+ );++ i0.ColumnOrderings<String> get id => $composableBuilder(+ column: $table.id,+ builder: (column) => i0.ColumnOrderings(column),+ );++ i0.ColumnOrderings<String> get albumId => $composableBuilder(+ column: $table.albumId,+ builder: (column) => i0.ColumnOrderings(column),+ );++ i0.ColumnOrderings<String> get checksum => $composableBuilder(+ column: $table.checksum,+ builder: (column) => i0.ColumnOrderings(column),+ );++ i0.ColumnOrderings<bool> get isFavorite => $composableBuilder(+ column: $table.isFavorite,+ builder: (column) => i0.ColumnOrderings(column),+ );++ i0.ColumnOrderings<int> get orientation => $composableBuilder(+ column: $table.orientation,+ builder: (column) => i0.ColumnOrderings(column),+ );+}++class $$TrashedLocalAssetEntityTableAnnotationComposer+ extends+ i0.Composer<i0.GeneratedDatabase, i1.$TrashedLocalAssetEntityTable> {+ $$TrashedLocalAssetEntityTableAnnotationComposer({+ required super.$db,+ required super.$table,+ super.joinBuilder,+ super.$addJoinBuilderToRootComposer,+ super.$removeJoinBuilderFromRootComposer,+ });+ i0.GeneratedColumn<String> get name =>+ $composableBuilder(column: $table.name, builder: (column) => column);++ i0.GeneratedColumnWithTypeConverter<i2.AssetType, int> get type =>+ $composableBuilder(column: $table.type, builder: (column) => column);++ i0.GeneratedColumn<DateTime> get createdAt =>+ $composableBuilder(column: $table.createdAt, builder: (column) => column);++ i0.GeneratedColumn<DateTime> get updatedAt =>+ $composableBuilder(column: $table.updatedAt, builder: (column) => column);++ i0.GeneratedColumn<int> get width =>+ $composableBuilder(column: $table.width, builder: (column) => column);++ i0.GeneratedColumn<int> get height =>+ $composableBuilder(column: $table.height, builder: (column) => column);++ i0.GeneratedColumn<int> get durationInSeconds => $composableBuilder(+ column: $table.durationInSeconds,+ builder: (column) => column,+ );++ i0.GeneratedColumn<String> get id =>+ $composableBuilder(column: $table.id, builder: (column) => column);++ i0.GeneratedColumn<String> get albumId =>+ $composableBuilder(column: $table.albumId, builder: (column) => column);++ i0.GeneratedColumn<String> get checksum =>+ $composableBuilder(column: $table.checksum, builder: (column) => column);++ i0.GeneratedColumn<bool> get isFavorite => $composableBuilder(+ column: $table.isFavorite,+ builder: (column) => column,+ );++ i0.GeneratedColumn<int> get orientation => $composableBuilder(+ column: $table.orientation,+ builder: (column) => column,+ );+}++class $$TrashedLocalAssetEntityTableTableManager+ extends+ i0.RootTableManager<+ i0.GeneratedDatabase,+ i1.$TrashedLocalAssetEntityTable,+ i1.TrashedLocalAssetEntityData,+ i1.$$TrashedLocalAssetEntityTableFilterComposer,+ i1.$$TrashedLocalAssetEntityTableOrderingComposer,+ i1.$$TrashedLocalAssetEntityTableAnnotationComposer,+ $$TrashedLocalAssetEntityTableCreateCompanionBuilder,+ $$TrashedLocalAssetEntityTableUpdateCompanionBuilder,+ (+ i1.TrashedLocalAssetEntityData,+ i0.BaseReferences<+ i0.GeneratedDatabase,+ i1.$TrashedLocalAssetEntityTable,+ i1.TrashedLocalAssetEntityData+ >,+ ),+ i1.TrashedLocalAssetEntityData,+ i0.PrefetchHooks Function()+ > {+ $$TrashedLocalAssetEntityTableTableManager(+ i0.GeneratedDatabase db,+ i1.$TrashedLocalAssetEntityTable table,+ ) : super(+ i0.TableManagerState(+ db: db,+ table: table,+ createFilteringComposer: () =>+ i1.$$TrashedLocalAssetEntityTableFilterComposer(+ $db: db,+ $table: table,+ ),+ createOrderingComposer: () =>+ i1.$$TrashedLocalAssetEntityTableOrderingComposer(+ $db: db,+ $table: table,+ ),+ createComputedFieldComposer: () =>+ i1.$$TrashedLocalAssetEntityTableAnnotationComposer(+ $db: db,+ $table: table,+ ),+ updateCompanionCallback:+ ({+ i0.Value<String> name = const i0.Value.absent(),+ i0.Value<i2.AssetType> type = const i0.Value.absent(),+ i0.Value<DateTime> createdAt = const i0.Value.absent(),+ i0.Value<DateTime> updatedAt = const i0.Value.absent(),+ i0.Value<int?> width = const i0.Value.absent(),+ i0.Value<int?> height = const i0.Value.absent(),+ i0.Value<int?> durationInSeconds = const i0.Value.absent(),+ i0.Value<String> id = const i0.Value.absent(),+ i0.Value<String> albumId = const i0.Value.absent(),+ i0.Value<String?> checksum = const i0.Value.absent(),+ i0.Value<bool> isFavorite = const i0.Value.absent(),+ i0.Value<int> orientation = const i0.Value.absent(),+ }) => i1.TrashedLocalAssetEntityCompanion(+ name: name,+ type: type,+ createdAt: createdAt,+ updatedAt: updatedAt,+ width: width,+ height: height,+ durationInSeconds: durationInSeconds,+ id: id,+ albumId: albumId,+ checksum: checksum,+ isFavorite: isFavorite,+ orientation: orientation,+ ),+ createCompanionCallback:+ ({+ required String name,+ required i2.AssetType type,+ i0.Value<DateTime> createdAt = const i0.Value.absent(),+ i0.Value<DateTime> updatedAt = const i0.Value.absent(),+ i0.Value<int?> width = const i0.Value.absent(),+ i0.Value<int?> height = const i0.Value.absent(),+ i0.Value<int?> durationInSeconds = const i0.Value.absent(),+ required String id,+ required String albumId,+ i0.Value<String?> checksum = const i0.Value.absent(),+ i0.Value<bool> isFavorite = const i0.Value.absent(),+ i0.Value<int> orientation = const i0.Value.absent(),+ }) => i1.TrashedLocalAssetEntityCompanion.insert(+ name: name,+ type: type,+ createdAt: createdAt,+ updatedAt: updatedAt,+ width: width,+ height: height,+ durationInSeconds: durationInSeconds,+ id: id,+ albumId: albumId,+ checksum: checksum,+ isFavorite: isFavorite,+ orientation: orientation,+ ),+ withReferenceMapper: (p0) => p0+ .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e)))+ .toList(),+ prefetchHooksCallback: null,+ ),+ );+}++typedef $$TrashedLocalAssetEntityTableProcessedTableManager =+ i0.ProcessedTableManager<+ i0.GeneratedDatabase,+ i1.$TrashedLocalAssetEntityTable,+ i1.TrashedLocalAssetEntityData,+ i1.$$TrashedLocalAssetEntityTableFilterComposer,+ i1.$$TrashedLocalAssetEntityTableOrderingComposer,+ i1.$$TrashedLocalAssetEntityTableAnnotationComposer,+ $$TrashedLocalAssetEntityTableCreateCompanionBuilder,+ $$TrashedLocalAssetEntityTableUpdateCompanionBuilder,+ (+ i1.TrashedLocalAssetEntityData,+ i0.BaseReferences<+ i0.GeneratedDatabase,+ i1.$TrashedLocalAssetEntityTable,+ i1.TrashedLocalAssetEntityData+ >,+ ),+ i1.TrashedLocalAssetEntityData,+ i0.PrefetchHooks Function()+ >;+i0.Index get idxTrashedLocalAssetChecksum => i0.Index(+ 'idx_trashed_local_asset_checksum',+ 'CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_checksum ON trashed_local_asset_entity (checksum)',+);++class $TrashedLocalAssetEntityTable extends i3.TrashedLocalAssetEntity+ with+ i0.TableInfo<+ $TrashedLocalAssetEntityTable,+ i1.TrashedLocalAssetEntityData+ > {+ @override+ final i0.GeneratedDatabase attachedDatabase;+ final String? _alias;+ $TrashedLocalAssetEntityTable(this.attachedDatabase, [this._alias]);+ static const i0.VerificationMeta _nameMeta = const i0.VerificationMeta(+ 'name',+ );+ @override+ late final i0.GeneratedColumn<String> name = i0.GeneratedColumn<String>(+ 'name',+ aliasedName,+ false,+ type: i0.DriftSqlType.string,+ requiredDuringInsert: true,+ );+ @override+ late final i0.GeneratedColumnWithTypeConverter<i2.AssetType, int> type =+ i0.GeneratedColumn<int>(+ 'type',+ aliasedName,+ false,+ type: i0.DriftSqlType.int,+ requiredDuringInsert: true,+ ).withConverter<i2.AssetType>(+ i1.$TrashedLocalAssetEntityTable.$convertertype,+ );+ static const i0.VerificationMeta _createdAtMeta = const i0.VerificationMeta(+ 'createdAt',+ );+ @override+ late final i0.GeneratedColumn<DateTime> createdAt =+ i0.GeneratedColumn<DateTime>(+ 'created_at',+ aliasedName,+ false,+ type: i0.DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: i4.currentDateAndTime,+ );+ static const i0.VerificationMeta _updatedAtMeta = const i0.VerificationMeta(+ 'updatedAt',+ );+ @override+ late final i0.GeneratedColumn<DateTime> updatedAt =+ i0.GeneratedColumn<DateTime>(+ 'updated_at',+ aliasedName,+ false,+ type: i0.DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: i4.currentDateAndTime,+ );+ static const i0.VerificationMeta _widthMeta = const i0.VerificationMeta(+ 'width',+ );+ @override+ late final i0.GeneratedColumn<int> width = i0.GeneratedColumn<int>(+ 'width',+ aliasedName,+ true,+ type: i0.DriftSqlType.int,+ requiredDuringInsert: false,+ );+ static const i0.VerificationMeta _heightMeta = const i0.VerificationMeta(+ 'height',+ );+ @override+ late final i0.GeneratedColumn<int> height = i0.GeneratedColumn<int>(+ 'height',+ aliasedName,+ true,+ type: i0.DriftSqlType.int,+ requiredDuringInsert: false,+ );+ static const i0.VerificationMeta _durationInSecondsMeta =+ const i0.VerificationMeta('durationInSeconds');+ @override+ late final i0.GeneratedColumn<int> durationInSeconds =+ i0.GeneratedColumn<int>(+ 'duration_in_seconds',+ aliasedName,+ true,+ type: i0.DriftSqlType.int,+ requiredDuringInsert: false,+ );+ static const i0.VerificationMeta _idMeta = const i0.VerificationMeta('id');+ @override+ late final i0.GeneratedColumn<String> id = i0.GeneratedColumn<String>(+ 'id',+ aliasedName,+ false,+ type: i0.DriftSqlType.string,+ requiredDuringInsert: true,+ );+ static const i0.VerificationMeta _albumIdMeta = const i0.VerificationMeta(+ 'albumId',+ );+ @override+ late final i0.GeneratedColumn<String> albumId = i0.GeneratedColumn<String>(+ 'album_id',+ aliasedName,+ false,+ type: i0.DriftSqlType.string,+ requiredDuringInsert: true,+ );+ static const i0.VerificationMeta _checksumMeta = const i0.VerificationMeta(+ 'checksum',+ );+ @override+ late final i0.GeneratedColumn<String> checksum = i0.GeneratedColumn<String>(+ 'checksum',+ aliasedName,+ true,+ type: i0.DriftSqlType.string,+ requiredDuringInsert: false,+ );+ static const i0.VerificationMeta _isFavoriteMeta = const i0.VerificationMeta(+ 'isFavorite',+ );+ @override+ late final i0.GeneratedColumn<bool> isFavorite = i0.GeneratedColumn<bool>(+ 'is_favorite',+ aliasedName,+ false,+ type: i0.DriftSqlType.bool,+ requiredDuringInsert: false,+ defaultConstraints: i0.GeneratedColumn.constraintIsAlways(+ 'CHECK ("is_favorite" IN (0, 1))',+ ),+ defaultValue: const i4.Constant(false),+ );+ static const i0.VerificationMeta _orientationMeta = const i0.VerificationMeta(+ 'orientation',+ );+ @override+ late final i0.GeneratedColumn<int> orientation = i0.GeneratedColumn<int>(+ 'orientation',+ aliasedName,+ false,+ type: i0.DriftSqlType.int,+ requiredDuringInsert: false,+ defaultValue: const i4.Constant(0),+ );+ @override+ List<i0.GeneratedColumn> get $columns => [+ name,+ type,+ createdAt,+ updatedAt,+ width,+ height,+ durationInSeconds,+ id,+ albumId,+ checksum,+ isFavorite,+ orientation,+ ];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'trashed_local_asset_entity';+ @override+ i0.VerificationContext validateIntegrity(+ i0.Insertable<i1.TrashedLocalAssetEntityData> instance, {+ bool isInserting = false,+ }) {+ final context = i0.VerificationContext();+ final data = instance.toColumns(true);+ if (data.containsKey('name')) {+ context.handle(+ _nameMeta,+ name.isAcceptableOrUnknown(data['name']!, _nameMeta),+ );+ } else if (isInserting) {+ context.missing(_nameMeta);+ }+ if (data.containsKey('created_at')) {+ context.handle(+ _createdAtMeta,+ createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),+ );+ }+ if (data.containsKey('updated_at')) {+ context.handle(+ _updatedAtMeta,+ updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),+ );+ }+ if (data.containsKey('width')) {+ context.handle(+ _widthMeta,+ width.isAcceptableOrUnknown(data['width']!, _widthMeta),+ );+ }+ if (data.containsKey('height')) {+ context.handle(+ _heightMeta,+ height.isAcceptableOrUnknown(data['height']!, _heightMeta),+ );+ }+ if (data.containsKey('duration_in_seconds')) {+ context.handle(+ _durationInSecondsMeta,+ durationInSeconds.isAcceptableOrUnknown(+ data['duration_in_seconds']!,+ _durationInSecondsMeta,+ ),+ );+ }+ if (data.containsKey('id')) {+ context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));+ } else if (isInserting) {+ context.missing(_idMeta);+ }+ if (data.containsKey('album_id')) {+ context.handle(+ _albumIdMeta,+ albumId.isAcceptableOrUnknown(data['album_id']!, _albumIdMeta),+ );+ } else if (isInserting) {+ context.missing(_albumIdMeta);+ }+ if (data.containsKey('checksum')) {+ context.handle(+ _checksumMeta,+ checksum.isAcceptableOrUnknown(data['checksum']!, _checksumMeta),+ );+ }+ if (data.containsKey('is_favorite')) {+ context.handle(+ _isFavoriteMeta,+ isFavorite.isAcceptableOrUnknown(data['is_favorite']!, _isFavoriteMeta),+ );+ }+ if (data.containsKey('orientation')) {+ context.handle(+ _orientationMeta,+ orientation.isAcceptableOrUnknown(+ data['orientation']!,+ _orientationMeta,+ ),+ );+ }+ return context;+ }++ @override+ Set<i0.GeneratedColumn> get $primaryKey => {id, albumId};+ @override+ i1.TrashedLocalAssetEntityData map(+ Map<String, dynamic> data, {+ String? tablePrefix,+ }) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return i1.TrashedLocalAssetEntityData(+ name: attachedDatabase.typeMapping.read(+ i0.DriftSqlType.string,+ data['${effectivePrefix}name'],+ )!,+ type: i1.$TrashedLocalAssetEntityTable.$convertertype.fromSql(+ attachedDatabase.typeMapping.read(+ i0.DriftSqlType.int,+ data['${effectivePrefix}type'],+ )!,+ ),+ createdAt: attachedDatabase.typeMapping.read(+ i0.DriftSqlType.dateTime,+ data['${effectivePrefix}created_at'],+ )!,+ updatedAt: attachedDatabase.typeMapping.read(+ i0.DriftSqlType.dateTime,+ data['${effectivePrefix}updated_at'],+ )!,+ width: attachedDatabase.typeMapping.read(+ i0.DriftSqlType.int,+ data['${effectivePrefix}width'],+ ),+ height: attachedDatabase.typeMapping.read(+ i0.DriftSqlType.int,+ data['${effectivePrefix}height'],+ ),+ durationInSeconds: attachedDatabase.typeMapping.read(+ i0.DriftSqlType.int,+ data['${effectivePrefix}duration_in_seconds'],+ ),+ id: attachedDatabase.typeMapping.read(+ i0.DriftSqlType.string,+ data['${effectivePrefix}id'],+ )!,+ albumId: attachedDatabase.typeMapping.read(+ i0.DriftSqlType.string,+ data['${effectivePrefix}album_id'],+ )!,+ checksum: attachedDatabase.typeMapping.read(+ i0.DriftSqlType.string,+ data['${effectivePrefix}checksum'],+ ),+ isFavorite: attachedDatabase.typeMapping.read(+ i0.DriftSqlType.bool,+ data['${effectivePrefix}is_favorite'],+ )!,+ orientation: attachedDatabase.typeMapping.read(+ i0.DriftSqlType.int,+ data['${effectivePrefix}orientation'],+ )!,+ );+ }++ @override+ $TrashedLocalAssetEntityTable createAlias(String alias) {+ return $TrashedLocalAssetEntityTable(attachedDatabase, alias);+ }++ static i0.JsonTypeConverter2<i2.AssetType, int, int> $convertertype =+ const i0.EnumIndexConverter<i2.AssetType>(i2.AssetType.values);+ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class TrashedLocalAssetEntityData extends i0.DataClass+ implements i0.Insertable<i1.TrashedLocalAssetEntityData> {+ final String name;+ final i2.AssetType type;+ final DateTime createdAt;+ final DateTime updatedAt;+ final int? width;+ final int? height;+ final int? durationInSeconds;+ final String id;+ final String albumId;+ final String? checksum;+ final bool isFavorite;+ final int orientation;+ const TrashedLocalAssetEntityData({+ required this.name,+ required this.type,+ required this.createdAt,+ required this.updatedAt,+ this.width,+ this.height,+ this.durationInSeconds,+ required this.id,+ required this.albumId,+ this.checksum,+ required this.isFavorite,+ required this.orientation,+ });+ @override+ Map<String, i0.Expression> toColumns(bool nullToAbsent) {+ final map = <String, i0.Expression>{};+ map['name'] = i0.Variable<String>(name);+ {+ map['type'] = i0.Variable<int>(+ i1.$TrashedLocalAssetEntityTable.$convertertype.toSql(type),+ );+ }+ map['created_at'] = i0.Variable<DateTime>(createdAt);+ map['updated_at'] = i0.Variable<DateTime>(updatedAt);+ if (!nullToAbsent || width != null) {+ map['width'] = i0.Variable<int>(width);+ }+ if (!nullToAbsent || height != null) {+ map['height'] = i0.Variable<int>(height);+ }+ if (!nullToAbsent || durationInSeconds != null) {+ map['duration_in_seconds'] = i0.Variable<int>(durationInSeconds);+ }+ map['id'] = i0.Variable<String>(id);+ map['album_id'] = i0.Variable<String>(albumId);+ if (!nullToAbsent || checksum != null) {+ map['checksum'] = i0.Variable<String>(checksum);+ }+ map['is_favorite'] = i0.Variable<bool>(isFavorite);+ map['orientation'] = i0.Variable<int>(orientation);+ return map;+ }++ factory TrashedLocalAssetEntityData.fromJson(+ Map<String, dynamic> json, {+ i0.ValueSerializer? serializer,+ }) {+ serializer ??= i0.driftRuntimeOptions.defaultSerializer;+ return TrashedLocalAssetEntityData(+ name: serializer.fromJson<String>(json['name']),+ type: i1.$TrashedLocalAssetEntityTable.$convertertype.fromJson(+ serializer.fromJson<int>(json['type']),+ ),+ createdAt: serializer.fromJson<DateTime>(json['createdAt']),+ updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),+ width: serializer.fromJson<int?>(json['width']),+ height: serializer.fromJson<int?>(json['height']),+ durationInSeconds: serializer.fromJson<int?>(json['durationInSeconds']),+ id: serializer.fromJson<String>(json['id']),+ albumId: serializer.fromJson<String>(json['albumId']),+ checksum: serializer.fromJson<String?>(json['checksum']),+ isFavorite: serializer.fromJson<bool>(json['isFavorite']),+ orientation: serializer.fromJson<int>(json['orientation']),+ );+ }+ @override+ Map<String, dynamic> toJson({i0.ValueSerializer? serializer}) {+ serializer ??= i0.driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'name': serializer.toJson<String>(name),+ 'type': serializer.toJson<int>(+ i1.$TrashedLocalAssetEntityTable.$convertertype.toJson(type),+ ),+ 'createdAt': serializer.toJson<DateTime>(createdAt),+ 'updatedAt': serializer.toJson<DateTime>(updatedAt),+ 'width': serializer.toJson<int?>(width),+ 'height': serializer.toJson<int?>(height),+ 'durationInSeconds': serializer.toJson<int?>(durationInSeconds),+ 'id': serializer.toJson<String>(id),+ 'albumId': serializer.toJson<String>(albumId),+ 'checksum': serializer.toJson<String?>(checksum),+ 'isFavorite': serializer.toJson<bool>(isFavorite),+ 'orientation': serializer.toJson<int>(orientation),+ };+ }++ i1.TrashedLocalAssetEntityData copyWith({+ String? name,+ i2.AssetType? type,+ DateTime? createdAt,+ DateTime? updatedAt,+ i0.Value<int?> width = const i0.Value.absent(),+ i0.Value<int?> height = const i0.Value.absent(),+ i0.Value<int?> durationInSeconds = const i0.Value.absent(),+ String? id,+ String? albumId,+ i0.Value<String?> checksum = const i0.Value.absent(),+ bool? isFavorite,+ int? orientation,+ }) => i1.TrashedLocalAssetEntityData(+ name: name ?? this.name,+ type: type ?? this.type,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ width: width.present ? width.value : this.width,+ height: height.present ? height.value : this.height,+ durationInSeconds: durationInSeconds.present+ ? durationInSeconds.value+ : this.durationInSeconds,+ id: id ?? this.id,+ albumId: albumId ?? this.albumId,+ checksum: checksum.present ? checksum.value : this.checksum,+ isFavorite: isFavorite ?? this.isFavorite,+ orientation: orientation ?? this.orientation,+ );+ TrashedLocalAssetEntityData copyWithCompanion(+ i1.TrashedLocalAssetEntityCompanion data,+ ) {+ return TrashedLocalAssetEntityData(+ name: data.name.present ? data.name.value : this.name,+ type: data.type.present ? data.type.value : this.type,+ createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,+ updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,+ width: data.width.present ? data.width.value : this.width,+ height: data.height.present ? data.height.value : this.height,+ durationInSeconds: data.durationInSeconds.present+ ? data.durationInSeconds.value+ : this.durationInSeconds,+ id: data.id.present ? data.id.value : this.id,+ albumId: data.albumId.present ? data.albumId.value : this.albumId,+ checksum: data.checksum.present ? data.checksum.value : this.checksum,+ isFavorite: data.isFavorite.present+ ? data.isFavorite.value+ : this.isFavorite,+ orientation: data.orientation.present+ ? data.orientation.value+ : this.orientation,+ );+ }++ @override+ String toString() {+ return (StringBuffer('TrashedLocalAssetEntityData(')+ ..write('name: $name, ')+ ..write('type: $type, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('width: $width, ')+ ..write('height: $height, ')+ ..write('durationInSeconds: $durationInSeconds, ')+ ..write('id: $id, ')+ ..write('albumId: $albumId, ')+ ..write('checksum: $checksum, ')+ ..write('isFavorite: $isFavorite, ')+ ..write('orientation: $orientation')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(+ name,+ type,+ createdAt,+ updatedAt,+ width,+ height,+ durationInSeconds,+ id,+ albumId,+ checksum,+ isFavorite,+ orientation,+ );+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is i1.TrashedLocalAssetEntityData &&+ other.name == this.name &&+ other.type == this.type &&+ other.createdAt == this.createdAt &&+ other.updatedAt == this.updatedAt &&+ other.width == this.width &&+ other.height == this.height &&+ other.durationInSeconds == this.durationInSeconds &&+ other.id == this.id &&+ other.albumId == this.albumId &&+ other.checksum == this.checksum &&+ other.isFavorite == this.isFavorite &&+ other.orientation == this.orientation);+}++class TrashedLocalAssetEntityCompanion+ extends i0.UpdateCompanion<i1.TrashedLocalAssetEntityData> {+ final i0.Value<String> name;+ final i0.Value<i2.AssetType> type;+ final i0.Value<DateTime> createdAt;+ final i0.Value<DateTime> updatedAt;+ final i0.Value<int?> width;+ final i0.Value<int?> height;+ final i0.Value<int?> durationInSeconds;+ final i0.Value<String> id;+ final i0.Value<String> albumId;+ final i0.Value<String?> checksum;+ final i0.Value<bool> isFavorite;+ final i0.Value<int> orientation;+ const TrashedLocalAssetEntityCompanion({+ this.name = const i0.Value.absent(),+ this.type = const i0.Value.absent(),+ this.createdAt = const i0.Value.absent(),+ this.updatedAt = const i0.Value.absent(),+ this.width = const i0.Value.absent(),+ this.height = const i0.Value.absent(),+ this.durationInSeconds = const i0.Value.absent(),+ this.id = const i0.Value.absent(),+ this.albumId = const i0.Value.absent(),+ this.checksum = const i0.Value.absent(),+ this.isFavorite = const i0.Value.absent(),+ this.orientation = const i0.Value.absent(),+ });+ TrashedLocalAssetEntityCompanion.insert({+ required String name,+ required i2.AssetType type,+ this.createdAt = const i0.Value.absent(),+ this.updatedAt = const i0.Value.absent(),+ this.width = const i0.Value.absent(),+ this.height = const i0.Value.absent(),+ this.durationInSeconds = const i0.Value.absent(),+ required String id,+ required String albumId,+ this.checksum = const i0.Value.absent(),+ this.isFavorite = const i0.Value.absent(),+ this.orientation = const i0.Value.absent(),+ }) : name = i0.Value(name),+ type = i0.Value(type),+ id = i0.Value(id),+ albumId = i0.Value(albumId);+ static i0.Insertable<i1.TrashedLocalAssetEntityData> custom({+ i0.Expression<String>? name,+ i0.Expression<int>? type,+ i0.Expression<DateTime>? createdAt,+ i0.Expression<DateTime>? updatedAt,+ i0.Expression<int>? width,+ i0.Expression<int>? height,+ i0.Expression<int>? durationInSeconds,+ i0.Expression<String>? id,+ i0.Expression<String>? albumId,+ i0.Expression<String>? checksum,+ i0.Expression<bool>? isFavorite,+ i0.Expression<int>? orientation,+ }) {+ return i0.RawValuesInsertable({+ if (name != null) 'name': name,+ if (type != null) 'type': type,+ if (createdAt != null) 'created_at': createdAt,+ if (updatedAt != null) 'updated_at': updatedAt,+ if (width != null) 'width': width,+ if (height != null) 'height': height,+ if (durationInSeconds != null) 'duration_in_seconds': durationInSeconds,+ if (id != null) 'id': id,+ if (albumId != null) 'album_id': albumId,+ if (checksum != null) 'checksum': checksum,+ if (isFavorite != null) 'is_favorite': isFavorite,+ if (orientation != null) 'orientation': orientation,+ });+ }++ i1.TrashedLocalAssetEntityCompanion copyWith({+ i0.Value<String>? name,+ i0.Value<i2.AssetType>? type,+ i0.Value<DateTime>? createdAt,+ i0.Value<DateTime>? updatedAt,+ i0.Value<int?>? width,+ i0.Value<int?>? height,+ i0.Value<int?>? durationInSeconds,+ i0.Value<String>? id,+ i0.Value<String>? albumId,+ i0.Value<String?>? checksum,+ i0.Value<bool>? isFavorite,+ i0.Value<int>? orientation,+ }) {+ return i1.TrashedLocalAssetEntityCompanion(+ name: name ?? this.name,+ type: type ?? this.type,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ width: width ?? this.width,+ height: height ?? this.height,+ durationInSeconds: durationInSeconds ?? this.durationInSeconds,+ id: id ?? this.id,+ albumId: albumId ?? this.albumId,+ checksum: checksum ?? this.checksum,+ isFavorite: isFavorite ?? this.isFavorite,+ orientation: orientation ?? this.orientation,+ );+ }++ @override+ Map<String, i0.Expression> toColumns(bool nullToAbsent) {+ final map = <String, i0.Expression>{};+ if (name.present) {+ map['name'] = i0.Variable<String>(name.value);+ }+ if (type.present) {+ map['type'] = i0.Variable<int>(+ i1.$TrashedLocalAssetEntityTable.$convertertype.toSql(type.value),+ );+ }+ if (createdAt.present) {+ map['created_at'] = i0.Variable<DateTime>(createdAt.value);+ }+ if (updatedAt.present) {+ map['updated_at'] = i0.Variable<DateTime>(updatedAt.value);+ }+ if (width.present) {+ map['width'] = i0.Variable<int>(width.value);+ }+ if (height.present) {+ map['height'] = i0.Variable<int>(height.value);+ }+ if (durationInSeconds.present) {+ map['duration_in_seconds'] = i0.Variable<int>(durationInSeconds.value);+ }+ if (id.present) {+ map['id'] = i0.Variable<String>(id.value);+ }+ if (albumId.present) {+ map['album_id'] = i0.Variable<String>(albumId.value);+ }+ if (checksum.present) {+ map['checksum'] = i0.Variable<String>(checksum.value);+ }+ if (isFavorite.present) {+ map['is_favorite'] = i0.Variable<bool>(isFavorite.value);+ }+ if (orientation.present) {+ map['orientation'] = i0.Variable<int>(orientation.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('TrashedLocalAssetEntityCompanion(')+ ..write('name: $name, ')+ ..write('type: $type, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('width: $width, ')+ ..write('height: $height, ')+ ..write('durationInSeconds: $durationInSeconds, ')+ ..write('id: $id, ')+ ..write('albumId: $albumId, ')+ ..write('checksum: $checksum, ')+ ..write('isFavorite: $isFavorite, ')+ ..write('orientation: $orientation')+ ..write(')'))+ .toString();+ }+}++i0.Index get idxTrashedLocalAssetAlbum => i0.Index(+ 'idx_trashed_local_asset_album',+ 'CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_album ON trashed_local_asset_entity (album_id)',+);diff --git a/mobile/lib/infrastructure/repositories/db.repository.dart b/mobile/lib/infrastructure/repositories/db.repository.dartindex 7291c3a97b..548aa2e384 100644--- a/mobile/lib/infrastructure/repositories/db.repository.dart+++ b/mobile/lib/infrastructure/repositories/db.repository.dart@@ -10,6 +10,7 @@ import 'package:immich_mobile/infrastructure/entities/exif.entity.dart';import 'package:immich_mobile/infrastructure/entities/local_album.entity.dart';import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.dart';import 'package:immich_mobile/infrastructure/entities/local_asset.entity.dart';+import 'package:immich_mobile/infrastructure/entities/trashed_local_asset.entity.dart';import 'package:immich_mobile/infrastructure/entities/memory.entity.dart';import 'package:immich_mobile/infrastructure/entities/memory_asset.entity.dart';import 'package:immich_mobile/infrastructure/entities/partner.entity.dart';@@ -62,6 +63,7 @@ class IsarDatabaseRepository implements IDatabaseRepository {PersonEntity,AssetFaceEntity,StoreEntity,+ TrashedLocalAssetEntity,],include: {'package:immich_mobile/infrastructure/entities/merged_asset.drift'},)@@ -93,7 +95,7 @@ class Drift extends $Drift implements IDatabaseRepository {}@override- int get schemaVersion => 12;+ int get schemaVersion => 13;@overrideMigrationStrategy get migration => MigrationStrategy(@@ -178,6 +180,11 @@ class Drift extends $Drift implements IDatabaseRepository {);}},+ from12To13: (m, v13) async {+ await m.create(v13.trashedLocalAssetEntity);+ await m.createIndex(v13.idxTrashedLocalAssetChecksum);+ await m.createIndex(v13.idxTrashedLocalAssetAlbum);+ },),);diff --git a/mobile/lib/infrastructure/repositories/db.repository.drift.dart b/mobile/lib/infrastructure/repositories/db.repository.drift.dartindex e39ed8a560..bd72da949c 100644--- a/mobile/lib/infrastructure/repositories/db.repository.drift.dart+++ b/mobile/lib/infrastructure/repositories/db.repository.drift.dart@@ -37,9 +37,11 @@ import 'package:immich_mobile/infrastructure/entities/asset_face.entity.drift.daas i17;import 'package:immich_mobile/infrastructure/entities/store.entity.drift.dart'as i18;-import 'package:immich_mobile/infrastructure/entities/merged_asset.drift.dart'+import 'package:immich_mobile/infrastructure/entities/trashed_local_asset.entity.drift.dart'as i19;-import 'package:drift/internal/modular.dart' as i20;+import 'package:immich_mobile/infrastructure/entities/merged_asset.drift.dart'+ as i20;+import 'package:drift/internal/modular.dart' as i21;abstract class $Drift extends i0.GeneratedDatabase {$Drift(i0.QueryExecutor e) : super(e);@@ -77,9 +79,11 @@ abstract class $Drift extends i0.GeneratedDatabase {late final i17.$AssetFaceEntityTable assetFaceEntity = i17.$AssetFaceEntityTable(this);late final i18.$StoreEntityTable storeEntity = i18.$StoreEntityTable(this);- i19.MergedAssetDrift get mergedAssetDrift => i20.ReadDatabaseContainer(+ late final i19.$TrashedLocalAssetEntityTable trashedLocalAssetEntity = i19+ .$TrashedLocalAssetEntityTable(this);+ i20.MergedAssetDrift get mergedAssetDrift => i21.ReadDatabaseContainer(this,- ).accessor<i19.MergedAssetDrift>(i19.MergedAssetDrift.new);+ ).accessor<i20.MergedAssetDrift>(i20.MergedAssetDrift.new);@overrideIterable<i0.TableInfo<i0.Table, Object?>> get allTables =>allSchemaEntities.whereType<i0.TableInfo<i0.Table, Object?>>();@@ -108,7 +112,10 @@ abstract class $Drift extends i0.GeneratedDatabase {personEntity,assetFaceEntity,storeEntity,+ trashedLocalAssetEntity,i11.idxLatLng,+ i19.idxTrashedLocalAssetChecksum,+ i19.idxTrashedLocalAssetAlbum,];@overridei0.StreamQueryUpdateRules@@ -336,4 +343,9 @@ class $DriftManager {i17.$$AssetFaceEntityTableTableManager(_db, _db.assetFaceEntity);i18.$$StoreEntityTableTableManager get storeEntity =>i18.$$StoreEntityTableTableManager(_db, _db.storeEntity);+ i19.$$TrashedLocalAssetEntityTableTableManager get trashedLocalAssetEntity =>+ i19.$$TrashedLocalAssetEntityTableTableManager(+ _db,+ _db.trashedLocalAssetEntity,+ );}diff --git a/mobile/lib/infrastructure/repositories/db.repository.steps.dart b/mobile/lib/infrastructure/repositories/db.repository.steps.dartindex c973cd6f13..f2d87a7f83 100644--- a/mobile/lib/infrastructure/repositories/db.repository.steps.dart+++ b/mobile/lib/infrastructure/repositories/db.repository.steps.dart@@ -5037,6 +5037,454 @@ final class Schema12 extends i0.VersionedSchema {);}+final class Schema13 extends i0.VersionedSchema {+ Schema13({required super.database}) : super(version: 13);+ @override+ late final List<i1.DatabaseSchemaEntity> entities = [+ userEntity,+ remoteAssetEntity,+ stackEntity,+ localAssetEntity,+ remoteAlbumEntity,+ localAlbumEntity,+ localAlbumAssetEntity,+ idxLocalAssetChecksum,+ idxRemoteAssetOwnerChecksum,+ uQRemoteAssetsOwnerChecksum,+ uQRemoteAssetsOwnerLibraryChecksum,+ idxRemoteAssetChecksum,+ authUserEntity,+ userMetadataEntity,+ partnerEntity,+ remoteExifEntity,+ remoteAlbumAssetEntity,+ remoteAlbumUserEntity,+ memoryEntity,+ memoryAssetEntity,+ personEntity,+ assetFaceEntity,+ storeEntity,+ trashedLocalAssetEntity,+ idxLatLng,+ idxTrashedLocalAssetChecksum,+ idxTrashedLocalAssetAlbum,+ ];+ late final Shape20 userEntity = Shape20(+ source: i0.VersionedTable(+ entityName: 'user_entity',+ withoutRowId: true,+ isStrict: true,+ tableConstraints: ['PRIMARY KEY(id)'],+ columns: [+ _column_0,+ _column_1,+ _column_3,+ _column_84,+ _column_85,+ _column_91,+ ],+ 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 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 Shape19 localAlbumEntity = Shape19(+ 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_90,+ _column_33,+ ],+ attachedDatabase: database,+ ),+ alias: null,+ );+ late final Shape22 localAlbumAssetEntity = Shape22(+ source: i0.VersionedTable(+ entityName: 'local_album_asset_entity',+ withoutRowId: true,+ isStrict: true,+ tableConstraints: ['PRIMARY KEY(asset_id, album_id)'],+ columns: [_column_34, _column_35, _column_33],+ attachedDatabase: database,+ ),+ alias: null,+ );+ final i1.Index idxLocalAssetChecksum = i1.Index(+ 'idx_local_asset_checksum',+ 'CREATE INDEX IF NOT EXISTS idx_local_asset_checksum ON local_asset_entity (checksum)',+ );+ final i1.Index idxRemoteAssetOwnerChecksum = i1.Index(+ 'idx_remote_asset_owner_checksum',+ 'CREATE INDEX IF NOT EXISTS 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 IF NOT EXISTS idx_remote_asset_checksum ON remote_asset_entity (checksum)',+ );+ late final Shape21 authUserEntity = Shape21(+ source: i0.VersionedTable(+ entityName: 'auth_user_entity',+ withoutRowId: true,+ isStrict: true,+ tableConstraints: ['PRIMARY KEY(id)'],+ columns: [+ _column_0,+ _column_1,+ _column_3,+ _column_2,+ _column_84,+ _column_85,+ _column_92,+ _column_93,+ _column_7,+ _column_94,+ ],+ attachedDatabase: database,+ ),+ alias: null,+ );+ 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 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,+ );+ late final Shape18 storeEntity = Shape18(+ source: i0.VersionedTable(+ entityName: 'store_entity',+ withoutRowId: true,+ isStrict: true,+ tableConstraints: ['PRIMARY KEY(id)'],+ columns: [_column_87, _column_88, _column_89],+ attachedDatabase: database,+ ),+ alias: null,+ );+ late final Shape23 trashedLocalAssetEntity = Shape23(+ source: i0.VersionedTable(+ entityName: 'trashed_local_asset_entity',+ withoutRowId: true,+ isStrict: true,+ tableConstraints: ['PRIMARY KEY(id, album_id)'],+ columns: [+ _column_1,+ _column_8,+ _column_9,+ _column_5,+ _column_10,+ _column_11,+ _column_12,+ _column_0,+ _column_95,+ _column_22,+ _column_14,+ _column_23,+ ],+ attachedDatabase: database,+ ),+ alias: null,+ );+ final i1.Index idxLatLng = i1.Index(+ 'idx_lat_lng',+ 'CREATE INDEX IF NOT EXISTS idx_lat_lng ON remote_exif_entity (latitude, longitude)',+ );+ final i1.Index idxTrashedLocalAssetChecksum = i1.Index(+ 'idx_trashed_local_asset_checksum',+ 'CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_checksum ON trashed_local_asset_entity (checksum)',+ );+ final i1.Index idxTrashedLocalAssetAlbum = i1.Index(+ 'idx_trashed_local_asset_album',+ 'CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_album ON trashed_local_asset_entity (album_id)',+ );+}++class Shape23 extends i0.VersionedTable {+ Shape23({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 albumId =>+ columnsByName['album_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<int> get orientation =>+ columnsByName['orientation']! as i1.GeneratedColumn<int>;+}++i1.GeneratedColumn<String> _column_95(String aliasedName) =>+ i1.GeneratedColumn<String>(+ 'album_id',+ aliasedName,+ false,+ type: i1.DriftSqlType.string,+ );i0.MigrationStepWithVersion migrationSteps({required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,@@ -5049,6 +5497,7 @@ i0.MigrationStepWithVersion migrationSteps({required Future<void> Function(i1.Migrator m, Schema10 schema) from9To10,required Future<void> Function(i1.Migrator m, Schema11 schema) from10To11,required Future<void> Function(i1.Migrator m, Schema12 schema) from11To12,+ required Future<void> Function(i1.Migrator m, Schema13 schema) from12To13,}) {return (currentVersion, database) async {switch (currentVersion) {@@ -5107,6 +5556,11 @@ i0.MigrationStepWithVersion migrationSteps({final migrator = i1.Migrator(database, schema);await from11To12(migrator, schema);return 12;+ case 12:+ final schema = Schema13(database: database);+ final migrator = i1.Migrator(database, schema);+ await from12To13(migrator, schema);+ return 13;default:throw ArgumentError.value('Unknown migration from $currentVersion');}@@ -5125,6 +5579,7 @@ i1.OnUpgrade stepByStep({required Future<void> Function(i1.Migrator m, Schema10 schema) from9To10,required Future<void> Function(i1.Migrator m, Schema11 schema) from10To11,required Future<void> Function(i1.Migrator m, Schema12 schema) from11To12,+ required Future<void> Function(i1.Migrator m, Schema13 schema) from12To13,}) => i0.VersionedSchema.stepByStepHelper(step: migrationSteps(from1To2: from1To2,@@ -5138,5 +5593,6 @@ i1.OnUpgrade stepByStep({from9To10: from9To10,from10To11: from10To11,from11To12: from11To12,+ from12To13: from12To13,),);diff --git a/mobile/lib/infrastructure/repositories/local_asset.repository.dart b/mobile/lib/infrastructure/repositories/local_asset.repository.dartindex 2b76472c9e..4d30e09716 100644--- a/mobile/lib/infrastructure/repositories/local_asset.repository.dart+++ b/mobile/lib/infrastructure/repositories/local_asset.repository.dart@@ -1,4 +1,6 @@+import 'package:collection/collection.dart';import 'package:drift/drift.dart';+import 'package:immich_mobile/constants/constants.dart';import 'package:immich_mobile/domain/models/album/local_album.model.dart';import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';import 'package:immich_mobile/infrastructure/entities/local_album.entity.dart';@@ -8,6 +10,7 @@ import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';class DriftLocalAssetRepository extends DriftDatabaseRepository {final Drift _db;+const DriftLocalAssetRepository(this._db) : super(_db);SingleOrNullSelectable<LocalAsset?> _assetSelectable(String id) {@@ -95,4 +98,32 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {}return query.map((localAlbum) => localAlbum.toDto()).get();}++ Future<Map<String, List<LocalAsset>>> getAssetsFromBackupAlbums(Iterable<String> checksums) async {+ if (checksums.isEmpty) {+ return {};+ }++ final result = <String, List<LocalAsset>>{};++ for (final slice in checksums.toSet().slices(kDriftMaxChunk)) {+ final rows =+ await (_db.select(_db.localAlbumAssetEntity).join([+ innerJoin(_db.localAlbumEntity, _db.localAlbumAssetEntity.albumId.equalsExp(_db.localAlbumEntity.id)),+ innerJoin(_db.localAssetEntity, _db.localAlbumAssetEntity.assetId.equalsExp(_db.localAssetEntity.id)),+ ])..where(+ _db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected) &+ _db.localAssetEntity.checksum.isIn(slice),+ ))+ .get();++ for (final row in rows) {+ final albumId = row.readTable(_db.localAlbumAssetEntity).albumId;+ final assetData = row.readTable(_db.localAssetEntity);+ final asset = assetData.toDto();+ (result[albumId] ??= <LocalAsset>[]).add(asset);+ }+ }+ return result;+ }}diff --git a/mobile/lib/infrastructure/repositories/remote_asset.repository.dart b/mobile/lib/infrastructure/repositories/remote_asset.repository.dartindex be55c21afc..96c204ea0e 100644--- a/mobile/lib/infrastructure/repositories/remote_asset.repository.dart+++ b/mobile/lib/infrastructure/repositories/remote_asset.repository.dart@@ -12,6 +12,7 @@ import 'package:maplibre_gl/maplibre_gl.dart';class RemoteAssetRepository extends DriftDatabaseRepository {final Drift _db;+const RemoteAssetRepository(this._db) : super(_db);/// For testing purposesdiff --git a/mobile/lib/infrastructure/repositories/trashed_local_asset.repository.dart b/mobile/lib/infrastructure/repositories/trashed_local_asset.repository.dartnew file mode 100644index 0000000000..498e4227b7--- /dev/null+++ b/mobile/lib/infrastructure/repositories/trashed_local_asset.repository.dart@@ -0,0 +1,252 @@+import 'package:collection/collection.dart';+import 'package:drift/drift.dart';+import 'package:immich_mobile/constants/constants.dart';+import 'package:immich_mobile/domain/models/album/local_album.model.dart';+import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';+import 'package:immich_mobile/infrastructure/entities/local_asset.entity.dart';+import 'package:immich_mobile/infrastructure/entities/local_asset.entity.drift.dart';+import 'package:immich_mobile/infrastructure/entities/trashed_local_asset.entity.dart';+import 'package:immich_mobile/infrastructure/entities/trashed_local_asset.entity.drift.dart';+import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';++typedef TrashedAsset = ({String albumId, LocalAsset asset});++class DriftTrashedLocalAssetRepository extends DriftDatabaseRepository {+ final Drift _db;++ const DriftTrashedLocalAssetRepository(this._db) : super(_db);++ Future<void> updateHashes(Map<String, String> hashes) {+ if (hashes.isEmpty) {+ return Future.value();+ }+ return _db.batch((batch) async {+ for (final entry in hashes.entries) {+ batch.update(+ _db.trashedLocalAssetEntity,+ TrashedLocalAssetEntityCompanion(checksum: Value(entry.value)),+ where: (e) => e.id.equals(entry.key),+ );+ }+ });+ }++ Future<List<LocalAsset>> getAssetsToHash(Iterable<String> albumIds) {+ final query = _db.trashedLocalAssetEntity.select()..where((r) => r.albumId.isIn(albumIds) & r.checksum.isNull());+ return query.map((row) => row.toLocalAsset()).get();+ }++ Future<Iterable<LocalAsset>> getToRestore() async {+ final selectedAlbumIds = (_db.selectOnly(_db.localAlbumEntity)+ ..addColumns([_db.localAlbumEntity.id])+ ..where(_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected)));++ final rows =+ await (_db.select(_db.trashedLocalAssetEntity).join([+ innerJoin(+ _db.remoteAssetEntity,+ _db.remoteAssetEntity.checksum.equalsExp(_db.trashedLocalAssetEntity.checksum),+ ),+ ])..where(+ _db.trashedLocalAssetEntity.albumId.isInQuery(selectedAlbumIds) &+ _db.remoteAssetEntity.deletedAt.isNull(),+ ))+ .get();++ return rows.map((result) => result.readTable(_db.trashedLocalAssetEntity).toLocalAsset());+ }++ /// Applies resulted snapshot of trashed assets:+ /// - upserts incoming rows+ /// - deletes rows that are not present in the snapshot+ Future<void> processTrashSnapshot(Iterable<TrashedAsset> trashedAssets) async {+ if (trashedAssets.isEmpty) {+ await _db.delete(_db.trashedLocalAssetEntity).go();+ return;+ }+ final assetIds = trashedAssets.map((e) => e.asset.id).toSet();+ Map<String, String> localChecksumById = await _getCachedChecksums(assetIds);++ return _db.transaction(() async {+ await _db.batch((batch) {+ for (final item in trashedAssets) {+ final effectiveChecksum = localChecksumById[item.asset.id] ?? item.asset.checksum;+ final companion = TrashedLocalAssetEntityCompanion.insert(+ id: item.asset.id,+ albumId: item.albumId,+ checksum: Value(effectiveChecksum),+ name: item.asset.name,+ type: item.asset.type,+ createdAt: Value(item.asset.createdAt),+ updatedAt: Value(item.asset.updatedAt),+ width: Value(item.asset.width),+ height: Value(item.asset.height),+ durationInSeconds: Value(item.asset.durationInSeconds),+ isFavorite: Value(item.asset.isFavorite),+ orientation: Value(item.asset.orientation),+ );++ batch.insert<$TrashedLocalAssetEntityTable, TrashedLocalAssetEntityData>(+ _db.trashedLocalAssetEntity,+ companion,+ onConflict: DoUpdate((_) => companion, where: (old) => old.updatedAt.isNotValue(item.asset.updatedAt)),+ );+ }+ });++ if (assetIds.length <= kDriftMaxChunk) {+ await (_db.delete(_db.trashedLocalAssetEntity)..where((row) => row.id.isNotIn(assetIds))).go();+ } else {+ final existingIds = await (_db.selectOnly(+ _db.trashedLocalAssetEntity,+ )..addColumns([_db.trashedLocalAssetEntity.id])).map((r) => r.read(_db.trashedLocalAssetEntity.id)!).get();+ final idToDelete = existingIds.where((id) => !assetIds.contains(id));+ for (final slice in idToDelete.slices(kDriftMaxChunk)) {+ await (_db.delete(_db.trashedLocalAssetEntity)..where((t) => t.id.isIn(slice))).go();+ }+ }+ });+ }++ Stream<int> watchCount() {+ return (_db.selectOnly(_db.trashedLocalAssetEntity)..addColumns([_db.trashedLocalAssetEntity.id.count()]))+ .watchSingle()+ .map((row) => row.read<int>(_db.trashedLocalAssetEntity.id.count()) ?? 0);+ }++ Stream<int> watchHashedCount() {+ return (_db.selectOnly(_db.trashedLocalAssetEntity)+ ..addColumns([_db.trashedLocalAssetEntity.id.count()])+ ..where(_db.trashedLocalAssetEntity.checksum.isNotNull()))+ .watchSingle()+ .map((row) => row.read<int>(_db.trashedLocalAssetEntity.id.count()) ?? 0);+ }++ Future<void> trashLocalAsset(Map<String, List<LocalAsset>> assetsByAlbums) async {+ if (assetsByAlbums.isEmpty) {+ return;+ }++ final companions = <TrashedLocalAssetEntityCompanion>[];+ final idToDelete = <String>{};++ for (final entry in assetsByAlbums.entries) {+ for (final asset in entry.value) {+ idToDelete.add(asset.id);+ companions.add(+ TrashedLocalAssetEntityCompanion(+ id: Value(asset.id),+ name: Value(asset.name),+ albumId: Value(entry.key),+ checksum: Value(asset.checksum),+ type: Value(asset.type),+ width: Value(asset.width),+ height: Value(asset.height),+ durationInSeconds: Value(asset.durationInSeconds),+ isFavorite: Value(asset.isFavorite),+ orientation: Value(asset.orientation),+ createdAt: Value(asset.createdAt),+ updatedAt: Value(asset.updatedAt),+ ),+ );+ }+ }++ await _db.transaction(() async {+ for (final companion in companions) {+ await _db.into(_db.trashedLocalAssetEntity).insertOnConflictUpdate(companion);+ }++ for (final slice in idToDelete.slices(kDriftMaxChunk)) {+ await (_db.delete(_db.localAssetEntity)..where((t) => t.id.isIn(slice))).go();+ }+ });+ }++ Future<void> applyRestoredAssets(List<String> idList) async {+ if (idList.isEmpty) {+ return;+ }++ final trashedAssets = <TrashedLocalAssetEntityData>[];++ for (final slice in idList.slices(kDriftMaxChunk)) {+ final q = _db.select(_db.trashedLocalAssetEntity)..where((t) => t.id.isIn(slice));+ trashedAssets.addAll(await q.get());+ }++ if (trashedAssets.isEmpty) {+ return;+ }++ final companions = trashedAssets.map((e) {+ return LocalAssetEntityCompanion.insert(+ id: e.id,+ name: e.name,+ type: e.type,+ createdAt: Value(e.createdAt),+ updatedAt: Value(e.updatedAt),+ width: Value(e.width),+ height: Value(e.height),+ durationInSeconds: Value(e.durationInSeconds),+ checksum: Value(e.checksum),+ isFavorite: Value(e.isFavorite),+ orientation: Value(e.orientation),+ );+ });++ await _db.transaction(() async {+ for (final companion in companions) {+ await _db.into(_db.localAssetEntity).insertOnConflictUpdate(companion);+ }+ for (final slice in idList.slices(kDriftMaxChunk)) {+ await (_db.delete(_db.trashedLocalAssetEntity)..where((t) => t.id.isIn(slice))).go();+ }+ });+ }++ Future<Map<String, List<LocalAsset>>> getToTrash() async {+ final result = <String, List<LocalAsset>>{};++ final rows =+ await (_db.select(_db.localAlbumAssetEntity).join([+ innerJoin(_db.localAlbumEntity, _db.localAlbumAssetEntity.albumId.equalsExp(_db.localAlbumEntity.id)),+ innerJoin(_db.localAssetEntity, _db.localAlbumAssetEntity.assetId.equalsExp(_db.localAssetEntity.id)),+ leftOuterJoin(+ _db.remoteAssetEntity,+ _db.remoteAssetEntity.checksum.equalsExp(_db.localAssetEntity.checksum),+ ),+ ])..where(+ _db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected) &+ _db.remoteAssetEntity.deletedAt.isNotNull(),+ ))+ .get();++ for (final row in rows) {+ final albumId = row.readTable(_db.localAlbumAssetEntity).albumId;+ final asset = row.readTable(_db.localAssetEntity).toDto();+ (result[albumId] ??= <LocalAsset>[]).add(asset);+ }++ return result;+ }++ //attempt to reuse existing checksums+ Future<Map<String, String>> _getCachedChecksums(Set<String> assetIds) async {+ final localChecksumById = <String, String>{};++ for (final slice in assetIds.slices(kDriftMaxChunk)) {+ final rows =+ await (_db.selectOnly(_db.localAssetEntity)+ ..where(_db.localAssetEntity.id.isIn(slice) & _db.localAssetEntity.checksum.isNotNull())+ ..addColumns([_db.localAssetEntity.id, _db.localAssetEntity.checksum]))+ .get();++ for (final r in rows) {+ localChecksumById[r.read(_db.localAssetEntity.id)!] = r.read(_db.localAssetEntity.checksum)!;+ }+ }++ return localChecksumById;+ }+}diff --git a/mobile/lib/platform/native_sync_api.g.dart b/mobile/lib/platform/native_sync_api.g.dartindex 8e4b900292..34ed7a5e2b 100644--- a/mobile/lib/platform/native_sync_api.g.dart+++ b/mobile/lib/platform/native_sync_api.g.dart@@ -562,4 +562,32 @@ class NativeSyncApi {return;}}++ Future<Map<String, List<PlatformAsset>>> getTrashedAssets() async {+ final String pigeonVar_channelName =+ 'dev.flutter.pigeon.immich_mobile.NativeSyncApi.getTrashedAssets$pigeonVar_messageChannelSuffix';+ final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(+ pigeonVar_channelName,+ pigeonChannelCodec,+ binaryMessenger: pigeonVar_binaryMessenger,+ );+ final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);+ final List<Object?>? pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;+ if (pigeonVar_replyList == null) {+ throw _createConnectionError(pigeonVar_channelName);+ } else if (pigeonVar_replyList.length > 1) {+ throw PlatformException(+ code: pigeonVar_replyList[0]! as String,+ message: pigeonVar_replyList[1] as String?,+ details: pigeonVar_replyList[2],+ );+ } else if (pigeonVar_replyList[0] == null) {+ throw PlatformException(+ code: 'null-error',+ message: 'Host platform returned null value for non-null return value.',+ );+ } else {+ return (pigeonVar_replyList[0] as Map<Object?, Object?>?)!.cast<String, List<PlatformAsset>>();+ }+ }}diff --git a/mobile/lib/providers/infrastructure/asset.provider.dart b/mobile/lib/providers/infrastructure/asset.provider.dartindex 4b51ce33bd..70cb200bf1 100644--- a/mobile/lib/providers/infrastructure/asset.provider.dart+++ b/mobile/lib/providers/infrastructure/asset.provider.dart@@ -2,6 +2,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';import 'package:immich_mobile/domain/services/asset.service.dart';import 'package:immich_mobile/infrastructure/repositories/local_asset.repository.dart';import 'package:immich_mobile/infrastructure/repositories/remote_asset.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/trashed_local_asset.repository.dart';import 'package:immich_mobile/providers/infrastructure/db.provider.dart';import 'package:immich_mobile/providers/user.provider.dart';@@ -13,6 +14,10 @@ final remoteAssetRepositoryProvider = Provider<RemoteAssetRepository>((ref) => RemoteAssetRepository(ref.watch(driftProvider)),);+final trashedLocalAssetRepository = Provider<DriftTrashedLocalAssetRepository>(+ (ref) => DriftTrashedLocalAssetRepository(ref.watch(driftProvider)),+);+final assetServiceProvider = Provider((ref) => AssetService(remoteAssetRepository: ref.watch(remoteAssetRepositoryProvider),diff --git a/mobile/lib/providers/infrastructure/sync.provider.dart b/mobile/lib/providers/infrastructure/sync.provider.dartindex f03754505c..6ba9c4bb78 100644--- a/mobile/lib/providers/infrastructure/sync.provider.dart+++ b/mobile/lib/providers/infrastructure/sync.provider.dart@@ -10,11 +10,17 @@ import 'package:immich_mobile/providers/infrastructure/asset.provider.dart';import 'package:immich_mobile/providers/infrastructure/cancel.provider.dart';import 'package:immich_mobile/providers/infrastructure/db.provider.dart';import 'package:immich_mobile/providers/infrastructure/platform.provider.dart';+import 'package:immich_mobile/providers/infrastructure/storage.provider.dart';+import 'package:immich_mobile/repositories/local_files_manager.repository.dart';final syncStreamServiceProvider = Provider((ref) => SyncStreamService(syncApiRepository: ref.watch(syncApiRepositoryProvider),syncStreamRepository: ref.watch(syncStreamRepositoryProvider),+ localAssetRepository: ref.watch(localAssetRepository),+ trashedLocalAssetRepository: ref.watch(trashedLocalAssetRepository),+ localFilesManager: ref.watch(localFilesManagerRepositoryProvider),+ storageRepository: ref.watch(storageRepositoryProvider),cancelChecker: ref.watch(cancellationProvider),),);@@ -26,6 +32,9 @@ final syncStreamRepositoryProvider = Provider((ref) => SyncStreamRepository(ref.final localSyncServiceProvider = Provider((ref) => LocalSyncService(localAlbumRepository: ref.watch(localAlbumRepository),+ trashedLocalAssetRepository: ref.watch(trashedLocalAssetRepository),+ localFilesManager: ref.watch(localFilesManagerRepositoryProvider),+ storageRepository: ref.watch(storageRepositoryProvider),nativeSyncApi: ref.watch(nativeSyncApiProvider),),);@@ -35,5 +44,6 @@ final hashServiceProvider = Provider(localAlbumRepository: ref.watch(localAlbumRepository),localAssetRepository: ref.watch(localAssetRepository),nativeSyncApi: ref.watch(nativeSyncApiProvider),+ trashedLocalAssetRepository: ref.watch(trashedLocalAssetRepository),),);diff --git a/mobile/lib/providers/infrastructure/trash_sync.provider.dart b/mobile/lib/providers/infrastructure/trash_sync.provider.dartnew file mode 100644index 0000000000..a783080f33--- /dev/null+++ b/mobile/lib/providers/infrastructure/trash_sync.provider.dart@@ -0,0 +1,12 @@+import 'package:async/async.dart';+import 'package:hooks_riverpod/hooks_riverpod.dart';+import 'package:immich_mobile/providers/infrastructure/asset.provider.dart';++typedef TrashedAssetsCount = ({int total, int hashed});++final trashedAssetsCountProvider = StreamProvider<TrashedAssetsCount>((ref) {+ final repo = ref.watch(trashedLocalAssetRepository);+ final total$ = repo.watchCount();+ final hashed$ = repo.watchHashedCount();+ return StreamZip<int>([total$, hashed$]).map((values) => (total: values[0], hashed: values[1]));+});diff --git a/mobile/lib/providers/trash.provider.dart b/mobile/lib/providers/trash.provider.dartindex adf3b1027b..41b9160b9b 100644--- a/mobile/lib/providers/trash.provider.dart+++ b/mobile/lib/providers/trash.provider.dart@@ -1,6 +1,6 @@import 'package:hooks_riverpod/hooks_riverpod.dart';-import 'package:immich_mobile/services/trash.service.dart';import 'package:immich_mobile/entities/asset.entity.dart';+import 'package:immich_mobile/services/trash.service.dart';import 'package:logging/logging.dart';class TrashNotifier extends StateNotifier<bool> {diff --git a/mobile/lib/repositories/local_files_manager.repository.dart b/mobile/lib/repositories/local_files_manager.repository.dartindex 519d79b49b..765c9a6f0e 100644--- a/mobile/lib/repositories/local_files_manager.repository.dart+++ b/mobile/lib/repositories/local_files_manager.repository.dart@@ -1,13 +1,16 @@import 'package:hooks_riverpod/hooks_riverpod.dart';+import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';import 'package:immich_mobile/services/local_files_manager.service.dart';+import 'package:logging/logging.dart';final localFilesManagerRepositoryProvider = Provider((ref) => LocalFilesManagerRepository(ref.watch(localFileManagerServiceProvider)),);class LocalFilesManagerRepository {- const LocalFilesManagerRepository(this._service);+ LocalFilesManagerRepository(this._service);+ final Logger _logger = Logger('SyncStreamService');final LocalFilesManagerService _service;Future<bool> moveToTrash(List<String> mediaUrls) async {@@ -21,4 +24,26 @@ class LocalFilesManagerRepository {Future<bool> requestManageMediaPermission() async {return await _service.requestManageMediaPermission();}++ Future<bool> hasManageMediaPermission() async {+ return await _service.hasManageMediaPermission();+ }++ Future<bool> manageMediaPermission() async {+ return await _service.manageMediaPermission();+ }++ Future<List<String>> restoreAssetsFromTrash(Iterable<LocalAsset> assets) async {+ final restoredIds = <String>[];+ for (final asset in assets) {+ _logger.info("Restoring from trash, localId: ${asset.id}, remoteId: ${asset.checksum}");+ try {+ await _service.restoreFromTrashById(asset.id, asset.type.index);+ restoredIds.add(asset.id);+ } catch (e) {+ _logger.warning("Restoring failure: $e");+ }+ }+ return restoredIds;+ }}diff --git a/mobile/lib/services/local_files_manager.service.dart b/mobile/lib/services/local_files_manager.service.dartindex 7cb3067342..0cc00f3e4b 100644--- a/mobile/lib/services/local_files_manager.service.dart+++ b/mobile/lib/services/local_files_manager.service.dart@@ -6,6 +6,7 @@ final localFileManagerServiceProvider = Provider<LocalFilesManagerService>((ref)class LocalFilesManagerService {const LocalFilesManagerService();+static final Logger _logger = Logger('LocalFilesManager');static const MethodChannel _channel = MethodChannel('file_trash');@@ -27,6 +28,15 @@ class LocalFilesManagerService {}}+ Future<bool> restoreFromTrashById(String mediaId, int type) async {+ try {+ return await _channel.invokeMethod('restoreFromTrash', {'mediaId': mediaId, 'type': type});+ } catch (e, s) {+ _logger.warning('Error restore file from trash by Id', e, s);+ return false;+ }+ }+Future<bool> requestManageMediaPermission() async {try {return await _channel.invokeMethod('requestManageMediaPermission');@@ -35,4 +45,22 @@ class LocalFilesManagerService {return false;}}++ Future<bool> hasManageMediaPermission() async {+ try {+ return await _channel.invokeMethod('hasManageMediaPermission');+ } catch (e, s) {+ _logger.warning('Error requesting manage media permission state', e, s);+ return false;+ }+ }++ Future<bool> manageMediaPermission() async {+ try {+ return await _channel.invokeMethod('manageMediaPermission');+ } catch (e, s) {+ _logger.warning('Error requesting manage media permission settings', e, s);+ return false;+ }+ }}diff --git a/mobile/lib/widgets/forms/login/login_form.dart b/mobile/lib/widgets/forms/login/login_form.dartindex bb987d5bc0..f810973298 100644--- a/mobile/lib/widgets/forms/login/login_form.dart+++ b/mobile/lib/widgets/forms/login/login_form.dart@@ -21,6 +21,7 @@ import 'package:immich_mobile/providers/gallery_permission.provider.dart';import 'package:immich_mobile/providers/oauth.provider.dart';import 'package:immich_mobile/providers/server_info.provider.dart';import 'package:immich_mobile/providers/websocket.provider.dart';+import 'package:immich_mobile/repositories/local_files_manager.repository.dart';import 'package:immich_mobile/routing/router.dart';import 'package:immich_mobile/utils/provider_utils.dart';import 'package:immich_mobile/utils/url_helper.dart';@@ -177,6 +178,55 @@ class LoginForm extends HookConsumerWidget {}}+ getManageMediaPermission() async {+ final hasPermission = await ref.read(localFilesManagerRepositoryProvider).hasManageMediaPermission();+ if (!hasPermission) {+ await showDialog(+ context: context,+ builder: (BuildContext context) {+ return AlertDialog(+ shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10))),+ elevation: 5,+ title: Text(+ 'manage_media_access_title',+ style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: context.primaryColor),+ ).tr(),+ content: SingleChildScrollView(+ child: ListBody(+ children: [+ const Text('manage_media_access_subtitle', style: TextStyle(fontSize: 14)).tr(),+ const SizedBox(height: 4),+ const Text('manage_media_access_rationale', style: TextStyle(fontSize: 12)).tr(),+ ],+ ),+ ),+ actions: [+ TextButton(+ onPressed: () => Navigator.of(context).pop(),+ child: Text(+ 'cancel'.tr(),+ style: TextStyle(fontWeight: FontWeight.w600, color: context.primaryColor),+ ),+ ),+ TextButton(+ onPressed: () {+ ref.read(localFilesManagerRepositoryProvider).requestManageMediaPermission();+ Navigator.of(context).pop();+ },+ child: Text(+ 'manage_media_access_settings'.tr(),+ style: TextStyle(fontWeight: FontWeight.w600, color: context.primaryColor),+ ),+ ),+ ],+ );+ },+ );+ }+ }++ bool isSyncRemoteDeletionsMode() => Platform.isAndroid && Store.get(StoreKey.manageLocalMediaAndroid, false);+login() async {TextInput.finishAutofillContext();@@ -194,6 +244,9 @@ class LoginForm extends HookConsumerWidget {final isBeta = Store.isBetaTimelineEnabled;if (isBeta) {await ref.read(galleryPermissionNotifier.notifier).requestGalleryPermission();+ if (isSyncRemoteDeletionsMode()) {+ await getManageMediaPermission();+ }unawaited(handleSyncFlow());ref.read(websocketProvider.notifier).connect();unawaited(context.replaceRoute(const TabShellRoute()));@@ -293,6 +346,9 @@ class LoginForm extends HookConsumerWidget {}if (isBeta) {await ref.read(galleryPermissionNotifier.notifier).requestGalleryPermission();+ if (isSyncRemoteDeletionsMode()) {+ await getManageMediaPermission();+ }unawaited(handleSyncFlow());unawaited(context.replaceRoute(const TabShellRoute()));return;diff --git a/mobile/lib/widgets/settings/advanced_settings.dart b/mobile/lib/widgets/settings/advanced_settings.dartindex 9255a7ae52..aee28c9449 100644--- a/mobile/lib/widgets/settings/advanced_settings.dart+++ b/mobile/lib/widgets/settings/advanced_settings.dart@@ -8,8 +8,8 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';import 'package:immich_mobile/domain/services/log.service.dart';import 'package:immich_mobile/entities/store.entity.dart';import 'package:immich_mobile/extensions/build_context_extensions.dart';-import 'package:immich_mobile/providers/user.provider.dart';import 'package:immich_mobile/providers/infrastructure/readonly_mode.provider.dart';+import 'package:immich_mobile/providers/user.provider.dart';import 'package:immich_mobile/repositories/local_files_manager.repository.dart';import 'package:immich_mobile/services/app_settings.service.dart';import 'package:immich_mobile/utils/hooks/app_settings_update_hook.dart';@@ -17,6 +17,7 @@ import 'package:immich_mobile/utils/http_ssl_options.dart';import 'package:immich_mobile/widgets/settings/beta_timeline_list_tile.dart';import 'package:immich_mobile/widgets/settings/custom_proxy_headers_settings/custom_proxy_headers_settings.dart';import 'package:immich_mobile/widgets/settings/local_storage_settings.dart';+import 'package:immich_mobile/widgets/settings/settings_action_tile.dart';import 'package:immich_mobile/widgets/settings/settings_slider_list_tile.dart';import 'package:immich_mobile/widgets/settings/settings_sub_page_scaffold.dart';import 'package:immich_mobile/widgets/settings/settings_switch_list_tile.dart';@@ -25,12 +26,15 @@ import 'package:logging/logging.dart';class AdvancedSettings extends HookConsumerWidget {const AdvancedSettings({super.key});+@overrideWidget build(BuildContext context, WidgetRef ref) {bool isLoggedIn = ref.read(currentUserProvider) != null;final advancedTroubleshooting = useAppSettingsState(AppSettingsEnum.advancedTroubleshooting);final manageLocalMediaAndroid = useAppSettingsState(AppSettingsEnum.manageLocalMediaAndroid);+ final isManageMediaSupported = useState(false);+ final manageMediaAndroidPermission = useState(false);final levelId = useAppSettingsState(AppSettingsEnum.logLevel);final preferRemote = useAppSettingsState(AppSettingsEnum.preferRemoteImage);final allowSelfSignedSSLCert = useAppSettingsState(AppSettingsEnum.allowSelfSignedSSLCert);@@ -51,6 +55,18 @@ class AdvancedSettings extends HookConsumerWidget {return false;}+ useEffect(() {+ () async {+ isManageMediaSupported.value = await checkAndroidVersion();+ if (isManageMediaSupported.value) {+ manageMediaAndroidPermission.value = await ref+ .read(localFilesManagerRepositoryProvider)+ .hasManageMediaPermission();+ }+ }();+ return null;+ }, []);+final advancedSettings = [SettingsSwitchListTile(enabled: true,@@ -58,11 +74,10 @@ class AdvancedSettings extends HookConsumerWidget {title: "advanced_settings_troubleshooting_title".tr(),subtitle: "advanced_settings_troubleshooting_subtitle".tr(),),- FutureBuilder<bool>(- future: checkAndroidVersion(),- builder: (context, snapshot) {- if (snapshot.hasData && snapshot.data == true) {- return SettingsSwitchListTile(+ if (isManageMediaSupported.value)+ Column(+ children: [+ SettingsSwitchListTile(enabled: true,valueNotifier: manageLocalMediaAndroid,title: "advanced_settings_sync_remote_deletions_title".tr(),@@ -71,14 +86,24 @@ class AdvancedSettings extends HookConsumerWidget {if (value) {final result = await ref.read(localFilesManagerRepositoryProvider).requestManageMediaPermission();manageLocalMediaAndroid.value = result;+ manageMediaAndroidPermission.value = result;}},- );- } else {- return const SizedBox.shrink();- }- },- ),+ ),+ SettingsActionTile(+ title: "manage_media_access_title".tr(),+ statusText: manageMediaAndroidPermission.value ? "allowed".tr() : "not_allowed".tr(),+ subtitle: "manage_media_access_rationale".tr(),+ statusColor: manageLocalMediaAndroid.value && !manageMediaAndroidPermission.value+ ? const Color.fromARGB(255, 243, 188, 106)+ : null,+ onActionTap: () async {+ final result = await ref.read(localFilesManagerRepositoryProvider).manageMediaPermission();+ manageMediaAndroidPermission.value = result;+ },+ ),+ ],+ ),SettingsSliderListTile(text: "advanced_settings_log_level_title".tr(namedArgs: {'level': logLevel}),valueNotifier: levelId,diff --git a/mobile/lib/widgets/settings/beta_sync_settings/sync_status_and_actions.dart b/mobile/lib/widgets/settings/beta_sync_settings/sync_status_and_actions.dartindex a5bca24f81..0296a6bd99 100644--- a/mobile/lib/widgets/settings/beta_sync_settings/sync_status_and_actions.dart+++ b/mobile/lib/widgets/settings/beta_sync_settings/sync_status_and_actions.dart@@ -3,14 +3,18 @@ import 'dart:io';import 'package:flutter/material.dart';import 'package:hooks_riverpod/hooks_riverpod.dart';import 'package:immich_mobile/extensions/build_context_extensions.dart';+import 'package:immich_mobile/extensions/platform_extensions.dart';import 'package:immich_mobile/extensions/translate_extensions.dart';+import 'package:immich_mobile/providers/app_settings.provider.dart';import 'package:immich_mobile/providers/background_sync.provider.dart';import 'package:immich_mobile/providers/infrastructure/album.provider.dart';import 'package:immich_mobile/providers/infrastructure/asset.provider.dart';import 'package:immich_mobile/providers/infrastructure/db.provider.dart';import 'package:immich_mobile/providers/infrastructure/memory.provider.dart';import 'package:immich_mobile/providers/infrastructure/storage.provider.dart';+import 'package:immich_mobile/providers/infrastructure/trash_sync.provider.dart';import 'package:immich_mobile/providers/sync_status.provider.dart';+import 'package:immich_mobile/services/app_settings.service.dart';import 'package:immich_mobile/widgets/settings/beta_sync_settings/entity_count_tile.dart';import 'package:path/path.dart' as path;import 'package:path_provider/path_provider.dart';@@ -229,6 +233,7 @@ class _SyncStatsCounts extends ConsumerWidget {final localAlbumService = ref.watch(localAlbumServiceProvider);final remoteAlbumService = ref.watch(remoteAlbumServiceProvider);final memoryService = ref.watch(driftMemoryServiceProvider);+ final appSettingsService = ref.watch(appSettingsServiceProvider);Future<List<dynamic>> loadCounts() async {final assetCounts = assetService.getAssetCounts();@@ -351,6 +356,44 @@ class _SyncStatsCounts extends ConsumerWidget {],),),+ // To be removed once the experimental feature is stable+ if (CurrentPlatform.isAndroid &&+ appSettingsService.getSetting<bool>(AppSettingsEnum.manageLocalMediaAndroid)) ...[+ _SectionHeaderText(text: "trash".t(context: context)),+ Consumer(+ builder: (context, ref, _) {+ final counts = ref.watch(trashedAssetsCountProvider);+ return counts.when(+ data: (c) => Padding(+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),+ child: Flex(+ direction: Axis.horizontal,+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ spacing: 8.0,+ children: [+ Expanded(+ child: EntitiyCountTile(+ label: "local".t(context: context),+ count: c.total,+ icon: Icons.delete_outline,+ ),+ ),+ Expanded(+ child: EntitiyCountTile(+ label: "hashed_assets".t(context: context),+ count: c.hashed,+ icon: Icons.tag,+ ),+ ),+ ],+ ),+ ),+ loading: () => const CircularProgressIndicator(),+ error: (e, st) => Text('Error: $e'),+ );+ },+ ),+ ],],);},diff --git a/mobile/lib/widgets/settings/settings_action_tile.dart b/mobile/lib/widgets/settings/settings_action_tile.dartnew file mode 100644index 0000000000..b2b5988fa5--- /dev/null+++ b/mobile/lib/widgets/settings/settings_action_tile.dart@@ -0,0 +1,73 @@+import 'package:flutter/material.dart';+import 'package:immich_mobile/extensions/theme_extensions.dart';++class SettingsActionTile extends StatelessWidget {+ const SettingsActionTile({+ super.key,+ required this.title,+ required this.subtitle,+ required this.onActionTap,+ this.statusText,+ this.statusColor,+ this.contentPadding,+ this.titleStyle,+ this.subtitleStyle,+ });++ final String title;+ final String subtitle;+ final String? statusText;+ final Color? statusColor;+ final VoidCallback onActionTap;+ final EdgeInsets? contentPadding;+ final TextStyle? titleStyle;+ final TextStyle? subtitleStyle;++ @override+ Widget build(BuildContext context) {+ final theme = Theme.of(context);++ return ListTile(+ isThreeLine: true,+ onTap: onActionTap,+ titleAlignment: ListTileTitleAlignment.center,+ title: Row(+ children: [+ Expanded(+ child: Text(+ title,+ style: titleStyle ?? theme.textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w500, height: 1.5),+ ),+ ),+ if (statusText != null)+ Padding(+ padding: const EdgeInsets.only(left: 8),+ child: Chip(+ label: Text(+ statusText!,+ style: theme.textTheme.labelMedium?.copyWith(+ color: statusColor ?? theme.colorScheme.onSurfaceVariant,+ ),+ ),+ backgroundColor: theme.colorScheme.surface,+ side: BorderSide(color: statusColor ?? theme.colorScheme.outlineVariant),+ shape: StadiumBorder(side: BorderSide(color: statusColor ?? theme.colorScheme.outlineVariant)),+ materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,+ visualDensity: VisualDensity.compact,+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 0),+ ),+ ),+ ],+ ),+ subtitle: Padding(+ padding: const EdgeInsets.only(top: 4.0, right: 18.0),+ child: Text(+ subtitle,+ style: subtitleStyle ?? theme.textTheme.bodyMedium?.copyWith(color: theme.colorScheme.onSurfaceSecondary),+ ),+ ),+ trailing: Icon(Icons.arrow_forward_ios, size: 16, color: theme.colorScheme.onSurfaceVariant),+ contentPadding: contentPadding ?? const EdgeInsets.symmetric(horizontal: 20.0, vertical: 8.0),+ );+ }+}diff --git a/mobile/pigeon/native_sync_api.dart b/mobile/pigeon/native_sync_api.dartindex ac08a68ca3..822e2eddb3 100644--- a/mobile/pigeon/native_sync_api.dart+++ b/mobile/pigeon/native_sync_api.dart@@ -14,8 +14,10 @@ import 'package:pigeon/pigeon.dart';class PlatformAsset {final String id;final String name;+// Follows AssetType enum from base_asset.model.dartfinal int type;+// Seconds since epochfinal int? createdAt;final int? updatedAt;@@ -42,6 +44,7 @@ class PlatformAsset {class PlatformAlbum {final String id;final String name;+// Seconds since epochfinal int? updatedAt;final bool isCloud;@@ -60,6 +63,7 @@ class SyncDelta {final bool hasChanges;final List<PlatformAsset> updates;final List<String> deletes;+// Asset -> Album mappingfinal Map<String, List<String>> assetAlbums;@@ -107,4 +111,7 @@ abstract class NativeSyncApi {List<HashResult> hashAssets(List<String> assetIds, {bool allowNetworkAccess = false});void cancelHashing();++ @TaskQueue(type: TaskQueueType.serialBackgroundThread)+ Map<String, List<PlatformAsset>> getTrashedAssets();}diff --git a/mobile/test/domain/service.mock.dart b/mobile/test/domain/service.mock.dartindex 8293faf125..0bab675889 100644--- a/mobile/test/domain/service.mock.dart+++ b/mobile/test/domain/service.mock.dart@@ -17,3 +17,4 @@ class MockNativeSyncApi extends Mock implements NativeSyncApi {}class MockAppSettingsService extends Mock implements AppSettingsService {}class MockUploadService extends Mock implements UploadService {}+diff --git a/mobile/test/domain/services/hash_service_test.dart b/mobile/test/domain/services/hash_service_test.dartindex 20d60b6866..3529ecca38 100644--- a/mobile/test/domain/services/hash_service_test.dart+++ b/mobile/test/domain/services/hash_service_test.dart@@ -14,16 +14,19 @@ void main() {late MockLocalAlbumRepository mockAlbumRepo;late MockLocalAssetRepository mockAssetRepo;late MockNativeSyncApi mockNativeApi;+ late MockTrashedLocalAssetRepository mockTrashedAssetRepo;setUp(() {mockAlbumRepo = MockLocalAlbumRepository();mockAssetRepo = MockLocalAssetRepository();mockNativeApi = MockNativeSyncApi();+ mockTrashedAssetRepo = MockTrashedLocalAssetRepository();sut = HashService(localAlbumRepository: mockAlbumRepo,localAssetRepository: mockAssetRepo,nativeSyncApi: mockNativeApi,+ trashedLocalAssetRepository: mockTrashedAssetRepo,);registerFallbackValue(LocalAlbumStub.recent);@@ -114,6 +117,7 @@ void main() {localAssetRepository: mockAssetRepo,nativeSyncApi: mockNativeApi,batchSize: batchSize,+ trashedLocalAssetRepository: mockTrashedAssetRepo,);final album = LocalAlbumStub.recent;@@ -186,4 +190,5 @@ void main() {verify(() => mockNativeApi.hashAssets([asset2.id], allowNetworkAccess: false)).called(1);});});+}diff --git a/mobile/test/domain/services/local_sync_service_test.dart b/mobile/test/domain/services/local_sync_service_test.dartnew file mode 100644index 0000000000..2f236971e0--- /dev/null+++ b/mobile/test/domain/services/local_sync_service_test.dart@@ -0,0 +1,190 @@+import 'package:drift/drift.dart' as drift;+import 'package:drift/native.dart';+import 'package:flutter/foundation.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';+import 'package:immich_mobile/domain/models/store.model.dart';+import 'package:immich_mobile/domain/services/local_sync.service.dart';+import 'package:immich_mobile/domain/services/store.service.dart';+import 'package:immich_mobile/entities/store.entity.dart';+import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/storage.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/store.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/trashed_local_asset.repository.dart';+import 'package:immich_mobile/platform/native_sync_api.g.dart';+import 'package:immich_mobile/repositories/local_files_manager.repository.dart';+import 'package:mocktail/mocktail.dart';++import '../../domain/service.mock.dart';+import '../../fixtures/asset.stub.dart';+import '../../infrastructure/repository.mock.dart';+import '../../mocks/asset_entity.mock.dart';+import '../../repository.mocks.dart';++void main() {+ late LocalSyncService sut;+ late DriftLocalAlbumRepository mockLocalAlbumRepository;+ late DriftTrashedLocalAssetRepository mockTrashedLocalAssetRepository;+ late LocalFilesManagerRepository mockLocalFilesManager;+ late StorageRepository mockStorageRepository;+ late MockNativeSyncApi mockNativeSyncApi;+ late Drift db;++ setUpAll(() async {+ TestWidgetsFlutterBinding.ensureInitialized();+ debugDefaultTargetPlatformOverride = TargetPlatform.android;++ db = Drift(drift.DatabaseConnection(NativeDatabase.memory(), closeStreamsSynchronously: true));+ await StoreService.init(storeRepository: DriftStoreRepository(db));+ });++ tearDownAll(() async {+ debugDefaultTargetPlatformOverride = null;+ await Store.clear();+ await db.close();+ });++ setUp(() async {+ mockLocalAlbumRepository = MockLocalAlbumRepository();+ mockTrashedLocalAssetRepository = MockTrashedLocalAssetRepository();+ mockLocalFilesManager = MockLocalFilesManagerRepository();+ mockStorageRepository = MockStorageRepository();+ mockNativeSyncApi = MockNativeSyncApi();++ when(() => mockNativeSyncApi.shouldFullSync()).thenAnswer((_) async => false);+ when(() => mockNativeSyncApi.getMediaChanges()).thenAnswer(+ (_) async => SyncDelta(+ hasChanges: false,+ updates: const [],+ deletes: const [],+ assetAlbums: const {},+ ),+ );+ when(() => mockNativeSyncApi.getTrashedAssets()).thenAnswer((_) async => {});+ when(() => mockTrashedLocalAssetRepository.processTrashSnapshot(any())).thenAnswer((_) async {});+ when(() => mockTrashedLocalAssetRepository.getToRestore()).thenAnswer((_) async => []);+ when(() => mockTrashedLocalAssetRepository.getToTrash()).thenAnswer((_) async => {});+ when(() => mockTrashedLocalAssetRepository.applyRestoredAssets(any())).thenAnswer((_) async {});+ when(() => mockTrashedLocalAssetRepository.trashLocalAsset(any())).thenAnswer((_) async {});+ when(() => mockLocalFilesManager.moveToTrash(any<List<String>>())).thenAnswer((_) async => true);++ sut = LocalSyncService(+ localAlbumRepository: mockLocalAlbumRepository,+ trashedLocalAssetRepository: mockTrashedLocalAssetRepository,+ localFilesManager: mockLocalFilesManager,+ storageRepository: mockStorageRepository,+ nativeSyncApi: mockNativeSyncApi,+ );++ await Store.put(StoreKey.manageLocalMediaAndroid, false);+ when(() => mockLocalFilesManager.hasManageMediaPermission()).thenAnswer((_) async => false);+ });++ group('LocalSyncService - syncTrashedAssets gating', () {+ test('invokes syncTrashedAssets when Android flag enabled and permission granted', () async {+ await Store.put(StoreKey.manageLocalMediaAndroid, true);+ when(() => mockLocalFilesManager.hasManageMediaPermission()).thenAnswer((_) async => true);++ await sut.sync();++ verify(() => mockNativeSyncApi.getTrashedAssets()).called(1);+ verify(() => mockTrashedLocalAssetRepository.processTrashSnapshot(any())).called(1);+ });++ test('skips syncTrashedAssets when store flag disabled', () async {+ await Store.put(StoreKey.manageLocalMediaAndroid, false);+ when(() => mockLocalFilesManager.hasManageMediaPermission()).thenAnswer((_) async => true);++ await sut.sync();++ verifyNever(() => mockNativeSyncApi.getTrashedAssets());+ });++ test('skips syncTrashedAssets when MANAGE_MEDIA permission absent', () async {+ await Store.put(StoreKey.manageLocalMediaAndroid, true);+ when(() => mockLocalFilesManager.hasManageMediaPermission()).thenAnswer((_) async => false);++ await sut.sync();++ verifyNever(() => mockNativeSyncApi.getTrashedAssets());+ });++ test('skips syncTrashedAssets on non-Android platforms', () async {+ debugDefaultTargetPlatformOverride = TargetPlatform.iOS;+ addTearDown(() => debugDefaultTargetPlatformOverride = TargetPlatform.android);++ await Store.put(StoreKey.manageLocalMediaAndroid, true);+ when(() => mockLocalFilesManager.hasManageMediaPermission()).thenAnswer((_) async => true);++ await sut.sync();++ verifyNever(() => mockNativeSyncApi.getTrashedAssets());+ });+ });++ group('LocalSyncService - syncTrashedAssets behavior', () {+ test('processes trashed snapshot, restores assets, and trashes local files', () async {+ final platformAsset = PlatformAsset(+ id: 'remote-id',+ name: 'remote.jpg',+ type: AssetType.image.index,+ durationInSeconds: 0,+ orientation: 0,+ isFavorite: false,+ );++ final assetsToRestore = [LocalAssetStub.image1];+ when(() => mockTrashedLocalAssetRepository.getToRestore()).thenAnswer((_) async => assetsToRestore);+ final restoredIds = ['image1'];+ when(() => mockLocalFilesManager.restoreAssetsFromTrash(any())).thenAnswer((invocation) async {+ final Iterable<LocalAsset> requested = invocation.positionalArguments.first as Iterable<LocalAsset>;+ expect(requested, orderedEquals(assetsToRestore));+ return restoredIds;+ });++ final localAssetToTrash = LocalAssetStub.image2.copyWith(id: 'local-trash', checksum: 'checksum-trash');+ when(() => mockTrashedLocalAssetRepository.getToTrash()).thenAnswer((_) async => {'album-a': [localAssetToTrash]});++ final assetEntity = MockAssetEntity();+ when(() => assetEntity.getMediaUrl()).thenAnswer((_) async => 'content://local-trash');+ when(() => mockStorageRepository.getAssetEntityForAsset(localAssetToTrash)).thenAnswer((_) async => assetEntity);++ await sut.processTrashedAssets({'album-a': [platformAsset]});++ verify(() => mockTrashedLocalAssetRepository.processTrashSnapshot(any())).called(1);+ verify(() => mockTrashedLocalAssetRepository.getToTrash()).called(1);++ verify(() => mockLocalFilesManager.restoreAssetsFromTrash(any())).called(1);+ verify(() => mockTrashedLocalAssetRepository.applyRestoredAssets(restoredIds)).called(1);++ verify(() => mockStorageRepository.getAssetEntityForAsset(localAssetToTrash)).called(1);+ final moveArgs =+ verify(() => mockLocalFilesManager.moveToTrash(captureAny())).captured.single as List<String>;+ expect(moveArgs, ['content://local-trash']);+ final trashArgs =+ verify(() => mockTrashedLocalAssetRepository.trashLocalAsset(captureAny())).captured.single+ as Map<String, List<LocalAsset>>;+ expect(trashArgs.keys, ['album-a']);+ expect(trashArgs['album-a'], [localAssetToTrash]);+ });++ test('does not attempt restore when repository has no assets to restore', () async {+ when(() => mockTrashedLocalAssetRepository.getToRestore()).thenAnswer((_) async => []);++ await sut.processTrashedAssets({});++ verifyNever(() => mockLocalFilesManager.restoreAssetsFromTrash(any()));+ verifyNever(() => mockTrashedLocalAssetRepository.applyRestoredAssets(any()));+ });++ test('does not move local assets when repository finds nothing to trash', () async {+ when(() => mockTrashedLocalAssetRepository.getToTrash()).thenAnswer((_) async => {});++ await sut.processTrashedAssets({});++ verifyNever(() => mockLocalFilesManager.moveToTrash(any()));+ verifyNever(() => mockTrashedLocalAssetRepository.trashLocalAsset(any()));+ });+ });+}diff --git a/mobile/test/domain/services/sync_stream_service_test.dart b/mobile/test/domain/services/sync_stream_service_test.dartindex 0126b11e46..109b54a907 100644--- a/mobile/test/domain/services/sync_stream_service_test.dart+++ b/mobile/test/domain/services/sync_stream_service_test.dart@@ -1,14 +1,30 @@import 'dart:async';+import 'package:drift/drift.dart' as drift;+import 'package:drift/native.dart';+import 'package:flutter/foundation.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';+import 'package:immich_mobile/domain/models/store.model.dart';import 'package:immich_mobile/domain/models/sync_event.model.dart';+import 'package:immich_mobile/domain/services/store.service.dart';import 'package:immich_mobile/domain/services/sync_stream.service.dart';+import 'package:immich_mobile/entities/store.entity.dart';+import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/local_asset.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/storage.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/store.repository.dart';import 'package:immich_mobile/infrastructure/repositories/sync_api.repository.dart';import 'package:immich_mobile/infrastructure/repositories/sync_stream.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/trashed_local_asset.repository.dart';+import 'package:immich_mobile/repositories/local_files_manager.repository.dart';import 'package:mocktail/mocktail.dart';+import '../../fixtures/asset.stub.dart';import '../../fixtures/sync_stream.stub.dart';import '../../infrastructure/repository.mock.dart';+import '../../mocks/asset_entity.mock.dart';+import '../../repository.mocks.dart';class _AbortCallbackWrapper {const _AbortCallbackWrapper();@@ -30,15 +46,40 @@ void main() {late SyncStreamService sut;late SyncStreamRepository mockSyncStreamRepo;late SyncApiRepository mockSyncApiRepo;+ late DriftLocalAssetRepository mockLocalAssetRepo;+ late DriftTrashedLocalAssetRepository mockTrashedLocalAssetRepo;+ late LocalFilesManagerRepository mockLocalFilesManagerRepo;+ late StorageRepository mockStorageRepo;late Future<void> Function(List<SyncEvent>, Function(), Function()) handleEventsCallback;late _MockAbortCallbackWrapper mockAbortCallbackWrapper;late _MockAbortCallbackWrapper mockResetCallbackWrapper;+ late Drift db;+ late bool hasManageMediaPermission;++ setUpAll(() async {+ TestWidgetsFlutterBinding.ensureInitialized();+ debugDefaultTargetPlatformOverride = TargetPlatform.android;+ registerFallbackValue(LocalAssetStub.image1);++ db = Drift(drift.DatabaseConnection(NativeDatabase.memory(), closeStreamsSynchronously: true));+ await StoreService.init(storeRepository: DriftStoreRepository(db));+ });++ tearDownAll(() async {+ debugDefaultTargetPlatformOverride = null;+ await Store.clear();+ await db.close();+ });successHandler(Invocation _) async => true;- setUp(() {+ setUp(() async {mockSyncStreamRepo = MockSyncStreamRepository();mockSyncApiRepo = MockSyncApiRepository();+ mockLocalAssetRepo = MockLocalAssetRepository();+ mockTrashedLocalAssetRepo = MockTrashedLocalAssetRepository();+ mockLocalFilesManagerRepo = MockLocalFilesManagerRepository();+ mockStorageRepo = MockStorageRepository();mockAbortCallbackWrapper = _MockAbortCallbackWrapper();mockResetCallbackWrapper = _MockAbortCallbackWrapper();@@ -87,7 +128,25 @@ void main() {when(() => mockSyncStreamRepo.updateAssetFacesV1(any())).thenAnswer(successHandler);when(() => mockSyncStreamRepo.deleteAssetFacesV1(any())).thenAnswer(successHandler);- sut = SyncStreamService(syncApiRepository: mockSyncApiRepo, syncStreamRepository: mockSyncStreamRepo);+ sut = SyncStreamService(+ syncApiRepository: mockSyncApiRepo,+ syncStreamRepository: mockSyncStreamRepo,+ localAssetRepository: mockLocalAssetRepo,+ trashedLocalAssetRepository: mockTrashedLocalAssetRepo,+ localFilesManager: mockLocalFilesManagerRepo,+ storageRepository: mockStorageRepo,+ );++ when(() => mockLocalAssetRepo.getAssetsFromBackupAlbums(any())).thenAnswer((_) async => {});+ when(() => mockTrashedLocalAssetRepo.trashLocalAsset(any())).thenAnswer((_) async {});+ when(() => mockTrashedLocalAssetRepo.getToRestore()).thenAnswer((_) async => []);+ when(() => mockTrashedLocalAssetRepo.applyRestoredAssets(any())).thenAnswer((_) async {});+ hasManageMediaPermission = false;+ when(() => mockLocalFilesManagerRepo.hasManageMediaPermission()).thenAnswer((_) async => hasManageMediaPermission);+ when(() => mockLocalFilesManagerRepo.moveToTrash(any())).thenAnswer((_) async => true);+ when(() => mockLocalFilesManagerRepo.restoreAssetsFromTrash(any())).thenAnswer((_) async => []);+ when(() => mockStorageRepo.getAssetEntityForAsset(any())).thenAnswer((_) async => null);+ await Store.put(StoreKey.manageLocalMediaAndroid, false);});Future<void> simulateEvents(List<SyncEvent> events) async {@@ -152,6 +211,10 @@ void main() {sut = SyncStreamService(syncApiRepository: mockSyncApiRepo,syncStreamRepository: mockSyncStreamRepo,+ localAssetRepository: mockLocalAssetRepo,+ trashedLocalAssetRepository: mockTrashedLocalAssetRepo,+ localFilesManager: mockLocalFilesManagerRepo,+ storageRepository: mockStorageRepo,cancelChecker: cancellationChecker.call,);await sut.sync();@@ -187,6 +250,10 @@ void main() {sut = SyncStreamService(syncApiRepository: mockSyncApiRepo,syncStreamRepository: mockSyncStreamRepo,+ localAssetRepository: mockLocalAssetRepo,+ trashedLocalAssetRepository: mockTrashedLocalAssetRepo,+ localFilesManager: mockLocalFilesManagerRepo,+ storageRepository: mockStorageRepo,cancelChecker: cancellationChecker.call,);@@ -296,4 +363,127 @@ void main() {verify(() => mockSyncApiRepo.ack(["5"])).called(1);});});++ group("SyncStreamService - remote trash & restore", () {+ setUp(() async {+ await Store.put(StoreKey.manageLocalMediaAndroid, true);+ hasManageMediaPermission = true;+ });++ tearDown(() async {+ await Store.put(StoreKey.manageLocalMediaAndroid, false);+ hasManageMediaPermission = false;+ });++ test("moves backed up local and merged assets to device trash when remote trash events are received", () async {+ final localAsset = LocalAssetStub.image1.copyWith(id: 'local-only', checksum: 'checksum-local', remoteId: null);+ final mergedAsset = LocalAssetStub.image2.copyWith(+ id: 'merged-local',+ checksum: 'checksum-merged',+ remoteId: 'remote-merged',+ );+ final assetsByAlbum = {+ 'album-a': [localAsset],+ 'album-b': [mergedAsset],+ };+ when(() => mockLocalAssetRepo.getAssetsFromBackupAlbums(any())).thenAnswer((invocation) async {+ final Iterable<String> requestedChecksums = invocation.positionalArguments.first as Iterable<String>;+ expect(requestedChecksums.toSet(), equals({'checksum-local', 'checksum-merged', 'checksum-remote-only'}));+ return assetsByAlbum;+ });++ final localEntity = MockAssetEntity();+ when(() => localEntity.getMediaUrl()).thenAnswer((_) async => 'content://local-only');+ when(() => mockStorageRepo.getAssetEntityForAsset(localAsset)).thenAnswer((_) async => localEntity);++ final mergedEntity = MockAssetEntity();+ when(() => mergedEntity.getMediaUrl()).thenAnswer((_) async => 'content://merged-local');+ when(() => mockStorageRepo.getAssetEntityForAsset(mergedAsset)).thenAnswer((_) async => mergedEntity);++ when(() => mockLocalFilesManagerRepo.moveToTrash(any())).thenAnswer((invocation) async {+ final urls = invocation.positionalArguments.first as List<String>;+ expect(urls, unorderedEquals(['content://local-only', 'content://merged-local']));+ return true;+ });++ final events = [+ SyncStreamStub.assetTrashed(+ id: 'remote-1',+ checksum: localAsset.checksum!,+ ack: 'asset-remote-local-1',+ trashedAt: DateTime(2025, 5, 1),+ ),+ SyncStreamStub.assetTrashed(+ id: 'remote-2',+ checksum: mergedAsset.checksum!,+ ack: 'asset-remote-merged-2',+ trashedAt: DateTime(2025, 5, 2),+ ),+ SyncStreamStub.assetTrashed(+ id: 'remote-3',+ checksum: 'checksum-remote-only',+ ack: 'asset-remote-only-3',+ trashedAt: DateTime(2025, 5, 3),+ ),+ ];++ await simulateEvents(events);++ verify(() => mockTrashedLocalAssetRepo.trashLocalAsset(assetsByAlbum)).called(1);+ verify(() => mockSyncApiRepo.ack(['asset-remote-only-3'])).called(1);+ });++ test("skips device trashing when no local assets match the remote trash payload", () async {+ final events = [+ SyncStreamStub.assetTrashed(+ id: 'remote-only',+ checksum: 'checksum-only',+ ack: 'asset-remote-only-9',+ trashedAt: DateTime(2025, 6, 1),+ ),+ ];++ await simulateEvents(events);++ verify(() => mockLocalAssetRepo.getAssetsFromBackupAlbums(any())).called(1);+ verifyNever(() => mockLocalFilesManagerRepo.moveToTrash(any()));+ verifyNever(() => mockTrashedLocalAssetRepo.trashLocalAsset(any()));+ });++ test("does not request local deletions for permanent remote delete events", () async {+ final events = [SyncStreamStub.assetDeleteV1];++ await simulateEvents(events);++ verifyNever(() => mockLocalAssetRepo.getAssetsFromBackupAlbums(any()));+ verifyNever(() => mockLocalFilesManagerRepo.moveToTrash(any()));+ verify(() => mockSyncStreamRepo.deleteAssetsV1(any())).called(1);+ });++ test("restores trashed local assets once the matching remote assets leave the trash", () async {+ final trashedAssets = [+ LocalAssetStub.image1.copyWith(id: 'trashed-1', checksum: 'checksum-trash', remoteId: 'remote-1'),+ ];+ when(() => mockTrashedLocalAssetRepo.getToRestore()).thenAnswer((_) async => trashedAssets);++ final restoredIds = ['trashed-1'];+ when(() => mockLocalFilesManagerRepo.restoreAssetsFromTrash(any())).thenAnswer((invocation) async {+ final Iterable<LocalAsset> requestedAssets = invocation.positionalArguments.first as Iterable<LocalAsset>;+ expect(requestedAssets, orderedEquals(trashedAssets));+ return restoredIds;+ });++ final events = [+ SyncStreamStub.assetModified(+ id: 'remote-1',+ checksum: 'checksum-trash',+ ack: 'asset-remote-1-11',+ ),+ ];++ await simulateEvents(events);++ verify(() => mockTrashedLocalAssetRepo.applyRestoredAssets(restoredIds)).called(1);+ });+ });}diff --git a/mobile/test/drift/main/generated/schema.dart b/mobile/test/drift/main/generated/schema.dartindex 073a86078f..69dff89fb1 100644--- a/mobile/test/drift/main/generated/schema.dart+++ b/mobile/test/drift/main/generated/schema.dart@@ -15,6 +15,7 @@ import 'schema_v9.dart' as v9;import 'schema_v10.dart' as v10;import 'schema_v11.dart' as v11;import 'schema_v12.dart' as v12;+import 'schema_v13.dart' as v13;class GeneratedHelper implements SchemaInstantiationHelper {@override@@ -44,10 +45,12 @@ class GeneratedHelper implements SchemaInstantiationHelper {return v11.DatabaseAtV11(db);case 12:return v12.DatabaseAtV12(db);+ case 13:+ return v13.DatabaseAtV13(db);default:throw MissingSchemaException(version, versions);}}- static const versions = const [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];+ static const versions = const [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];}diff --git a/mobile/test/drift/main/generated/schema_v13.dart b/mobile/test/drift/main/generated/schema_v13.dartnew file mode 100644index 0000000000..da0d853678--- /dev/null+++ b/mobile/test/drift/main/generated/schema_v13.dart@@ -0,0 +1,7765 @@+// dart format width=80+// GENERATED CODE, DO NOT EDIT BY HAND.+// ignore_for_file: type=lint+import 'package:drift/drift.dart';++class UserEntity extends Table with TableInfo<UserEntity, UserEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ UserEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> id = GeneratedColumn<String>(+ 'id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> name = GeneratedColumn<String>(+ 'name',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> email = GeneratedColumn<String>(+ 'email',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<bool> hasProfileImage = GeneratedColumn<bool>(+ 'has_profile_image',+ aliasedName,+ false,+ type: DriftSqlType.bool,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("has_profile_image" IN (0, 1))',+ ),+ defaultValue: const CustomExpression('0'),+ );+ late final GeneratedColumn<DateTime> profileChangedAt =+ GeneratedColumn<DateTime>(+ 'profile_changed_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<int> avatarColor = GeneratedColumn<int>(+ 'avatar_color',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('0'),+ );+ @override+ List<GeneratedColumn> get $columns => [+ id,+ name,+ email,+ hasProfileImage,+ profileChangedAt,+ avatarColor,+ ];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'user_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {id};+ @override+ UserEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return UserEntityData(+ id: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}id'],+ )!,+ name: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}name'],+ )!,+ email: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}email'],+ )!,+ hasProfileImage: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}has_profile_image'],+ )!,+ profileChangedAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}profile_changed_at'],+ )!,+ avatarColor: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}avatar_color'],+ )!,+ );+ }++ @override+ UserEntity createAlias(String alias) {+ return UserEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class UserEntityData extends DataClass implements Insertable<UserEntityData> {+ final String id;+ final String name;+ final String email;+ final bool hasProfileImage;+ final DateTime profileChangedAt;+ final int avatarColor;+ const UserEntityData({+ required this.id,+ required this.name,+ required this.email,+ required this.hasProfileImage,+ required this.profileChangedAt,+ required this.avatarColor,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['id'] = Variable<String>(id);+ map['name'] = Variable<String>(name);+ map['email'] = Variable<String>(email);+ map['has_profile_image'] = Variable<bool>(hasProfileImage);+ map['profile_changed_at'] = Variable<DateTime>(profileChangedAt);+ map['avatar_color'] = Variable<int>(avatarColor);+ return map;+ }++ factory UserEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return UserEntityData(+ id: serializer.fromJson<String>(json['id']),+ name: serializer.fromJson<String>(json['name']),+ email: serializer.fromJson<String>(json['email']),+ hasProfileImage: serializer.fromJson<bool>(json['hasProfileImage']),+ profileChangedAt: serializer.fromJson<DateTime>(json['profileChangedAt']),+ avatarColor: serializer.fromJson<int>(json['avatarColor']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'id': serializer.toJson<String>(id),+ 'name': serializer.toJson<String>(name),+ 'email': serializer.toJson<String>(email),+ 'hasProfileImage': serializer.toJson<bool>(hasProfileImage),+ 'profileChangedAt': serializer.toJson<DateTime>(profileChangedAt),+ 'avatarColor': serializer.toJson<int>(avatarColor),+ };+ }++ UserEntityData copyWith({+ String? id,+ String? name,+ String? email,+ bool? hasProfileImage,+ DateTime? profileChangedAt,+ int? avatarColor,+ }) => UserEntityData(+ id: id ?? this.id,+ name: name ?? this.name,+ email: email ?? this.email,+ hasProfileImage: hasProfileImage ?? this.hasProfileImage,+ profileChangedAt: profileChangedAt ?? this.profileChangedAt,+ avatarColor: avatarColor ?? this.avatarColor,+ );+ UserEntityData copyWithCompanion(UserEntityCompanion data) {+ return UserEntityData(+ id: data.id.present ? data.id.value : this.id,+ name: data.name.present ? data.name.value : this.name,+ email: data.email.present ? data.email.value : this.email,+ hasProfileImage: data.hasProfileImage.present+ ? data.hasProfileImage.value+ : this.hasProfileImage,+ profileChangedAt: data.profileChangedAt.present+ ? data.profileChangedAt.value+ : this.profileChangedAt,+ avatarColor: data.avatarColor.present+ ? data.avatarColor.value+ : this.avatarColor,+ );+ }++ @override+ String toString() {+ return (StringBuffer('UserEntityData(')+ ..write('id: $id, ')+ ..write('name: $name, ')+ ..write('email: $email, ')+ ..write('hasProfileImage: $hasProfileImage, ')+ ..write('profileChangedAt: $profileChangedAt, ')+ ..write('avatarColor: $avatarColor')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(+ id,+ name,+ email,+ hasProfileImage,+ profileChangedAt,+ avatarColor,+ );+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is UserEntityData &&+ other.id == this.id &&+ other.name == this.name &&+ other.email == this.email &&+ other.hasProfileImage == this.hasProfileImage &&+ other.profileChangedAt == this.profileChangedAt &&+ other.avatarColor == this.avatarColor);+}++class UserEntityCompanion extends UpdateCompanion<UserEntityData> {+ final Value<String> id;+ final Value<String> name;+ final Value<String> email;+ final Value<bool> hasProfileImage;+ final Value<DateTime> profileChangedAt;+ final Value<int> avatarColor;+ const UserEntityCompanion({+ this.id = const Value.absent(),+ this.name = const Value.absent(),+ this.email = const Value.absent(),+ this.hasProfileImage = const Value.absent(),+ this.profileChangedAt = const Value.absent(),+ this.avatarColor = const Value.absent(),+ });+ UserEntityCompanion.insert({+ required String id,+ required String name,+ required String email,+ this.hasProfileImage = const Value.absent(),+ this.profileChangedAt = const Value.absent(),+ this.avatarColor = const Value.absent(),+ }) : id = Value(id),+ name = Value(name),+ email = Value(email);+ static Insertable<UserEntityData> custom({+ Expression<String>? id,+ Expression<String>? name,+ Expression<String>? email,+ Expression<bool>? hasProfileImage,+ Expression<DateTime>? profileChangedAt,+ Expression<int>? avatarColor,+ }) {+ return RawValuesInsertable({+ if (id != null) 'id': id,+ if (name != null) 'name': name,+ if (email != null) 'email': email,+ if (hasProfileImage != null) 'has_profile_image': hasProfileImage,+ if (profileChangedAt != null) 'profile_changed_at': profileChangedAt,+ if (avatarColor != null) 'avatar_color': avatarColor,+ });+ }++ UserEntityCompanion copyWith({+ Value<String>? id,+ Value<String>? name,+ Value<String>? email,+ Value<bool>? hasProfileImage,+ Value<DateTime>? profileChangedAt,+ Value<int>? avatarColor,+ }) {+ return UserEntityCompanion(+ id: id ?? this.id,+ name: name ?? this.name,+ email: email ?? this.email,+ hasProfileImage: hasProfileImage ?? this.hasProfileImage,+ profileChangedAt: profileChangedAt ?? this.profileChangedAt,+ avatarColor: avatarColor ?? this.avatarColor,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (id.present) {+ map['id'] = Variable<String>(id.value);+ }+ if (name.present) {+ map['name'] = Variable<String>(name.value);+ }+ if (email.present) {+ map['email'] = Variable<String>(email.value);+ }+ if (hasProfileImage.present) {+ map['has_profile_image'] = Variable<bool>(hasProfileImage.value);+ }+ if (profileChangedAt.present) {+ map['profile_changed_at'] = Variable<DateTime>(profileChangedAt.value);+ }+ if (avatarColor.present) {+ map['avatar_color'] = Variable<int>(avatarColor.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('UserEntityCompanion(')+ ..write('id: $id, ')+ ..write('name: $name, ')+ ..write('email: $email, ')+ ..write('hasProfileImage: $hasProfileImage, ')+ ..write('profileChangedAt: $profileChangedAt, ')+ ..write('avatarColor: $avatarColor')+ ..write(')'))+ .toString();+ }+}++class RemoteAssetEntity extends Table+ with TableInfo<RemoteAssetEntity, RemoteAssetEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ RemoteAssetEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> name = GeneratedColumn<String>(+ 'name',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<int> type = GeneratedColumn<int>(+ 'type',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(+ 'created_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(+ 'updated_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<int> width = GeneratedColumn<int>(+ 'width',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<int> height = GeneratedColumn<int>(+ 'height',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<int> durationInSeconds = GeneratedColumn<int>(+ 'duration_in_seconds',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> id = GeneratedColumn<String>(+ 'id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> checksum = GeneratedColumn<String>(+ 'checksum',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<bool> isFavorite = GeneratedColumn<bool>(+ 'is_favorite',+ aliasedName,+ false,+ type: DriftSqlType.bool,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("is_favorite" IN (0, 1))',+ ),+ defaultValue: const CustomExpression('0'),+ );+ late final GeneratedColumn<String> ownerId = GeneratedColumn<String>(+ 'owner_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES user_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<DateTime> localDateTime =+ GeneratedColumn<DateTime>(+ 'local_date_time',+ aliasedName,+ true,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> thumbHash = GeneratedColumn<String>(+ 'thumb_hash',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(+ 'deleted_at',+ aliasedName,+ true,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> livePhotoVideoId = GeneratedColumn<String>(+ 'live_photo_video_id',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<int> visibility = GeneratedColumn<int>(+ 'visibility',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> stackId = GeneratedColumn<String>(+ 'stack_id',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> libraryId = GeneratedColumn<String>(+ 'library_id',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ @override+ List<GeneratedColumn> get $columns => [+ name,+ type,+ createdAt,+ updatedAt,+ width,+ height,+ durationInSeconds,+ id,+ checksum,+ isFavorite,+ ownerId,+ localDateTime,+ thumbHash,+ deletedAt,+ livePhotoVideoId,+ visibility,+ stackId,+ libraryId,+ ];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'remote_asset_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {id};+ @override+ RemoteAssetEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return RemoteAssetEntityData(+ name: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}name'],+ )!,+ type: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}type'],+ )!,+ createdAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}created_at'],+ )!,+ updatedAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}updated_at'],+ )!,+ width: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}width'],+ ),+ height: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}height'],+ ),+ durationInSeconds: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}duration_in_seconds'],+ ),+ id: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}id'],+ )!,+ checksum: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}checksum'],+ )!,+ isFavorite: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}is_favorite'],+ )!,+ ownerId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}owner_id'],+ )!,+ localDateTime: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}local_date_time'],+ ),+ thumbHash: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}thumb_hash'],+ ),+ deletedAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}deleted_at'],+ ),+ livePhotoVideoId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}live_photo_video_id'],+ ),+ visibility: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}visibility'],+ )!,+ stackId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}stack_id'],+ ),+ libraryId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}library_id'],+ ),+ );+ }++ @override+ RemoteAssetEntity createAlias(String alias) {+ return RemoteAssetEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class RemoteAssetEntityData extends DataClass+ implements Insertable<RemoteAssetEntityData> {+ final String name;+ final int type;+ final DateTime createdAt;+ final DateTime updatedAt;+ final int? width;+ final int? height;+ final int? durationInSeconds;+ final String id;+ final String checksum;+ final bool isFavorite;+ final String ownerId;+ final DateTime? localDateTime;+ final String? thumbHash;+ final DateTime? deletedAt;+ final String? livePhotoVideoId;+ final int visibility;+ final String? stackId;+ final String? libraryId;+ const RemoteAssetEntityData({+ required this.name,+ required this.type,+ required this.createdAt,+ required this.updatedAt,+ this.width,+ this.height,+ this.durationInSeconds,+ required this.id,+ required this.checksum,+ required this.isFavorite,+ required this.ownerId,+ this.localDateTime,+ this.thumbHash,+ this.deletedAt,+ this.livePhotoVideoId,+ required this.visibility,+ this.stackId,+ this.libraryId,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['name'] = Variable<String>(name);+ map['type'] = Variable<int>(type);+ map['created_at'] = Variable<DateTime>(createdAt);+ map['updated_at'] = Variable<DateTime>(updatedAt);+ if (!nullToAbsent || width != null) {+ map['width'] = Variable<int>(width);+ }+ if (!nullToAbsent || height != null) {+ map['height'] = Variable<int>(height);+ }+ if (!nullToAbsent || durationInSeconds != null) {+ map['duration_in_seconds'] = Variable<int>(durationInSeconds);+ }+ map['id'] = Variable<String>(id);+ map['checksum'] = Variable<String>(checksum);+ map['is_favorite'] = Variable<bool>(isFavorite);+ map['owner_id'] = Variable<String>(ownerId);+ if (!nullToAbsent || localDateTime != null) {+ map['local_date_time'] = Variable<DateTime>(localDateTime);+ }+ if (!nullToAbsent || thumbHash != null) {+ map['thumb_hash'] = Variable<String>(thumbHash);+ }+ if (!nullToAbsent || deletedAt != null) {+ map['deleted_at'] = Variable<DateTime>(deletedAt);+ }+ if (!nullToAbsent || livePhotoVideoId != null) {+ map['live_photo_video_id'] = Variable<String>(livePhotoVideoId);+ }+ map['visibility'] = Variable<int>(visibility);+ if (!nullToAbsent || stackId != null) {+ map['stack_id'] = Variable<String>(stackId);+ }+ if (!nullToAbsent || libraryId != null) {+ map['library_id'] = Variable<String>(libraryId);+ }+ return map;+ }++ factory RemoteAssetEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return RemoteAssetEntityData(+ name: serializer.fromJson<String>(json['name']),+ type: serializer.fromJson<int>(json['type']),+ createdAt: serializer.fromJson<DateTime>(json['createdAt']),+ updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),+ width: serializer.fromJson<int?>(json['width']),+ height: serializer.fromJson<int?>(json['height']),+ durationInSeconds: serializer.fromJson<int?>(json['durationInSeconds']),+ id: serializer.fromJson<String>(json['id']),+ checksum: serializer.fromJson<String>(json['checksum']),+ isFavorite: serializer.fromJson<bool>(json['isFavorite']),+ ownerId: serializer.fromJson<String>(json['ownerId']),+ localDateTime: serializer.fromJson<DateTime?>(json['localDateTime']),+ thumbHash: serializer.fromJson<String?>(json['thumbHash']),+ deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),+ livePhotoVideoId: serializer.fromJson<String?>(json['livePhotoVideoId']),+ visibility: serializer.fromJson<int>(json['visibility']),+ stackId: serializer.fromJson<String?>(json['stackId']),+ libraryId: serializer.fromJson<String?>(json['libraryId']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'name': serializer.toJson<String>(name),+ 'type': serializer.toJson<int>(type),+ 'createdAt': serializer.toJson<DateTime>(createdAt),+ 'updatedAt': serializer.toJson<DateTime>(updatedAt),+ 'width': serializer.toJson<int?>(width),+ 'height': serializer.toJson<int?>(height),+ 'durationInSeconds': serializer.toJson<int?>(durationInSeconds),+ 'id': serializer.toJson<String>(id),+ 'checksum': serializer.toJson<String>(checksum),+ 'isFavorite': serializer.toJson<bool>(isFavorite),+ 'ownerId': serializer.toJson<String>(ownerId),+ 'localDateTime': serializer.toJson<DateTime?>(localDateTime),+ 'thumbHash': serializer.toJson<String?>(thumbHash),+ 'deletedAt': serializer.toJson<DateTime?>(deletedAt),+ 'livePhotoVideoId': serializer.toJson<String?>(livePhotoVideoId),+ 'visibility': serializer.toJson<int>(visibility),+ 'stackId': serializer.toJson<String?>(stackId),+ 'libraryId': serializer.toJson<String?>(libraryId),+ };+ }++ RemoteAssetEntityData copyWith({+ String? name,+ int? type,+ DateTime? createdAt,+ DateTime? updatedAt,+ Value<int?> width = const Value.absent(),+ Value<int?> height = const Value.absent(),+ Value<int?> durationInSeconds = const Value.absent(),+ String? id,+ String? checksum,+ bool? isFavorite,+ String? ownerId,+ Value<DateTime?> localDateTime = const Value.absent(),+ Value<String?> thumbHash = const Value.absent(),+ Value<DateTime?> deletedAt = const Value.absent(),+ Value<String?> livePhotoVideoId = const Value.absent(),+ int? visibility,+ Value<String?> stackId = const Value.absent(),+ Value<String?> libraryId = const Value.absent(),+ }) => RemoteAssetEntityData(+ name: name ?? this.name,+ type: type ?? this.type,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ width: width.present ? width.value : this.width,+ height: height.present ? height.value : this.height,+ durationInSeconds: durationInSeconds.present+ ? durationInSeconds.value+ : this.durationInSeconds,+ id: id ?? this.id,+ checksum: checksum ?? this.checksum,+ isFavorite: isFavorite ?? this.isFavorite,+ ownerId: ownerId ?? this.ownerId,+ localDateTime: localDateTime.present+ ? localDateTime.value+ : this.localDateTime,+ thumbHash: thumbHash.present ? thumbHash.value : this.thumbHash,+ deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,+ livePhotoVideoId: livePhotoVideoId.present+ ? livePhotoVideoId.value+ : this.livePhotoVideoId,+ visibility: visibility ?? this.visibility,+ stackId: stackId.present ? stackId.value : this.stackId,+ libraryId: libraryId.present ? libraryId.value : this.libraryId,+ );+ RemoteAssetEntityData copyWithCompanion(RemoteAssetEntityCompanion data) {+ return RemoteAssetEntityData(+ name: data.name.present ? data.name.value : this.name,+ type: data.type.present ? data.type.value : this.type,+ createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,+ updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,+ width: data.width.present ? data.width.value : this.width,+ height: data.height.present ? data.height.value : this.height,+ durationInSeconds: data.durationInSeconds.present+ ? data.durationInSeconds.value+ : this.durationInSeconds,+ id: data.id.present ? data.id.value : this.id,+ checksum: data.checksum.present ? data.checksum.value : this.checksum,+ isFavorite: data.isFavorite.present+ ? data.isFavorite.value+ : this.isFavorite,+ ownerId: data.ownerId.present ? data.ownerId.value : this.ownerId,+ localDateTime: data.localDateTime.present+ ? data.localDateTime.value+ : this.localDateTime,+ thumbHash: data.thumbHash.present ? data.thumbHash.value : this.thumbHash,+ deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,+ livePhotoVideoId: data.livePhotoVideoId.present+ ? data.livePhotoVideoId.value+ : this.livePhotoVideoId,+ visibility: data.visibility.present+ ? data.visibility.value+ : this.visibility,+ stackId: data.stackId.present ? data.stackId.value : this.stackId,+ libraryId: data.libraryId.present ? data.libraryId.value : this.libraryId,+ );+ }++ @override+ String toString() {+ return (StringBuffer('RemoteAssetEntityData(')+ ..write('name: $name, ')+ ..write('type: $type, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('width: $width, ')+ ..write('height: $height, ')+ ..write('durationInSeconds: $durationInSeconds, ')+ ..write('id: $id, ')+ ..write('checksum: $checksum, ')+ ..write('isFavorite: $isFavorite, ')+ ..write('ownerId: $ownerId, ')+ ..write('localDateTime: $localDateTime, ')+ ..write('thumbHash: $thumbHash, ')+ ..write('deletedAt: $deletedAt, ')+ ..write('livePhotoVideoId: $livePhotoVideoId, ')+ ..write('visibility: $visibility, ')+ ..write('stackId: $stackId, ')+ ..write('libraryId: $libraryId')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(+ name,+ type,+ createdAt,+ updatedAt,+ width,+ height,+ durationInSeconds,+ id,+ checksum,+ isFavorite,+ ownerId,+ localDateTime,+ thumbHash,+ deletedAt,+ livePhotoVideoId,+ visibility,+ stackId,+ libraryId,+ );+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is RemoteAssetEntityData &&+ other.name == this.name &&+ other.type == this.type &&+ other.createdAt == this.createdAt &&+ other.updatedAt == this.updatedAt &&+ other.width == this.width &&+ other.height == this.height &&+ other.durationInSeconds == this.durationInSeconds &&+ other.id == this.id &&+ other.checksum == this.checksum &&+ other.isFavorite == this.isFavorite &&+ other.ownerId == this.ownerId &&+ other.localDateTime == this.localDateTime &&+ other.thumbHash == this.thumbHash &&+ other.deletedAt == this.deletedAt &&+ other.livePhotoVideoId == this.livePhotoVideoId &&+ other.visibility == this.visibility &&+ other.stackId == this.stackId &&+ other.libraryId == this.libraryId);+}++class RemoteAssetEntityCompanion+ extends UpdateCompanion<RemoteAssetEntityData> {+ final Value<String> name;+ final Value<int> type;+ final Value<DateTime> createdAt;+ final Value<DateTime> updatedAt;+ final Value<int?> width;+ final Value<int?> height;+ final Value<int?> durationInSeconds;+ final Value<String> id;+ final Value<String> checksum;+ final Value<bool> isFavorite;+ final Value<String> ownerId;+ final Value<DateTime?> localDateTime;+ final Value<String?> thumbHash;+ final Value<DateTime?> deletedAt;+ final Value<String?> livePhotoVideoId;+ final Value<int> visibility;+ final Value<String?> stackId;+ final Value<String?> libraryId;+ const RemoteAssetEntityCompanion({+ this.name = const Value.absent(),+ this.type = const Value.absent(),+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ this.width = const Value.absent(),+ this.height = const Value.absent(),+ this.durationInSeconds = const Value.absent(),+ this.id = const Value.absent(),+ this.checksum = const Value.absent(),+ this.isFavorite = const Value.absent(),+ this.ownerId = const Value.absent(),+ this.localDateTime = const Value.absent(),+ this.thumbHash = const Value.absent(),+ this.deletedAt = const Value.absent(),+ this.livePhotoVideoId = const Value.absent(),+ this.visibility = const Value.absent(),+ this.stackId = const Value.absent(),+ this.libraryId = const Value.absent(),+ });+ RemoteAssetEntityCompanion.insert({+ required String name,+ required int type,+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ this.width = const Value.absent(),+ this.height = const Value.absent(),+ this.durationInSeconds = const Value.absent(),+ required String id,+ required String checksum,+ this.isFavorite = const Value.absent(),+ required String ownerId,+ this.localDateTime = const Value.absent(),+ this.thumbHash = const Value.absent(),+ this.deletedAt = const Value.absent(),+ this.livePhotoVideoId = const Value.absent(),+ required int visibility,+ this.stackId = const Value.absent(),+ this.libraryId = const Value.absent(),+ }) : name = Value(name),+ type = Value(type),+ id = Value(id),+ checksum = Value(checksum),+ ownerId = Value(ownerId),+ visibility = Value(visibility);+ static Insertable<RemoteAssetEntityData> custom({+ Expression<String>? name,+ Expression<int>? type,+ Expression<DateTime>? createdAt,+ Expression<DateTime>? updatedAt,+ Expression<int>? width,+ Expression<int>? height,+ Expression<int>? durationInSeconds,+ Expression<String>? id,+ Expression<String>? checksum,+ Expression<bool>? isFavorite,+ Expression<String>? ownerId,+ Expression<DateTime>? localDateTime,+ Expression<String>? thumbHash,+ Expression<DateTime>? deletedAt,+ Expression<String>? livePhotoVideoId,+ Expression<int>? visibility,+ Expression<String>? stackId,+ Expression<String>? libraryId,+ }) {+ return RawValuesInsertable({+ if (name != null) 'name': name,+ if (type != null) 'type': type,+ if (createdAt != null) 'created_at': createdAt,+ if (updatedAt != null) 'updated_at': updatedAt,+ if (width != null) 'width': width,+ if (height != null) 'height': height,+ if (durationInSeconds != null) 'duration_in_seconds': durationInSeconds,+ if (id != null) 'id': id,+ if (checksum != null) 'checksum': checksum,+ if (isFavorite != null) 'is_favorite': isFavorite,+ if (ownerId != null) 'owner_id': ownerId,+ if (localDateTime != null) 'local_date_time': localDateTime,+ if (thumbHash != null) 'thumb_hash': thumbHash,+ if (deletedAt != null) 'deleted_at': deletedAt,+ if (livePhotoVideoId != null) 'live_photo_video_id': livePhotoVideoId,+ if (visibility != null) 'visibility': visibility,+ if (stackId != null) 'stack_id': stackId,+ if (libraryId != null) 'library_id': libraryId,+ });+ }++ RemoteAssetEntityCompanion copyWith({+ Value<String>? name,+ Value<int>? type,+ Value<DateTime>? createdAt,+ Value<DateTime>? updatedAt,+ Value<int?>? width,+ Value<int?>? height,+ Value<int?>? durationInSeconds,+ Value<String>? id,+ Value<String>? checksum,+ Value<bool>? isFavorite,+ Value<String>? ownerId,+ Value<DateTime?>? localDateTime,+ Value<String?>? thumbHash,+ Value<DateTime?>? deletedAt,+ Value<String?>? livePhotoVideoId,+ Value<int>? visibility,+ Value<String?>? stackId,+ Value<String?>? libraryId,+ }) {+ return RemoteAssetEntityCompanion(+ name: name ?? this.name,+ type: type ?? this.type,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ width: width ?? this.width,+ height: height ?? this.height,+ durationInSeconds: durationInSeconds ?? this.durationInSeconds,+ id: id ?? this.id,+ checksum: checksum ?? this.checksum,+ isFavorite: isFavorite ?? this.isFavorite,+ ownerId: ownerId ?? this.ownerId,+ localDateTime: localDateTime ?? this.localDateTime,+ thumbHash: thumbHash ?? this.thumbHash,+ deletedAt: deletedAt ?? this.deletedAt,+ livePhotoVideoId: livePhotoVideoId ?? this.livePhotoVideoId,+ visibility: visibility ?? this.visibility,+ stackId: stackId ?? this.stackId,+ libraryId: libraryId ?? this.libraryId,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (name.present) {+ map['name'] = Variable<String>(name.value);+ }+ if (type.present) {+ map['type'] = Variable<int>(type.value);+ }+ if (createdAt.present) {+ map['created_at'] = Variable<DateTime>(createdAt.value);+ }+ if (updatedAt.present) {+ map['updated_at'] = Variable<DateTime>(updatedAt.value);+ }+ if (width.present) {+ map['width'] = Variable<int>(width.value);+ }+ if (height.present) {+ map['height'] = Variable<int>(height.value);+ }+ if (durationInSeconds.present) {+ map['duration_in_seconds'] = Variable<int>(durationInSeconds.value);+ }+ if (id.present) {+ map['id'] = Variable<String>(id.value);+ }+ if (checksum.present) {+ map['checksum'] = Variable<String>(checksum.value);+ }+ if (isFavorite.present) {+ map['is_favorite'] = Variable<bool>(isFavorite.value);+ }+ if (ownerId.present) {+ map['owner_id'] = Variable<String>(ownerId.value);+ }+ if (localDateTime.present) {+ map['local_date_time'] = Variable<DateTime>(localDateTime.value);+ }+ if (thumbHash.present) {+ map['thumb_hash'] = Variable<String>(thumbHash.value);+ }+ if (deletedAt.present) {+ map['deleted_at'] = Variable<DateTime>(deletedAt.value);+ }+ if (livePhotoVideoId.present) {+ map['live_photo_video_id'] = Variable<String>(livePhotoVideoId.value);+ }+ if (visibility.present) {+ map['visibility'] = Variable<int>(visibility.value);+ }+ if (stackId.present) {+ map['stack_id'] = Variable<String>(stackId.value);+ }+ if (libraryId.present) {+ map['library_id'] = Variable<String>(libraryId.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('RemoteAssetEntityCompanion(')+ ..write('name: $name, ')+ ..write('type: $type, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('width: $width, ')+ ..write('height: $height, ')+ ..write('durationInSeconds: $durationInSeconds, ')+ ..write('id: $id, ')+ ..write('checksum: $checksum, ')+ ..write('isFavorite: $isFavorite, ')+ ..write('ownerId: $ownerId, ')+ ..write('localDateTime: $localDateTime, ')+ ..write('thumbHash: $thumbHash, ')+ ..write('deletedAt: $deletedAt, ')+ ..write('livePhotoVideoId: $livePhotoVideoId, ')+ ..write('visibility: $visibility, ')+ ..write('stackId: $stackId, ')+ ..write('libraryId: $libraryId')+ ..write(')'))+ .toString();+ }+}++class StackEntity extends Table with TableInfo<StackEntity, StackEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ StackEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> id = GeneratedColumn<String>(+ 'id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(+ 'created_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(+ 'updated_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<String> ownerId = GeneratedColumn<String>(+ 'owner_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES user_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<String> primaryAssetId = GeneratedColumn<String>(+ 'primary_asset_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ @override+ List<GeneratedColumn> get $columns => [+ id,+ createdAt,+ updatedAt,+ ownerId,+ primaryAssetId,+ ];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'stack_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {id};+ @override+ StackEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return StackEntityData(+ id: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}id'],+ )!,+ createdAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}created_at'],+ )!,+ updatedAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}updated_at'],+ )!,+ ownerId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}owner_id'],+ )!,+ primaryAssetId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}primary_asset_id'],+ )!,+ );+ }++ @override+ StackEntity createAlias(String alias) {+ return StackEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class StackEntityData extends DataClass implements Insertable<StackEntityData> {+ final String id;+ final DateTime createdAt;+ final DateTime updatedAt;+ final String ownerId;+ final String primaryAssetId;+ const StackEntityData({+ required this.id,+ required this.createdAt,+ required this.updatedAt,+ required this.ownerId,+ required this.primaryAssetId,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['id'] = Variable<String>(id);+ map['created_at'] = Variable<DateTime>(createdAt);+ map['updated_at'] = Variable<DateTime>(updatedAt);+ map['owner_id'] = Variable<String>(ownerId);+ map['primary_asset_id'] = Variable<String>(primaryAssetId);+ return map;+ }++ factory StackEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return StackEntityData(+ id: serializer.fromJson<String>(json['id']),+ createdAt: serializer.fromJson<DateTime>(json['createdAt']),+ updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),+ ownerId: serializer.fromJson<String>(json['ownerId']),+ primaryAssetId: serializer.fromJson<String>(json['primaryAssetId']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'id': serializer.toJson<String>(id),+ 'createdAt': serializer.toJson<DateTime>(createdAt),+ 'updatedAt': serializer.toJson<DateTime>(updatedAt),+ 'ownerId': serializer.toJson<String>(ownerId),+ 'primaryAssetId': serializer.toJson<String>(primaryAssetId),+ };+ }++ StackEntityData copyWith({+ String? id,+ DateTime? createdAt,+ DateTime? updatedAt,+ String? ownerId,+ String? primaryAssetId,+ }) => StackEntityData(+ id: id ?? this.id,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ ownerId: ownerId ?? this.ownerId,+ primaryAssetId: primaryAssetId ?? this.primaryAssetId,+ );+ StackEntityData copyWithCompanion(StackEntityCompanion data) {+ return StackEntityData(+ id: data.id.present ? data.id.value : this.id,+ createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,+ updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,+ ownerId: data.ownerId.present ? data.ownerId.value : this.ownerId,+ primaryAssetId: data.primaryAssetId.present+ ? data.primaryAssetId.value+ : this.primaryAssetId,+ );+ }++ @override+ String toString() {+ return (StringBuffer('StackEntityData(')+ ..write('id: $id, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('ownerId: $ownerId, ')+ ..write('primaryAssetId: $primaryAssetId')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode =>+ Object.hash(id, createdAt, updatedAt, ownerId, primaryAssetId);+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is StackEntityData &&+ other.id == this.id &&+ other.createdAt == this.createdAt &&+ other.updatedAt == this.updatedAt &&+ other.ownerId == this.ownerId &&+ other.primaryAssetId == this.primaryAssetId);+}++class StackEntityCompanion extends UpdateCompanion<StackEntityData> {+ final Value<String> id;+ final Value<DateTime> createdAt;+ final Value<DateTime> updatedAt;+ final Value<String> ownerId;+ final Value<String> primaryAssetId;+ const StackEntityCompanion({+ this.id = const Value.absent(),+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ this.ownerId = const Value.absent(),+ this.primaryAssetId = const Value.absent(),+ });+ StackEntityCompanion.insert({+ required String id,+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ required String ownerId,+ required String primaryAssetId,+ }) : id = Value(id),+ ownerId = Value(ownerId),+ primaryAssetId = Value(primaryAssetId);+ static Insertable<StackEntityData> custom({+ Expression<String>? id,+ Expression<DateTime>? createdAt,+ Expression<DateTime>? updatedAt,+ Expression<String>? ownerId,+ Expression<String>? primaryAssetId,+ }) {+ return RawValuesInsertable({+ if (id != null) 'id': id,+ if (createdAt != null) 'created_at': createdAt,+ if (updatedAt != null) 'updated_at': updatedAt,+ if (ownerId != null) 'owner_id': ownerId,+ if (primaryAssetId != null) 'primary_asset_id': primaryAssetId,+ });+ }++ StackEntityCompanion copyWith({+ Value<String>? id,+ Value<DateTime>? createdAt,+ Value<DateTime>? updatedAt,+ Value<String>? ownerId,+ Value<String>? primaryAssetId,+ }) {+ return StackEntityCompanion(+ id: id ?? this.id,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ ownerId: ownerId ?? this.ownerId,+ primaryAssetId: primaryAssetId ?? this.primaryAssetId,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (id.present) {+ map['id'] = Variable<String>(id.value);+ }+ if (createdAt.present) {+ map['created_at'] = Variable<DateTime>(createdAt.value);+ }+ if (updatedAt.present) {+ map['updated_at'] = Variable<DateTime>(updatedAt.value);+ }+ if (ownerId.present) {+ map['owner_id'] = Variable<String>(ownerId.value);+ }+ if (primaryAssetId.present) {+ map['primary_asset_id'] = Variable<String>(primaryAssetId.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('StackEntityCompanion(')+ ..write('id: $id, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('ownerId: $ownerId, ')+ ..write('primaryAssetId: $primaryAssetId')+ ..write(')'))+ .toString();+ }+}++class LocalAssetEntity extends Table+ with TableInfo<LocalAssetEntity, LocalAssetEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ LocalAssetEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> name = GeneratedColumn<String>(+ 'name',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<int> type = GeneratedColumn<int>(+ 'type',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(+ 'created_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(+ 'updated_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<int> width = GeneratedColumn<int>(+ 'width',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<int> height = GeneratedColumn<int>(+ 'height',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<int> durationInSeconds = GeneratedColumn<int>(+ 'duration_in_seconds',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> id = GeneratedColumn<String>(+ 'id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> checksum = GeneratedColumn<String>(+ 'checksum',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<bool> isFavorite = GeneratedColumn<bool>(+ 'is_favorite',+ aliasedName,+ false,+ type: DriftSqlType.bool,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("is_favorite" IN (0, 1))',+ ),+ defaultValue: const CustomExpression('0'),+ );+ late final GeneratedColumn<int> orientation = GeneratedColumn<int>(+ 'orientation',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('0'),+ );+ @override+ List<GeneratedColumn> get $columns => [+ name,+ type,+ createdAt,+ updatedAt,+ width,+ height,+ durationInSeconds,+ id,+ checksum,+ isFavorite,+ orientation,+ ];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'local_asset_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {id};+ @override+ LocalAssetEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return LocalAssetEntityData(+ name: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}name'],+ )!,+ type: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}type'],+ )!,+ createdAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}created_at'],+ )!,+ updatedAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}updated_at'],+ )!,+ width: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}width'],+ ),+ height: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}height'],+ ),+ durationInSeconds: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}duration_in_seconds'],+ ),+ id: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}id'],+ )!,+ checksum: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}checksum'],+ ),+ isFavorite: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}is_favorite'],+ )!,+ orientation: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}orientation'],+ )!,+ );+ }++ @override+ LocalAssetEntity createAlias(String alias) {+ return LocalAssetEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class LocalAssetEntityData extends DataClass+ implements Insertable<LocalAssetEntityData> {+ final String name;+ final int type;+ final DateTime createdAt;+ final DateTime updatedAt;+ final int? width;+ final int? height;+ final int? durationInSeconds;+ final String id;+ final String? checksum;+ final bool isFavorite;+ final int orientation;+ const LocalAssetEntityData({+ required this.name,+ required this.type,+ required this.createdAt,+ required this.updatedAt,+ this.width,+ this.height,+ this.durationInSeconds,+ required this.id,+ this.checksum,+ required this.isFavorite,+ required this.orientation,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['name'] = Variable<String>(name);+ map['type'] = Variable<int>(type);+ map['created_at'] = Variable<DateTime>(createdAt);+ map['updated_at'] = Variable<DateTime>(updatedAt);+ if (!nullToAbsent || width != null) {+ map['width'] = Variable<int>(width);+ }+ if (!nullToAbsent || height != null) {+ map['height'] = Variable<int>(height);+ }+ if (!nullToAbsent || durationInSeconds != null) {+ map['duration_in_seconds'] = Variable<int>(durationInSeconds);+ }+ map['id'] = Variable<String>(id);+ if (!nullToAbsent || checksum != null) {+ map['checksum'] = Variable<String>(checksum);+ }+ map['is_favorite'] = Variable<bool>(isFavorite);+ map['orientation'] = Variable<int>(orientation);+ return map;+ }++ factory LocalAssetEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return LocalAssetEntityData(+ name: serializer.fromJson<String>(json['name']),+ type: serializer.fromJson<int>(json['type']),+ createdAt: serializer.fromJson<DateTime>(json['createdAt']),+ updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),+ width: serializer.fromJson<int?>(json['width']),+ height: serializer.fromJson<int?>(json['height']),+ durationInSeconds: serializer.fromJson<int?>(json['durationInSeconds']),+ id: serializer.fromJson<String>(json['id']),+ checksum: serializer.fromJson<String?>(json['checksum']),+ isFavorite: serializer.fromJson<bool>(json['isFavorite']),+ orientation: serializer.fromJson<int>(json['orientation']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'name': serializer.toJson<String>(name),+ 'type': serializer.toJson<int>(type),+ 'createdAt': serializer.toJson<DateTime>(createdAt),+ 'updatedAt': serializer.toJson<DateTime>(updatedAt),+ 'width': serializer.toJson<int?>(width),+ 'height': serializer.toJson<int?>(height),+ 'durationInSeconds': serializer.toJson<int?>(durationInSeconds),+ 'id': serializer.toJson<String>(id),+ 'checksum': serializer.toJson<String?>(checksum),+ 'isFavorite': serializer.toJson<bool>(isFavorite),+ 'orientation': serializer.toJson<int>(orientation),+ };+ }++ LocalAssetEntityData copyWith({+ String? name,+ int? type,+ DateTime? createdAt,+ DateTime? updatedAt,+ Value<int?> width = const Value.absent(),+ Value<int?> height = const Value.absent(),+ Value<int?> durationInSeconds = const Value.absent(),+ String? id,+ Value<String?> checksum = const Value.absent(),+ bool? isFavorite,+ int? orientation,+ }) => LocalAssetEntityData(+ name: name ?? this.name,+ type: type ?? this.type,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ width: width.present ? width.value : this.width,+ height: height.present ? height.value : this.height,+ durationInSeconds: durationInSeconds.present+ ? durationInSeconds.value+ : this.durationInSeconds,+ id: id ?? this.id,+ checksum: checksum.present ? checksum.value : this.checksum,+ isFavorite: isFavorite ?? this.isFavorite,+ orientation: orientation ?? this.orientation,+ );+ LocalAssetEntityData copyWithCompanion(LocalAssetEntityCompanion data) {+ return LocalAssetEntityData(+ name: data.name.present ? data.name.value : this.name,+ type: data.type.present ? data.type.value : this.type,+ createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,+ updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,+ width: data.width.present ? data.width.value : this.width,+ height: data.height.present ? data.height.value : this.height,+ durationInSeconds: data.durationInSeconds.present+ ? data.durationInSeconds.value+ : this.durationInSeconds,+ id: data.id.present ? data.id.value : this.id,+ checksum: data.checksum.present ? data.checksum.value : this.checksum,+ isFavorite: data.isFavorite.present+ ? data.isFavorite.value+ : this.isFavorite,+ orientation: data.orientation.present+ ? data.orientation.value+ : this.orientation,+ );+ }++ @override+ String toString() {+ return (StringBuffer('LocalAssetEntityData(')+ ..write('name: $name, ')+ ..write('type: $type, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('width: $width, ')+ ..write('height: $height, ')+ ..write('durationInSeconds: $durationInSeconds, ')+ ..write('id: $id, ')+ ..write('checksum: $checksum, ')+ ..write('isFavorite: $isFavorite, ')+ ..write('orientation: $orientation')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(+ name,+ type,+ createdAt,+ updatedAt,+ width,+ height,+ durationInSeconds,+ id,+ checksum,+ isFavorite,+ orientation,+ );+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is LocalAssetEntityData &&+ other.name == this.name &&+ other.type == this.type &&+ other.createdAt == this.createdAt &&+ other.updatedAt == this.updatedAt &&+ other.width == this.width &&+ other.height == this.height &&+ other.durationInSeconds == this.durationInSeconds &&+ other.id == this.id &&+ other.checksum == this.checksum &&+ other.isFavorite == this.isFavorite &&+ other.orientation == this.orientation);+}++class LocalAssetEntityCompanion extends UpdateCompanion<LocalAssetEntityData> {+ final Value<String> name;+ final Value<int> type;+ final Value<DateTime> createdAt;+ final Value<DateTime> updatedAt;+ final Value<int?> width;+ final Value<int?> height;+ final Value<int?> durationInSeconds;+ final Value<String> id;+ final Value<String?> checksum;+ final Value<bool> isFavorite;+ final Value<int> orientation;+ const LocalAssetEntityCompanion({+ this.name = const Value.absent(),+ this.type = const Value.absent(),+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ this.width = const Value.absent(),+ this.height = const Value.absent(),+ this.durationInSeconds = const Value.absent(),+ this.id = const Value.absent(),+ this.checksum = const Value.absent(),+ this.isFavorite = const Value.absent(),+ this.orientation = const Value.absent(),+ });+ LocalAssetEntityCompanion.insert({+ required String name,+ required int type,+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ this.width = const Value.absent(),+ this.height = const Value.absent(),+ this.durationInSeconds = const Value.absent(),+ required String id,+ this.checksum = const Value.absent(),+ this.isFavorite = const Value.absent(),+ this.orientation = const Value.absent(),+ }) : name = Value(name),+ type = Value(type),+ id = Value(id);+ static Insertable<LocalAssetEntityData> custom({+ Expression<String>? name,+ Expression<int>? type,+ Expression<DateTime>? createdAt,+ Expression<DateTime>? updatedAt,+ Expression<int>? width,+ Expression<int>? height,+ Expression<int>? durationInSeconds,+ Expression<String>? id,+ Expression<String>? checksum,+ Expression<bool>? isFavorite,+ Expression<int>? orientation,+ }) {+ return RawValuesInsertable({+ if (name != null) 'name': name,+ if (type != null) 'type': type,+ if (createdAt != null) 'created_at': createdAt,+ if (updatedAt != null) 'updated_at': updatedAt,+ if (width != null) 'width': width,+ if (height != null) 'height': height,+ if (durationInSeconds != null) 'duration_in_seconds': durationInSeconds,+ if (id != null) 'id': id,+ if (checksum != null) 'checksum': checksum,+ if (isFavorite != null) 'is_favorite': isFavorite,+ if (orientation != null) 'orientation': orientation,+ });+ }++ LocalAssetEntityCompanion copyWith({+ Value<String>? name,+ Value<int>? type,+ Value<DateTime>? createdAt,+ Value<DateTime>? updatedAt,+ Value<int?>? width,+ Value<int?>? height,+ Value<int?>? durationInSeconds,+ Value<String>? id,+ Value<String?>? checksum,+ Value<bool>? isFavorite,+ Value<int>? orientation,+ }) {+ return LocalAssetEntityCompanion(+ name: name ?? this.name,+ type: type ?? this.type,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ width: width ?? this.width,+ height: height ?? this.height,+ durationInSeconds: durationInSeconds ?? this.durationInSeconds,+ id: id ?? this.id,+ checksum: checksum ?? this.checksum,+ isFavorite: isFavorite ?? this.isFavorite,+ orientation: orientation ?? this.orientation,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (name.present) {+ map['name'] = Variable<String>(name.value);+ }+ if (type.present) {+ map['type'] = Variable<int>(type.value);+ }+ if (createdAt.present) {+ map['created_at'] = Variable<DateTime>(createdAt.value);+ }+ if (updatedAt.present) {+ map['updated_at'] = Variable<DateTime>(updatedAt.value);+ }+ if (width.present) {+ map['width'] = Variable<int>(width.value);+ }+ if (height.present) {+ map['height'] = Variable<int>(height.value);+ }+ if (durationInSeconds.present) {+ map['duration_in_seconds'] = Variable<int>(durationInSeconds.value);+ }+ if (id.present) {+ map['id'] = Variable<String>(id.value);+ }+ if (checksum.present) {+ map['checksum'] = Variable<String>(checksum.value);+ }+ if (isFavorite.present) {+ map['is_favorite'] = Variable<bool>(isFavorite.value);+ }+ if (orientation.present) {+ map['orientation'] = Variable<int>(orientation.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('LocalAssetEntityCompanion(')+ ..write('name: $name, ')+ ..write('type: $type, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('width: $width, ')+ ..write('height: $height, ')+ ..write('durationInSeconds: $durationInSeconds, ')+ ..write('id: $id, ')+ ..write('checksum: $checksum, ')+ ..write('isFavorite: $isFavorite, ')+ ..write('orientation: $orientation')+ ..write(')'))+ .toString();+ }+}++class RemoteAlbumEntity extends Table+ with TableInfo<RemoteAlbumEntity, RemoteAlbumEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ RemoteAlbumEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> id = GeneratedColumn<String>(+ 'id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> name = GeneratedColumn<String>(+ 'name',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> description = GeneratedColumn<String>(+ 'description',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('\'\''),+ );+ late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(+ 'created_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(+ 'updated_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<String> ownerId = GeneratedColumn<String>(+ 'owner_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES user_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<String> thumbnailAssetId = GeneratedColumn<String>(+ 'thumbnail_asset_id',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES remote_asset_entity (id) ON DELETE SET NULL',+ ),+ );+ late final GeneratedColumn<bool> isActivityEnabled = GeneratedColumn<bool>(+ 'is_activity_enabled',+ aliasedName,+ false,+ type: DriftSqlType.bool,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("is_activity_enabled" IN (0, 1))',+ ),+ defaultValue: const CustomExpression('1'),+ );+ late final GeneratedColumn<int> order = GeneratedColumn<int>(+ 'order',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ @override+ List<GeneratedColumn> get $columns => [+ id,+ name,+ description,+ createdAt,+ updatedAt,+ ownerId,+ thumbnailAssetId,+ isActivityEnabled,+ order,+ ];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'remote_album_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {id};+ @override+ RemoteAlbumEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return RemoteAlbumEntityData(+ id: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}id'],+ )!,+ name: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}name'],+ )!,+ description: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}description'],+ )!,+ createdAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}created_at'],+ )!,+ updatedAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}updated_at'],+ )!,+ ownerId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}owner_id'],+ )!,+ thumbnailAssetId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}thumbnail_asset_id'],+ ),+ isActivityEnabled: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}is_activity_enabled'],+ )!,+ order: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}order'],+ )!,+ );+ }++ @override+ RemoteAlbumEntity createAlias(String alias) {+ return RemoteAlbumEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class RemoteAlbumEntityData extends DataClass+ implements Insertable<RemoteAlbumEntityData> {+ final String id;+ final String name;+ final String description;+ final DateTime createdAt;+ final DateTime updatedAt;+ final String ownerId;+ final String? thumbnailAssetId;+ final bool isActivityEnabled;+ final int order;+ const RemoteAlbumEntityData({+ required this.id,+ required this.name,+ required this.description,+ required this.createdAt,+ required this.updatedAt,+ required this.ownerId,+ this.thumbnailAssetId,+ required this.isActivityEnabled,+ required this.order,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['id'] = Variable<String>(id);+ map['name'] = Variable<String>(name);+ map['description'] = Variable<String>(description);+ map['created_at'] = Variable<DateTime>(createdAt);+ map['updated_at'] = Variable<DateTime>(updatedAt);+ map['owner_id'] = Variable<String>(ownerId);+ if (!nullToAbsent || thumbnailAssetId != null) {+ map['thumbnail_asset_id'] = Variable<String>(thumbnailAssetId);+ }+ map['is_activity_enabled'] = Variable<bool>(isActivityEnabled);+ map['order'] = Variable<int>(order);+ return map;+ }++ factory RemoteAlbumEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return RemoteAlbumEntityData(+ id: serializer.fromJson<String>(json['id']),+ name: serializer.fromJson<String>(json['name']),+ description: serializer.fromJson<String>(json['description']),+ createdAt: serializer.fromJson<DateTime>(json['createdAt']),+ updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),+ ownerId: serializer.fromJson<String>(json['ownerId']),+ thumbnailAssetId: serializer.fromJson<String?>(json['thumbnailAssetId']),+ isActivityEnabled: serializer.fromJson<bool>(json['isActivityEnabled']),+ order: serializer.fromJson<int>(json['order']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'id': serializer.toJson<String>(id),+ 'name': serializer.toJson<String>(name),+ 'description': serializer.toJson<String>(description),+ 'createdAt': serializer.toJson<DateTime>(createdAt),+ 'updatedAt': serializer.toJson<DateTime>(updatedAt),+ 'ownerId': serializer.toJson<String>(ownerId),+ 'thumbnailAssetId': serializer.toJson<String?>(thumbnailAssetId),+ 'isActivityEnabled': serializer.toJson<bool>(isActivityEnabled),+ 'order': serializer.toJson<int>(order),+ };+ }++ RemoteAlbumEntityData copyWith({+ String? id,+ String? name,+ String? description,+ DateTime? createdAt,+ DateTime? updatedAt,+ String? ownerId,+ Value<String?> thumbnailAssetId = const Value.absent(),+ bool? isActivityEnabled,+ int? order,+ }) => RemoteAlbumEntityData(+ id: id ?? this.id,+ name: name ?? this.name,+ description: description ?? this.description,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ ownerId: ownerId ?? this.ownerId,+ thumbnailAssetId: thumbnailAssetId.present+ ? thumbnailAssetId.value+ : this.thumbnailAssetId,+ isActivityEnabled: isActivityEnabled ?? this.isActivityEnabled,+ order: order ?? this.order,+ );+ RemoteAlbumEntityData copyWithCompanion(RemoteAlbumEntityCompanion data) {+ return RemoteAlbumEntityData(+ id: data.id.present ? data.id.value : this.id,+ name: data.name.present ? data.name.value : this.name,+ description: data.description.present+ ? data.description.value+ : this.description,+ createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,+ updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,+ ownerId: data.ownerId.present ? data.ownerId.value : this.ownerId,+ thumbnailAssetId: data.thumbnailAssetId.present+ ? data.thumbnailAssetId.value+ : this.thumbnailAssetId,+ isActivityEnabled: data.isActivityEnabled.present+ ? data.isActivityEnabled.value+ : this.isActivityEnabled,+ order: data.order.present ? data.order.value : this.order,+ );+ }++ @override+ String toString() {+ return (StringBuffer('RemoteAlbumEntityData(')+ ..write('id: $id, ')+ ..write('name: $name, ')+ ..write('description: $description, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('ownerId: $ownerId, ')+ ..write('thumbnailAssetId: $thumbnailAssetId, ')+ ..write('isActivityEnabled: $isActivityEnabled, ')+ ..write('order: $order')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(+ id,+ name,+ description,+ createdAt,+ updatedAt,+ ownerId,+ thumbnailAssetId,+ isActivityEnabled,+ order,+ );+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is RemoteAlbumEntityData &&+ other.id == this.id &&+ other.name == this.name &&+ other.description == this.description &&+ other.createdAt == this.createdAt &&+ other.updatedAt == this.updatedAt &&+ other.ownerId == this.ownerId &&+ other.thumbnailAssetId == this.thumbnailAssetId &&+ other.isActivityEnabled == this.isActivityEnabled &&+ other.order == this.order);+}++class RemoteAlbumEntityCompanion+ extends UpdateCompanion<RemoteAlbumEntityData> {+ final Value<String> id;+ final Value<String> name;+ final Value<String> description;+ final Value<DateTime> createdAt;+ final Value<DateTime> updatedAt;+ final Value<String> ownerId;+ final Value<String?> thumbnailAssetId;+ final Value<bool> isActivityEnabled;+ final Value<int> order;+ const RemoteAlbumEntityCompanion({+ this.id = const Value.absent(),+ this.name = const Value.absent(),+ this.description = const Value.absent(),+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ this.ownerId = const Value.absent(),+ this.thumbnailAssetId = const Value.absent(),+ this.isActivityEnabled = const Value.absent(),+ this.order = const Value.absent(),+ });+ RemoteAlbumEntityCompanion.insert({+ required String id,+ required String name,+ this.description = const Value.absent(),+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ required String ownerId,+ this.thumbnailAssetId = const Value.absent(),+ this.isActivityEnabled = const Value.absent(),+ required int order,+ }) : id = Value(id),+ name = Value(name),+ ownerId = Value(ownerId),+ order = Value(order);+ static Insertable<RemoteAlbumEntityData> custom({+ Expression<String>? id,+ Expression<String>? name,+ Expression<String>? description,+ Expression<DateTime>? createdAt,+ Expression<DateTime>? updatedAt,+ Expression<String>? ownerId,+ Expression<String>? thumbnailAssetId,+ Expression<bool>? isActivityEnabled,+ Expression<int>? order,+ }) {+ return RawValuesInsertable({+ if (id != null) 'id': id,+ if (name != null) 'name': name,+ if (description != null) 'description': description,+ if (createdAt != null) 'created_at': createdAt,+ if (updatedAt != null) 'updated_at': updatedAt,+ if (ownerId != null) 'owner_id': ownerId,+ if (thumbnailAssetId != null) 'thumbnail_asset_id': thumbnailAssetId,+ if (isActivityEnabled != null) 'is_activity_enabled': isActivityEnabled,+ if (order != null) 'order': order,+ });+ }++ RemoteAlbumEntityCompanion copyWith({+ Value<String>? id,+ Value<String>? name,+ Value<String>? description,+ Value<DateTime>? createdAt,+ Value<DateTime>? updatedAt,+ Value<String>? ownerId,+ Value<String?>? thumbnailAssetId,+ Value<bool>? isActivityEnabled,+ Value<int>? order,+ }) {+ return RemoteAlbumEntityCompanion(+ id: id ?? this.id,+ name: name ?? this.name,+ description: description ?? this.description,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ ownerId: ownerId ?? this.ownerId,+ thumbnailAssetId: thumbnailAssetId ?? this.thumbnailAssetId,+ isActivityEnabled: isActivityEnabled ?? this.isActivityEnabled,+ order: order ?? this.order,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (id.present) {+ map['id'] = Variable<String>(id.value);+ }+ if (name.present) {+ map['name'] = Variable<String>(name.value);+ }+ if (description.present) {+ map['description'] = Variable<String>(description.value);+ }+ if (createdAt.present) {+ map['created_at'] = Variable<DateTime>(createdAt.value);+ }+ if (updatedAt.present) {+ map['updated_at'] = Variable<DateTime>(updatedAt.value);+ }+ if (ownerId.present) {+ map['owner_id'] = Variable<String>(ownerId.value);+ }+ if (thumbnailAssetId.present) {+ map['thumbnail_asset_id'] = Variable<String>(thumbnailAssetId.value);+ }+ if (isActivityEnabled.present) {+ map['is_activity_enabled'] = Variable<bool>(isActivityEnabled.value);+ }+ if (order.present) {+ map['order'] = Variable<int>(order.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('RemoteAlbumEntityCompanion(')+ ..write('id: $id, ')+ ..write('name: $name, ')+ ..write('description: $description, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('ownerId: $ownerId, ')+ ..write('thumbnailAssetId: $thumbnailAssetId, ')+ ..write('isActivityEnabled: $isActivityEnabled, ')+ ..write('order: $order')+ ..write(')'))+ .toString();+ }+}++class LocalAlbumEntity extends Table+ with TableInfo<LocalAlbumEntity, LocalAlbumEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ LocalAlbumEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> id = GeneratedColumn<String>(+ 'id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> name = GeneratedColumn<String>(+ 'name',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(+ 'updated_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<int> backupSelection = GeneratedColumn<int>(+ 'backup_selection',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<bool> isIosSharedAlbum = GeneratedColumn<bool>(+ 'is_ios_shared_album',+ aliasedName,+ false,+ type: DriftSqlType.bool,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("is_ios_shared_album" IN (0, 1))',+ ),+ defaultValue: const CustomExpression('0'),+ );+ late final GeneratedColumn<String> linkedRemoteAlbumId =+ GeneratedColumn<String>(+ 'linked_remote_album_id',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES remote_album_entity (id) ON DELETE SET NULL',+ ),+ );+ late final GeneratedColumn<bool> marker_ = GeneratedColumn<bool>(+ 'marker',+ aliasedName,+ true,+ type: DriftSqlType.bool,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("marker" IN (0, 1))',+ ),+ );+ @override+ List<GeneratedColumn> get $columns => [+ id,+ name,+ updatedAt,+ backupSelection,+ isIosSharedAlbum,+ linkedRemoteAlbumId,+ marker_,+ ];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'local_album_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {id};+ @override+ LocalAlbumEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return LocalAlbumEntityData(+ id: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}id'],+ )!,+ name: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}name'],+ )!,+ updatedAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}updated_at'],+ )!,+ backupSelection: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}backup_selection'],+ )!,+ isIosSharedAlbum: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}is_ios_shared_album'],+ )!,+ linkedRemoteAlbumId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}linked_remote_album_id'],+ ),+ marker_: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}marker'],+ ),+ );+ }++ @override+ LocalAlbumEntity createAlias(String alias) {+ return LocalAlbumEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class LocalAlbumEntityData extends DataClass+ implements Insertable<LocalAlbumEntityData> {+ final String id;+ final String name;+ final DateTime updatedAt;+ final int backupSelection;+ final bool isIosSharedAlbum;+ final String? linkedRemoteAlbumId;+ final bool? marker_;+ const LocalAlbumEntityData({+ required this.id,+ required this.name,+ required this.updatedAt,+ required this.backupSelection,+ required this.isIosSharedAlbum,+ this.linkedRemoteAlbumId,+ this.marker_,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['id'] = Variable<String>(id);+ map['name'] = Variable<String>(name);+ map['updated_at'] = Variable<DateTime>(updatedAt);+ map['backup_selection'] = Variable<int>(backupSelection);+ map['is_ios_shared_album'] = Variable<bool>(isIosSharedAlbum);+ if (!nullToAbsent || linkedRemoteAlbumId != null) {+ map['linked_remote_album_id'] = Variable<String>(linkedRemoteAlbumId);+ }+ if (!nullToAbsent || marker_ != null) {+ map['marker'] = Variable<bool>(marker_);+ }+ return map;+ }++ factory LocalAlbumEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return LocalAlbumEntityData(+ id: serializer.fromJson<String>(json['id']),+ name: serializer.fromJson<String>(json['name']),+ updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),+ backupSelection: serializer.fromJson<int>(json['backupSelection']),+ isIosSharedAlbum: serializer.fromJson<bool>(json['isIosSharedAlbum']),+ linkedRemoteAlbumId: serializer.fromJson<String?>(+ json['linkedRemoteAlbumId'],+ ),+ marker_: serializer.fromJson<bool?>(json['marker_']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'id': serializer.toJson<String>(id),+ 'name': serializer.toJson<String>(name),+ 'updatedAt': serializer.toJson<DateTime>(updatedAt),+ 'backupSelection': serializer.toJson<int>(backupSelection),+ 'isIosSharedAlbum': serializer.toJson<bool>(isIosSharedAlbum),+ 'linkedRemoteAlbumId': serializer.toJson<String?>(linkedRemoteAlbumId),+ 'marker_': serializer.toJson<bool?>(marker_),+ };+ }++ LocalAlbumEntityData copyWith({+ String? id,+ String? name,+ DateTime? updatedAt,+ int? backupSelection,+ bool? isIosSharedAlbum,+ Value<String?> linkedRemoteAlbumId = const Value.absent(),+ Value<bool?> marker_ = const Value.absent(),+ }) => LocalAlbumEntityData(+ id: id ?? this.id,+ name: name ?? this.name,+ updatedAt: updatedAt ?? this.updatedAt,+ backupSelection: backupSelection ?? this.backupSelection,+ isIosSharedAlbum: isIosSharedAlbum ?? this.isIosSharedAlbum,+ linkedRemoteAlbumId: linkedRemoteAlbumId.present+ ? linkedRemoteAlbumId.value+ : this.linkedRemoteAlbumId,+ marker_: marker_.present ? marker_.value : this.marker_,+ );+ LocalAlbumEntityData copyWithCompanion(LocalAlbumEntityCompanion data) {+ return LocalAlbumEntityData(+ id: data.id.present ? data.id.value : this.id,+ name: data.name.present ? data.name.value : this.name,+ updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,+ backupSelection: data.backupSelection.present+ ? data.backupSelection.value+ : this.backupSelection,+ isIosSharedAlbum: data.isIosSharedAlbum.present+ ? data.isIosSharedAlbum.value+ : this.isIosSharedAlbum,+ linkedRemoteAlbumId: data.linkedRemoteAlbumId.present+ ? data.linkedRemoteAlbumId.value+ : this.linkedRemoteAlbumId,+ marker_: data.marker_.present ? data.marker_.value : this.marker_,+ );+ }++ @override+ String toString() {+ return (StringBuffer('LocalAlbumEntityData(')+ ..write('id: $id, ')+ ..write('name: $name, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('backupSelection: $backupSelection, ')+ ..write('isIosSharedAlbum: $isIosSharedAlbum, ')+ ..write('linkedRemoteAlbumId: $linkedRemoteAlbumId, ')+ ..write('marker_: $marker_')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(+ id,+ name,+ updatedAt,+ backupSelection,+ isIosSharedAlbum,+ linkedRemoteAlbumId,+ marker_,+ );+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is LocalAlbumEntityData &&+ other.id == this.id &&+ other.name == this.name &&+ other.updatedAt == this.updatedAt &&+ other.backupSelection == this.backupSelection &&+ other.isIosSharedAlbum == this.isIosSharedAlbum &&+ other.linkedRemoteAlbumId == this.linkedRemoteAlbumId &&+ other.marker_ == this.marker_);+}++class LocalAlbumEntityCompanion extends UpdateCompanion<LocalAlbumEntityData> {+ final Value<String> id;+ final Value<String> name;+ final Value<DateTime> updatedAt;+ final Value<int> backupSelection;+ final Value<bool> isIosSharedAlbum;+ final Value<String?> linkedRemoteAlbumId;+ final Value<bool?> marker_;+ const LocalAlbumEntityCompanion({+ this.id = const Value.absent(),+ this.name = const Value.absent(),+ this.updatedAt = const Value.absent(),+ this.backupSelection = const Value.absent(),+ this.isIosSharedAlbum = const Value.absent(),+ this.linkedRemoteAlbumId = const Value.absent(),+ this.marker_ = const Value.absent(),+ });+ LocalAlbumEntityCompanion.insert({+ required String id,+ required String name,+ this.updatedAt = const Value.absent(),+ required int backupSelection,+ this.isIosSharedAlbum = const Value.absent(),+ this.linkedRemoteAlbumId = const Value.absent(),+ this.marker_ = const Value.absent(),+ }) : id = Value(id),+ name = Value(name),+ backupSelection = Value(backupSelection);+ static Insertable<LocalAlbumEntityData> custom({+ Expression<String>? id,+ Expression<String>? name,+ Expression<DateTime>? updatedAt,+ Expression<int>? backupSelection,+ Expression<bool>? isIosSharedAlbum,+ Expression<String>? linkedRemoteAlbumId,+ Expression<bool>? marker_,+ }) {+ return RawValuesInsertable({+ if (id != null) 'id': id,+ if (name != null) 'name': name,+ if (updatedAt != null) 'updated_at': updatedAt,+ if (backupSelection != null) 'backup_selection': backupSelection,+ if (isIosSharedAlbum != null) 'is_ios_shared_album': isIosSharedAlbum,+ if (linkedRemoteAlbumId != null)+ 'linked_remote_album_id': linkedRemoteAlbumId,+ if (marker_ != null) 'marker': marker_,+ });+ }++ LocalAlbumEntityCompanion copyWith({+ Value<String>? id,+ Value<String>? name,+ Value<DateTime>? updatedAt,+ Value<int>? backupSelection,+ Value<bool>? isIosSharedAlbum,+ Value<String?>? linkedRemoteAlbumId,+ Value<bool?>? marker_,+ }) {+ return LocalAlbumEntityCompanion(+ id: id ?? this.id,+ name: name ?? this.name,+ updatedAt: updatedAt ?? this.updatedAt,+ backupSelection: backupSelection ?? this.backupSelection,+ isIosSharedAlbum: isIosSharedAlbum ?? this.isIosSharedAlbum,+ linkedRemoteAlbumId: linkedRemoteAlbumId ?? this.linkedRemoteAlbumId,+ marker_: marker_ ?? this.marker_,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (id.present) {+ map['id'] = Variable<String>(id.value);+ }+ if (name.present) {+ map['name'] = Variable<String>(name.value);+ }+ if (updatedAt.present) {+ map['updated_at'] = Variable<DateTime>(updatedAt.value);+ }+ if (backupSelection.present) {+ map['backup_selection'] = Variable<int>(backupSelection.value);+ }+ if (isIosSharedAlbum.present) {+ map['is_ios_shared_album'] = Variable<bool>(isIosSharedAlbum.value);+ }+ if (linkedRemoteAlbumId.present) {+ map['linked_remote_album_id'] = Variable<String>(+ linkedRemoteAlbumId.value,+ );+ }+ if (marker_.present) {+ map['marker'] = Variable<bool>(marker_.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('LocalAlbumEntityCompanion(')+ ..write('id: $id, ')+ ..write('name: $name, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('backupSelection: $backupSelection, ')+ ..write('isIosSharedAlbum: $isIosSharedAlbum, ')+ ..write('linkedRemoteAlbumId: $linkedRemoteAlbumId, ')+ ..write('marker_: $marker_')+ ..write(')'))+ .toString();+ }+}++class LocalAlbumAssetEntity extends Table+ with TableInfo<LocalAlbumAssetEntity, LocalAlbumAssetEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ LocalAlbumAssetEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> assetId = GeneratedColumn<String>(+ 'asset_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES local_asset_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<String> albumId = GeneratedColumn<String>(+ 'album_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES local_album_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<bool> marker_ = GeneratedColumn<bool>(+ 'marker',+ aliasedName,+ true,+ type: DriftSqlType.bool,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("marker" IN (0, 1))',+ ),+ );+ @override+ List<GeneratedColumn> get $columns => [assetId, albumId, marker_];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'local_album_asset_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {assetId, albumId};+ @override+ LocalAlbumAssetEntityData map(+ Map<String, dynamic> data, {+ String? tablePrefix,+ }) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return LocalAlbumAssetEntityData(+ assetId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}asset_id'],+ )!,+ albumId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}album_id'],+ )!,+ marker_: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}marker'],+ ),+ );+ }++ @override+ LocalAlbumAssetEntity createAlias(String alias) {+ return LocalAlbumAssetEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class LocalAlbumAssetEntityData extends DataClass+ implements Insertable<LocalAlbumAssetEntityData> {+ final String assetId;+ final String albumId;+ final bool? marker_;+ const LocalAlbumAssetEntityData({+ required this.assetId,+ required this.albumId,+ this.marker_,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['asset_id'] = Variable<String>(assetId);+ map['album_id'] = Variable<String>(albumId);+ if (!nullToAbsent || marker_ != null) {+ map['marker'] = Variable<bool>(marker_);+ }+ return map;+ }++ factory LocalAlbumAssetEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return LocalAlbumAssetEntityData(+ assetId: serializer.fromJson<String>(json['assetId']),+ albumId: serializer.fromJson<String>(json['albumId']),+ marker_: serializer.fromJson<bool?>(json['marker_']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'assetId': serializer.toJson<String>(assetId),+ 'albumId': serializer.toJson<String>(albumId),+ 'marker_': serializer.toJson<bool?>(marker_),+ };+ }++ LocalAlbumAssetEntityData copyWith({+ String? assetId,+ String? albumId,+ Value<bool?> marker_ = const Value.absent(),+ }) => LocalAlbumAssetEntityData(+ assetId: assetId ?? this.assetId,+ albumId: albumId ?? this.albumId,+ marker_: marker_.present ? marker_.value : this.marker_,+ );+ LocalAlbumAssetEntityData copyWithCompanion(+ LocalAlbumAssetEntityCompanion data,+ ) {+ return LocalAlbumAssetEntityData(+ assetId: data.assetId.present ? data.assetId.value : this.assetId,+ albumId: data.albumId.present ? data.albumId.value : this.albumId,+ marker_: data.marker_.present ? data.marker_.value : this.marker_,+ );+ }++ @override+ String toString() {+ return (StringBuffer('LocalAlbumAssetEntityData(')+ ..write('assetId: $assetId, ')+ ..write('albumId: $albumId, ')+ ..write('marker_: $marker_')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(assetId, albumId, marker_);+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is LocalAlbumAssetEntityData &&+ other.assetId == this.assetId &&+ other.albumId == this.albumId &&+ other.marker_ == this.marker_);+}++class LocalAlbumAssetEntityCompanion+ extends UpdateCompanion<LocalAlbumAssetEntityData> {+ final Value<String> assetId;+ final Value<String> albumId;+ final Value<bool?> marker_;+ const LocalAlbumAssetEntityCompanion({+ this.assetId = const Value.absent(),+ this.albumId = const Value.absent(),+ this.marker_ = const Value.absent(),+ });+ LocalAlbumAssetEntityCompanion.insert({+ required String assetId,+ required String albumId,+ this.marker_ = const Value.absent(),+ }) : assetId = Value(assetId),+ albumId = Value(albumId);+ static Insertable<LocalAlbumAssetEntityData> custom({+ Expression<String>? assetId,+ Expression<String>? albumId,+ Expression<bool>? marker_,+ }) {+ return RawValuesInsertable({+ if (assetId != null) 'asset_id': assetId,+ if (albumId != null) 'album_id': albumId,+ if (marker_ != null) 'marker': marker_,+ });+ }++ LocalAlbumAssetEntityCompanion copyWith({+ Value<String>? assetId,+ Value<String>? albumId,+ Value<bool?>? marker_,+ }) {+ return LocalAlbumAssetEntityCompanion(+ assetId: assetId ?? this.assetId,+ albumId: albumId ?? this.albumId,+ marker_: marker_ ?? this.marker_,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (assetId.present) {+ map['asset_id'] = Variable<String>(assetId.value);+ }+ if (albumId.present) {+ map['album_id'] = Variable<String>(albumId.value);+ }+ if (marker_.present) {+ map['marker'] = Variable<bool>(marker_.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('LocalAlbumAssetEntityCompanion(')+ ..write('assetId: $assetId, ')+ ..write('albumId: $albumId, ')+ ..write('marker_: $marker_')+ ..write(')'))+ .toString();+ }+}++class AuthUserEntity extends Table+ with TableInfo<AuthUserEntity, AuthUserEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ AuthUserEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> id = GeneratedColumn<String>(+ 'id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> name = GeneratedColumn<String>(+ 'name',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> email = GeneratedColumn<String>(+ 'email',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<bool> isAdmin = GeneratedColumn<bool>(+ 'is_admin',+ aliasedName,+ false,+ type: DriftSqlType.bool,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("is_admin" IN (0, 1))',+ ),+ defaultValue: const CustomExpression('0'),+ );+ late final GeneratedColumn<bool> hasProfileImage = GeneratedColumn<bool>(+ 'has_profile_image',+ aliasedName,+ false,+ type: DriftSqlType.bool,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("has_profile_image" IN (0, 1))',+ ),+ defaultValue: const CustomExpression('0'),+ );+ late final GeneratedColumn<DateTime> profileChangedAt =+ GeneratedColumn<DateTime>(+ 'profile_changed_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<int> avatarColor = GeneratedColumn<int>(+ 'avatar_color',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<int> quotaSizeInBytes = GeneratedColumn<int>(+ 'quota_size_in_bytes',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('0'),+ );+ late final GeneratedColumn<int> quotaUsageInBytes = GeneratedColumn<int>(+ 'quota_usage_in_bytes',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('0'),+ );+ late final GeneratedColumn<String> pinCode = GeneratedColumn<String>(+ 'pin_code',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ @override+ List<GeneratedColumn> get $columns => [+ id,+ name,+ email,+ isAdmin,+ hasProfileImage,+ profileChangedAt,+ avatarColor,+ quotaSizeInBytes,+ quotaUsageInBytes,+ pinCode,+ ];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'auth_user_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {id};+ @override+ AuthUserEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return AuthUserEntityData(+ id: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}id'],+ )!,+ name: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}name'],+ )!,+ email: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}email'],+ )!,+ isAdmin: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}is_admin'],+ )!,+ hasProfileImage: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}has_profile_image'],+ )!,+ profileChangedAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}profile_changed_at'],+ )!,+ avatarColor: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}avatar_color'],+ )!,+ quotaSizeInBytes: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}quota_size_in_bytes'],+ )!,+ quotaUsageInBytes: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}quota_usage_in_bytes'],+ )!,+ pinCode: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}pin_code'],+ ),+ );+ }++ @override+ AuthUserEntity createAlias(String alias) {+ return AuthUserEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class AuthUserEntityData extends DataClass+ implements Insertable<AuthUserEntityData> {+ final String id;+ final String name;+ final String email;+ final bool isAdmin;+ final bool hasProfileImage;+ final DateTime profileChangedAt;+ final int avatarColor;+ final int quotaSizeInBytes;+ final int quotaUsageInBytes;+ final String? pinCode;+ const AuthUserEntityData({+ required this.id,+ required this.name,+ required this.email,+ required this.isAdmin,+ required this.hasProfileImage,+ required this.profileChangedAt,+ required this.avatarColor,+ required this.quotaSizeInBytes,+ required this.quotaUsageInBytes,+ this.pinCode,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['id'] = Variable<String>(id);+ map['name'] = Variable<String>(name);+ map['email'] = Variable<String>(email);+ map['is_admin'] = Variable<bool>(isAdmin);+ map['has_profile_image'] = Variable<bool>(hasProfileImage);+ map['profile_changed_at'] = Variable<DateTime>(profileChangedAt);+ map['avatar_color'] = Variable<int>(avatarColor);+ map['quota_size_in_bytes'] = Variable<int>(quotaSizeInBytes);+ map['quota_usage_in_bytes'] = Variable<int>(quotaUsageInBytes);+ if (!nullToAbsent || pinCode != null) {+ map['pin_code'] = Variable<String>(pinCode);+ }+ return map;+ }++ factory AuthUserEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return AuthUserEntityData(+ id: serializer.fromJson<String>(json['id']),+ name: serializer.fromJson<String>(json['name']),+ email: serializer.fromJson<String>(json['email']),+ isAdmin: serializer.fromJson<bool>(json['isAdmin']),+ hasProfileImage: serializer.fromJson<bool>(json['hasProfileImage']),+ profileChangedAt: serializer.fromJson<DateTime>(json['profileChangedAt']),+ avatarColor: serializer.fromJson<int>(json['avatarColor']),+ quotaSizeInBytes: serializer.fromJson<int>(json['quotaSizeInBytes']),+ quotaUsageInBytes: serializer.fromJson<int>(json['quotaUsageInBytes']),+ pinCode: serializer.fromJson<String?>(json['pinCode']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'id': serializer.toJson<String>(id),+ 'name': serializer.toJson<String>(name),+ 'email': serializer.toJson<String>(email),+ 'isAdmin': serializer.toJson<bool>(isAdmin),+ 'hasProfileImage': serializer.toJson<bool>(hasProfileImage),+ 'profileChangedAt': serializer.toJson<DateTime>(profileChangedAt),+ 'avatarColor': serializer.toJson<int>(avatarColor),+ 'quotaSizeInBytes': serializer.toJson<int>(quotaSizeInBytes),+ 'quotaUsageInBytes': serializer.toJson<int>(quotaUsageInBytes),+ 'pinCode': serializer.toJson<String?>(pinCode),+ };+ }++ AuthUserEntityData copyWith({+ String? id,+ String? name,+ String? email,+ bool? isAdmin,+ bool? hasProfileImage,+ DateTime? profileChangedAt,+ int? avatarColor,+ int? quotaSizeInBytes,+ int? quotaUsageInBytes,+ Value<String?> pinCode = const Value.absent(),+ }) => AuthUserEntityData(+ id: id ?? this.id,+ name: name ?? this.name,+ email: email ?? this.email,+ isAdmin: isAdmin ?? this.isAdmin,+ hasProfileImage: hasProfileImage ?? this.hasProfileImage,+ profileChangedAt: profileChangedAt ?? this.profileChangedAt,+ avatarColor: avatarColor ?? this.avatarColor,+ quotaSizeInBytes: quotaSizeInBytes ?? this.quotaSizeInBytes,+ quotaUsageInBytes: quotaUsageInBytes ?? this.quotaUsageInBytes,+ pinCode: pinCode.present ? pinCode.value : this.pinCode,+ );+ AuthUserEntityData copyWithCompanion(AuthUserEntityCompanion data) {+ return AuthUserEntityData(+ id: data.id.present ? data.id.value : this.id,+ name: data.name.present ? data.name.value : this.name,+ email: data.email.present ? data.email.value : this.email,+ isAdmin: data.isAdmin.present ? data.isAdmin.value : this.isAdmin,+ hasProfileImage: data.hasProfileImage.present+ ? data.hasProfileImage.value+ : this.hasProfileImage,+ profileChangedAt: data.profileChangedAt.present+ ? data.profileChangedAt.value+ : this.profileChangedAt,+ avatarColor: data.avatarColor.present+ ? data.avatarColor.value+ : this.avatarColor,+ quotaSizeInBytes: data.quotaSizeInBytes.present+ ? data.quotaSizeInBytes.value+ : this.quotaSizeInBytes,+ quotaUsageInBytes: data.quotaUsageInBytes.present+ ? data.quotaUsageInBytes.value+ : this.quotaUsageInBytes,+ pinCode: data.pinCode.present ? data.pinCode.value : this.pinCode,+ );+ }++ @override+ String toString() {+ return (StringBuffer('AuthUserEntityData(')+ ..write('id: $id, ')+ ..write('name: $name, ')+ ..write('email: $email, ')+ ..write('isAdmin: $isAdmin, ')+ ..write('hasProfileImage: $hasProfileImage, ')+ ..write('profileChangedAt: $profileChangedAt, ')+ ..write('avatarColor: $avatarColor, ')+ ..write('quotaSizeInBytes: $quotaSizeInBytes, ')+ ..write('quotaUsageInBytes: $quotaUsageInBytes, ')+ ..write('pinCode: $pinCode')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(+ id,+ name,+ email,+ isAdmin,+ hasProfileImage,+ profileChangedAt,+ avatarColor,+ quotaSizeInBytes,+ quotaUsageInBytes,+ pinCode,+ );+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is AuthUserEntityData &&+ other.id == this.id &&+ other.name == this.name &&+ other.email == this.email &&+ other.isAdmin == this.isAdmin &&+ other.hasProfileImage == this.hasProfileImage &&+ other.profileChangedAt == this.profileChangedAt &&+ other.avatarColor == this.avatarColor &&+ other.quotaSizeInBytes == this.quotaSizeInBytes &&+ other.quotaUsageInBytes == this.quotaUsageInBytes &&+ other.pinCode == this.pinCode);+}++class AuthUserEntityCompanion extends UpdateCompanion<AuthUserEntityData> {+ final Value<String> id;+ final Value<String> name;+ final Value<String> email;+ final Value<bool> isAdmin;+ final Value<bool> hasProfileImage;+ final Value<DateTime> profileChangedAt;+ final Value<int> avatarColor;+ final Value<int> quotaSizeInBytes;+ final Value<int> quotaUsageInBytes;+ final Value<String?> pinCode;+ const AuthUserEntityCompanion({+ this.id = const Value.absent(),+ this.name = const Value.absent(),+ this.email = const Value.absent(),+ this.isAdmin = const Value.absent(),+ this.hasProfileImage = const Value.absent(),+ this.profileChangedAt = const Value.absent(),+ this.avatarColor = const Value.absent(),+ this.quotaSizeInBytes = const Value.absent(),+ this.quotaUsageInBytes = const Value.absent(),+ this.pinCode = const Value.absent(),+ });+ AuthUserEntityCompanion.insert({+ required String id,+ required String name,+ required String email,+ this.isAdmin = const Value.absent(),+ this.hasProfileImage = const Value.absent(),+ this.profileChangedAt = const Value.absent(),+ required int avatarColor,+ this.quotaSizeInBytes = const Value.absent(),+ this.quotaUsageInBytes = const Value.absent(),+ this.pinCode = const Value.absent(),+ }) : id = Value(id),+ name = Value(name),+ email = Value(email),+ avatarColor = Value(avatarColor);+ static Insertable<AuthUserEntityData> custom({+ Expression<String>? id,+ Expression<String>? name,+ Expression<String>? email,+ Expression<bool>? isAdmin,+ Expression<bool>? hasProfileImage,+ Expression<DateTime>? profileChangedAt,+ Expression<int>? avatarColor,+ Expression<int>? quotaSizeInBytes,+ Expression<int>? quotaUsageInBytes,+ Expression<String>? pinCode,+ }) {+ return RawValuesInsertable({+ if (id != null) 'id': id,+ if (name != null) 'name': name,+ if (email != null) 'email': email,+ if (isAdmin != null) 'is_admin': isAdmin,+ if (hasProfileImage != null) 'has_profile_image': hasProfileImage,+ if (profileChangedAt != null) 'profile_changed_at': profileChangedAt,+ if (avatarColor != null) 'avatar_color': avatarColor,+ if (quotaSizeInBytes != null) 'quota_size_in_bytes': quotaSizeInBytes,+ if (quotaUsageInBytes != null) 'quota_usage_in_bytes': quotaUsageInBytes,+ if (pinCode != null) 'pin_code': pinCode,+ });+ }++ AuthUserEntityCompanion copyWith({+ Value<String>? id,+ Value<String>? name,+ Value<String>? email,+ Value<bool>? isAdmin,+ Value<bool>? hasProfileImage,+ Value<DateTime>? profileChangedAt,+ Value<int>? avatarColor,+ Value<int>? quotaSizeInBytes,+ Value<int>? quotaUsageInBytes,+ Value<String?>? pinCode,+ }) {+ return AuthUserEntityCompanion(+ id: id ?? this.id,+ name: name ?? this.name,+ email: email ?? this.email,+ isAdmin: isAdmin ?? this.isAdmin,+ hasProfileImage: hasProfileImage ?? this.hasProfileImage,+ profileChangedAt: profileChangedAt ?? this.profileChangedAt,+ avatarColor: avatarColor ?? this.avatarColor,+ quotaSizeInBytes: quotaSizeInBytes ?? this.quotaSizeInBytes,+ quotaUsageInBytes: quotaUsageInBytes ?? this.quotaUsageInBytes,+ pinCode: pinCode ?? this.pinCode,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (id.present) {+ map['id'] = Variable<String>(id.value);+ }+ if (name.present) {+ map['name'] = Variable<String>(name.value);+ }+ if (email.present) {+ map['email'] = Variable<String>(email.value);+ }+ if (isAdmin.present) {+ map['is_admin'] = Variable<bool>(isAdmin.value);+ }+ if (hasProfileImage.present) {+ map['has_profile_image'] = Variable<bool>(hasProfileImage.value);+ }+ if (profileChangedAt.present) {+ map['profile_changed_at'] = Variable<DateTime>(profileChangedAt.value);+ }+ if (avatarColor.present) {+ map['avatar_color'] = Variable<int>(avatarColor.value);+ }+ if (quotaSizeInBytes.present) {+ map['quota_size_in_bytes'] = Variable<int>(quotaSizeInBytes.value);+ }+ if (quotaUsageInBytes.present) {+ map['quota_usage_in_bytes'] = Variable<int>(quotaUsageInBytes.value);+ }+ if (pinCode.present) {+ map['pin_code'] = Variable<String>(pinCode.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('AuthUserEntityCompanion(')+ ..write('id: $id, ')+ ..write('name: $name, ')+ ..write('email: $email, ')+ ..write('isAdmin: $isAdmin, ')+ ..write('hasProfileImage: $hasProfileImage, ')+ ..write('profileChangedAt: $profileChangedAt, ')+ ..write('avatarColor: $avatarColor, ')+ ..write('quotaSizeInBytes: $quotaSizeInBytes, ')+ ..write('quotaUsageInBytes: $quotaUsageInBytes, ')+ ..write('pinCode: $pinCode')+ ..write(')'))+ .toString();+ }+}++class UserMetadataEntity extends Table+ with TableInfo<UserMetadataEntity, UserMetadataEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ UserMetadataEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> userId = GeneratedColumn<String>(+ 'user_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES user_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<int> key = GeneratedColumn<int>(+ 'key',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<Uint8List> value = GeneratedColumn<Uint8List>(+ 'value',+ aliasedName,+ false,+ type: DriftSqlType.blob,+ requiredDuringInsert: true,+ );+ @override+ List<GeneratedColumn> get $columns => [userId, key, value];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'user_metadata_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {userId, key};+ @override+ UserMetadataEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return UserMetadataEntityData(+ userId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}user_id'],+ )!,+ key: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}key'],+ )!,+ value: attachedDatabase.typeMapping.read(+ DriftSqlType.blob,+ data['${effectivePrefix}value'],+ )!,+ );+ }++ @override+ UserMetadataEntity createAlias(String alias) {+ return UserMetadataEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class UserMetadataEntityData extends DataClass+ implements Insertable<UserMetadataEntityData> {+ final String userId;+ final int key;+ final Uint8List value;+ const UserMetadataEntityData({+ required this.userId,+ required this.key,+ required this.value,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['user_id'] = Variable<String>(userId);+ map['key'] = Variable<int>(key);+ map['value'] = Variable<Uint8List>(value);+ return map;+ }++ factory UserMetadataEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return UserMetadataEntityData(+ userId: serializer.fromJson<String>(json['userId']),+ key: serializer.fromJson<int>(json['key']),+ value: serializer.fromJson<Uint8List>(json['value']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'userId': serializer.toJson<String>(userId),+ 'key': serializer.toJson<int>(key),+ 'value': serializer.toJson<Uint8List>(value),+ };+ }++ UserMetadataEntityData copyWith({+ String? userId,+ int? key,+ Uint8List? value,+ }) => UserMetadataEntityData(+ userId: userId ?? this.userId,+ key: key ?? this.key,+ value: value ?? this.value,+ );+ UserMetadataEntityData copyWithCompanion(UserMetadataEntityCompanion data) {+ return UserMetadataEntityData(+ userId: data.userId.present ? data.userId.value : this.userId,+ key: data.key.present ? data.key.value : this.key,+ value: data.value.present ? data.value.value : this.value,+ );+ }++ @override+ String toString() {+ return (StringBuffer('UserMetadataEntityData(')+ ..write('userId: $userId, ')+ ..write('key: $key, ')+ ..write('value: $value')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(userId, key, $driftBlobEquality.hash(value));+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is UserMetadataEntityData &&+ other.userId == this.userId &&+ other.key == this.key &&+ $driftBlobEquality.equals(other.value, this.value));+}++class UserMetadataEntityCompanion+ extends UpdateCompanion<UserMetadataEntityData> {+ final Value<String> userId;+ final Value<int> key;+ final Value<Uint8List> value;+ const UserMetadataEntityCompanion({+ this.userId = const Value.absent(),+ this.key = const Value.absent(),+ this.value = const Value.absent(),+ });+ UserMetadataEntityCompanion.insert({+ required String userId,+ required int key,+ required Uint8List value,+ }) : userId = Value(userId),+ key = Value(key),+ value = Value(value);+ static Insertable<UserMetadataEntityData> custom({+ Expression<String>? userId,+ Expression<int>? key,+ Expression<Uint8List>? value,+ }) {+ return RawValuesInsertable({+ if (userId != null) 'user_id': userId,+ if (key != null) 'key': key,+ if (value != null) 'value': value,+ });+ }++ UserMetadataEntityCompanion copyWith({+ Value<String>? userId,+ Value<int>? key,+ Value<Uint8List>? value,+ }) {+ return UserMetadataEntityCompanion(+ userId: userId ?? this.userId,+ key: key ?? this.key,+ value: value ?? this.value,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (userId.present) {+ map['user_id'] = Variable<String>(userId.value);+ }+ if (key.present) {+ map['key'] = Variable<int>(key.value);+ }+ if (value.present) {+ map['value'] = Variable<Uint8List>(value.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('UserMetadataEntityCompanion(')+ ..write('userId: $userId, ')+ ..write('key: $key, ')+ ..write('value: $value')+ ..write(')'))+ .toString();+ }+}++class PartnerEntity extends Table+ with TableInfo<PartnerEntity, PartnerEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ PartnerEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> sharedById = GeneratedColumn<String>(+ 'shared_by_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES user_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<String> sharedWithId = GeneratedColumn<String>(+ 'shared_with_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES user_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<bool> inTimeline = GeneratedColumn<bool>(+ 'in_timeline',+ aliasedName,+ false,+ type: DriftSqlType.bool,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("in_timeline" IN (0, 1))',+ ),+ defaultValue: const CustomExpression('0'),+ );+ @override+ List<GeneratedColumn> get $columns => [sharedById, sharedWithId, inTimeline];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'partner_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {sharedById, sharedWithId};+ @override+ PartnerEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return PartnerEntityData(+ sharedById: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}shared_by_id'],+ )!,+ sharedWithId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}shared_with_id'],+ )!,+ inTimeline: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}in_timeline'],+ )!,+ );+ }++ @override+ PartnerEntity createAlias(String alias) {+ return PartnerEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class PartnerEntityData extends DataClass+ implements Insertable<PartnerEntityData> {+ final String sharedById;+ final String sharedWithId;+ final bool inTimeline;+ const PartnerEntityData({+ required this.sharedById,+ required this.sharedWithId,+ required this.inTimeline,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['shared_by_id'] = Variable<String>(sharedById);+ map['shared_with_id'] = Variable<String>(sharedWithId);+ map['in_timeline'] = Variable<bool>(inTimeline);+ return map;+ }++ factory PartnerEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return PartnerEntityData(+ sharedById: serializer.fromJson<String>(json['sharedById']),+ sharedWithId: serializer.fromJson<String>(json['sharedWithId']),+ inTimeline: serializer.fromJson<bool>(json['inTimeline']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'sharedById': serializer.toJson<String>(sharedById),+ 'sharedWithId': serializer.toJson<String>(sharedWithId),+ 'inTimeline': serializer.toJson<bool>(inTimeline),+ };+ }++ PartnerEntityData copyWith({+ String? sharedById,+ String? sharedWithId,+ bool? inTimeline,+ }) => PartnerEntityData(+ sharedById: sharedById ?? this.sharedById,+ sharedWithId: sharedWithId ?? this.sharedWithId,+ inTimeline: inTimeline ?? this.inTimeline,+ );+ PartnerEntityData copyWithCompanion(PartnerEntityCompanion data) {+ return PartnerEntityData(+ sharedById: data.sharedById.present+ ? data.sharedById.value+ : this.sharedById,+ sharedWithId: data.sharedWithId.present+ ? data.sharedWithId.value+ : this.sharedWithId,+ inTimeline: data.inTimeline.present+ ? data.inTimeline.value+ : this.inTimeline,+ );+ }++ @override+ String toString() {+ return (StringBuffer('PartnerEntityData(')+ ..write('sharedById: $sharedById, ')+ ..write('sharedWithId: $sharedWithId, ')+ ..write('inTimeline: $inTimeline')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(sharedById, sharedWithId, inTimeline);+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is PartnerEntityData &&+ other.sharedById == this.sharedById &&+ other.sharedWithId == this.sharedWithId &&+ other.inTimeline == this.inTimeline);+}++class PartnerEntityCompanion extends UpdateCompanion<PartnerEntityData> {+ final Value<String> sharedById;+ final Value<String> sharedWithId;+ final Value<bool> inTimeline;+ const PartnerEntityCompanion({+ this.sharedById = const Value.absent(),+ this.sharedWithId = const Value.absent(),+ this.inTimeline = const Value.absent(),+ });+ PartnerEntityCompanion.insert({+ required String sharedById,+ required String sharedWithId,+ this.inTimeline = const Value.absent(),+ }) : sharedById = Value(sharedById),+ sharedWithId = Value(sharedWithId);+ static Insertable<PartnerEntityData> custom({+ Expression<String>? sharedById,+ Expression<String>? sharedWithId,+ Expression<bool>? inTimeline,+ }) {+ return RawValuesInsertable({+ if (sharedById != null) 'shared_by_id': sharedById,+ if (sharedWithId != null) 'shared_with_id': sharedWithId,+ if (inTimeline != null) 'in_timeline': inTimeline,+ });+ }++ PartnerEntityCompanion copyWith({+ Value<String>? sharedById,+ Value<String>? sharedWithId,+ Value<bool>? inTimeline,+ }) {+ return PartnerEntityCompanion(+ sharedById: sharedById ?? this.sharedById,+ sharedWithId: sharedWithId ?? this.sharedWithId,+ inTimeline: inTimeline ?? this.inTimeline,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (sharedById.present) {+ map['shared_by_id'] = Variable<String>(sharedById.value);+ }+ if (sharedWithId.present) {+ map['shared_with_id'] = Variable<String>(sharedWithId.value);+ }+ if (inTimeline.present) {+ map['in_timeline'] = Variable<bool>(inTimeline.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('PartnerEntityCompanion(')+ ..write('sharedById: $sharedById, ')+ ..write('sharedWithId: $sharedWithId, ')+ ..write('inTimeline: $inTimeline')+ ..write(')'))+ .toString();+ }+}++class RemoteExifEntity extends Table+ with TableInfo<RemoteExifEntity, RemoteExifEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ RemoteExifEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> assetId = GeneratedColumn<String>(+ 'asset_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES remote_asset_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<String> city = GeneratedColumn<String>(+ 'city',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> state = GeneratedColumn<String>(+ 'state',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> country = GeneratedColumn<String>(+ 'country',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<DateTime> dateTimeOriginal =+ GeneratedColumn<DateTime>(+ 'date_time_original',+ aliasedName,+ true,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> description = GeneratedColumn<String>(+ 'description',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<int> height = GeneratedColumn<int>(+ 'height',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<int> width = GeneratedColumn<int>(+ 'width',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> exposureTime = GeneratedColumn<String>(+ 'exposure_time',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<double> fNumber = GeneratedColumn<double>(+ 'f_number',+ aliasedName,+ true,+ type: DriftSqlType.double,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<int> fileSize = GeneratedColumn<int>(+ 'file_size',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<double> focalLength = GeneratedColumn<double>(+ 'focal_length',+ aliasedName,+ true,+ type: DriftSqlType.double,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<double> latitude = GeneratedColumn<double>(+ 'latitude',+ aliasedName,+ true,+ type: DriftSqlType.double,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<double> longitude = GeneratedColumn<double>(+ 'longitude',+ aliasedName,+ true,+ type: DriftSqlType.double,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<int> iso = GeneratedColumn<int>(+ 'iso',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> make = GeneratedColumn<String>(+ 'make',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> model = GeneratedColumn<String>(+ 'model',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> lens = GeneratedColumn<String>(+ 'lens',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> orientation = GeneratedColumn<String>(+ 'orientation',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> timeZone = GeneratedColumn<String>(+ 'time_zone',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<int> rating = GeneratedColumn<int>(+ 'rating',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> projectionType = GeneratedColumn<String>(+ 'projection_type',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ @override+ List<GeneratedColumn> get $columns => [+ assetId,+ city,+ state,+ country,+ dateTimeOriginal,+ description,+ height,+ width,+ exposureTime,+ fNumber,+ fileSize,+ focalLength,+ latitude,+ longitude,+ iso,+ make,+ model,+ lens,+ orientation,+ timeZone,+ rating,+ projectionType,+ ];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'remote_exif_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {assetId};+ @override+ RemoteExifEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return RemoteExifEntityData(+ assetId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}asset_id'],+ )!,+ city: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}city'],+ ),+ state: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}state'],+ ),+ country: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}country'],+ ),+ dateTimeOriginal: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}date_time_original'],+ ),+ description: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}description'],+ ),+ height: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}height'],+ ),+ width: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}width'],+ ),+ exposureTime: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}exposure_time'],+ ),+ fNumber: attachedDatabase.typeMapping.read(+ DriftSqlType.double,+ data['${effectivePrefix}f_number'],+ ),+ fileSize: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}file_size'],+ ),+ focalLength: attachedDatabase.typeMapping.read(+ DriftSqlType.double,+ data['${effectivePrefix}focal_length'],+ ),+ latitude: attachedDatabase.typeMapping.read(+ DriftSqlType.double,+ data['${effectivePrefix}latitude'],+ ),+ longitude: attachedDatabase.typeMapping.read(+ DriftSqlType.double,+ data['${effectivePrefix}longitude'],+ ),+ iso: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}iso'],+ ),+ make: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}make'],+ ),+ model: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}model'],+ ),+ lens: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}lens'],+ ),+ orientation: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}orientation'],+ ),+ timeZone: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}time_zone'],+ ),+ rating: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}rating'],+ ),+ projectionType: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}projection_type'],+ ),+ );+ }++ @override+ RemoteExifEntity createAlias(String alias) {+ return RemoteExifEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class RemoteExifEntityData extends DataClass+ implements Insertable<RemoteExifEntityData> {+ final String assetId;+ final String? city;+ final String? state;+ final String? country;+ final DateTime? dateTimeOriginal;+ final String? description;+ final int? height;+ final int? width;+ final String? exposureTime;+ final double? fNumber;+ final int? fileSize;+ final double? focalLength;+ final double? latitude;+ final double? longitude;+ final int? iso;+ final String? make;+ final String? model;+ final String? lens;+ final String? orientation;+ final String? timeZone;+ final int? rating;+ final String? projectionType;+ const RemoteExifEntityData({+ required this.assetId,+ this.city,+ this.state,+ this.country,+ this.dateTimeOriginal,+ this.description,+ this.height,+ this.width,+ this.exposureTime,+ this.fNumber,+ this.fileSize,+ this.focalLength,+ this.latitude,+ this.longitude,+ this.iso,+ this.make,+ this.model,+ this.lens,+ this.orientation,+ this.timeZone,+ this.rating,+ this.projectionType,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['asset_id'] = Variable<String>(assetId);+ if (!nullToAbsent || city != null) {+ map['city'] = Variable<String>(city);+ }+ if (!nullToAbsent || state != null) {+ map['state'] = Variable<String>(state);+ }+ if (!nullToAbsent || country != null) {+ map['country'] = Variable<String>(country);+ }+ if (!nullToAbsent || dateTimeOriginal != null) {+ map['date_time_original'] = Variable<DateTime>(dateTimeOriginal);+ }+ if (!nullToAbsent || description != null) {+ map['description'] = Variable<String>(description);+ }+ if (!nullToAbsent || height != null) {+ map['height'] = Variable<int>(height);+ }+ if (!nullToAbsent || width != null) {+ map['width'] = Variable<int>(width);+ }+ if (!nullToAbsent || exposureTime != null) {+ map['exposure_time'] = Variable<String>(exposureTime);+ }+ if (!nullToAbsent || fNumber != null) {+ map['f_number'] = Variable<double>(fNumber);+ }+ if (!nullToAbsent || fileSize != null) {+ map['file_size'] = Variable<int>(fileSize);+ }+ if (!nullToAbsent || focalLength != null) {+ map['focal_length'] = Variable<double>(focalLength);+ }+ if (!nullToAbsent || latitude != null) {+ map['latitude'] = Variable<double>(latitude);+ }+ if (!nullToAbsent || longitude != null) {+ map['longitude'] = Variable<double>(longitude);+ }+ if (!nullToAbsent || iso != null) {+ map['iso'] = Variable<int>(iso);+ }+ if (!nullToAbsent || make != null) {+ map['make'] = Variable<String>(make);+ }+ if (!nullToAbsent || model != null) {+ map['model'] = Variable<String>(model);+ }+ if (!nullToAbsent || lens != null) {+ map['lens'] = Variable<String>(lens);+ }+ if (!nullToAbsent || orientation != null) {+ map['orientation'] = Variable<String>(orientation);+ }+ if (!nullToAbsent || timeZone != null) {+ map['time_zone'] = Variable<String>(timeZone);+ }+ if (!nullToAbsent || rating != null) {+ map['rating'] = Variable<int>(rating);+ }+ if (!nullToAbsent || projectionType != null) {+ map['projection_type'] = Variable<String>(projectionType);+ }+ return map;+ }++ factory RemoteExifEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return RemoteExifEntityData(+ assetId: serializer.fromJson<String>(json['assetId']),+ city: serializer.fromJson<String?>(json['city']),+ state: serializer.fromJson<String?>(json['state']),+ country: serializer.fromJson<String?>(json['country']),+ dateTimeOriginal: serializer.fromJson<DateTime?>(+ json['dateTimeOriginal'],+ ),+ description: serializer.fromJson<String?>(json['description']),+ height: serializer.fromJson<int?>(json['height']),+ width: serializer.fromJson<int?>(json['width']),+ exposureTime: serializer.fromJson<String?>(json['exposureTime']),+ fNumber: serializer.fromJson<double?>(json['fNumber']),+ fileSize: serializer.fromJson<int?>(json['fileSize']),+ focalLength: serializer.fromJson<double?>(json['focalLength']),+ latitude: serializer.fromJson<double?>(json['latitude']),+ longitude: serializer.fromJson<double?>(json['longitude']),+ iso: serializer.fromJson<int?>(json['iso']),+ make: serializer.fromJson<String?>(json['make']),+ model: serializer.fromJson<String?>(json['model']),+ lens: serializer.fromJson<String?>(json['lens']),+ orientation: serializer.fromJson<String?>(json['orientation']),+ timeZone: serializer.fromJson<String?>(json['timeZone']),+ rating: serializer.fromJson<int?>(json['rating']),+ projectionType: serializer.fromJson<String?>(json['projectionType']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'assetId': serializer.toJson<String>(assetId),+ 'city': serializer.toJson<String?>(city),+ 'state': serializer.toJson<String?>(state),+ 'country': serializer.toJson<String?>(country),+ 'dateTimeOriginal': serializer.toJson<DateTime?>(dateTimeOriginal),+ 'description': serializer.toJson<String?>(description),+ 'height': serializer.toJson<int?>(height),+ 'width': serializer.toJson<int?>(width),+ 'exposureTime': serializer.toJson<String?>(exposureTime),+ 'fNumber': serializer.toJson<double?>(fNumber),+ 'fileSize': serializer.toJson<int?>(fileSize),+ 'focalLength': serializer.toJson<double?>(focalLength),+ 'latitude': serializer.toJson<double?>(latitude),+ 'longitude': serializer.toJson<double?>(longitude),+ 'iso': serializer.toJson<int?>(iso),+ 'make': serializer.toJson<String?>(make),+ 'model': serializer.toJson<String?>(model),+ 'lens': serializer.toJson<String?>(lens),+ 'orientation': serializer.toJson<String?>(orientation),+ 'timeZone': serializer.toJson<String?>(timeZone),+ 'rating': serializer.toJson<int?>(rating),+ 'projectionType': serializer.toJson<String?>(projectionType),+ };+ }++ RemoteExifEntityData copyWith({+ String? assetId,+ Value<String?> city = const Value.absent(),+ Value<String?> state = const Value.absent(),+ Value<String?> country = const Value.absent(),+ Value<DateTime?> dateTimeOriginal = const Value.absent(),+ Value<String?> description = const Value.absent(),+ Value<int?> height = const Value.absent(),+ Value<int?> width = const Value.absent(),+ Value<String?> exposureTime = const Value.absent(),+ Value<double?> fNumber = const Value.absent(),+ Value<int?> fileSize = const Value.absent(),+ Value<double?> focalLength = const Value.absent(),+ Value<double?> latitude = const Value.absent(),+ Value<double?> longitude = const Value.absent(),+ Value<int?> iso = const Value.absent(),+ Value<String?> make = const Value.absent(),+ Value<String?> model = const Value.absent(),+ Value<String?> lens = const Value.absent(),+ Value<String?> orientation = const Value.absent(),+ Value<String?> timeZone = const Value.absent(),+ Value<int?> rating = const Value.absent(),+ Value<String?> projectionType = const Value.absent(),+ }) => RemoteExifEntityData(+ assetId: assetId ?? this.assetId,+ city: city.present ? city.value : this.city,+ state: state.present ? state.value : this.state,+ country: country.present ? country.value : this.country,+ dateTimeOriginal: dateTimeOriginal.present+ ? dateTimeOriginal.value+ : this.dateTimeOriginal,+ description: description.present ? description.value : this.description,+ height: height.present ? height.value : this.height,+ width: width.present ? width.value : this.width,+ exposureTime: exposureTime.present ? exposureTime.value : this.exposureTime,+ fNumber: fNumber.present ? fNumber.value : this.fNumber,+ fileSize: fileSize.present ? fileSize.value : this.fileSize,+ focalLength: focalLength.present ? focalLength.value : this.focalLength,+ latitude: latitude.present ? latitude.value : this.latitude,+ longitude: longitude.present ? longitude.value : this.longitude,+ iso: iso.present ? iso.value : this.iso,+ make: make.present ? make.value : this.make,+ model: model.present ? model.value : this.model,+ lens: lens.present ? lens.value : this.lens,+ orientation: orientation.present ? orientation.value : this.orientation,+ timeZone: timeZone.present ? timeZone.value : this.timeZone,+ rating: rating.present ? rating.value : this.rating,+ projectionType: projectionType.present+ ? projectionType.value+ : this.projectionType,+ );+ RemoteExifEntityData copyWithCompanion(RemoteExifEntityCompanion data) {+ return RemoteExifEntityData(+ assetId: data.assetId.present ? data.assetId.value : this.assetId,+ city: data.city.present ? data.city.value : this.city,+ state: data.state.present ? data.state.value : this.state,+ country: data.country.present ? data.country.value : this.country,+ dateTimeOriginal: data.dateTimeOriginal.present+ ? data.dateTimeOriginal.value+ : this.dateTimeOriginal,+ description: data.description.present+ ? data.description.value+ : this.description,+ height: data.height.present ? data.height.value : this.height,+ width: data.width.present ? data.width.value : this.width,+ exposureTime: data.exposureTime.present+ ? data.exposureTime.value+ : this.exposureTime,+ fNumber: data.fNumber.present ? data.fNumber.value : this.fNumber,+ fileSize: data.fileSize.present ? data.fileSize.value : this.fileSize,+ focalLength: data.focalLength.present+ ? data.focalLength.value+ : this.focalLength,+ latitude: data.latitude.present ? data.latitude.value : this.latitude,+ longitude: data.longitude.present ? data.longitude.value : this.longitude,+ iso: data.iso.present ? data.iso.value : this.iso,+ make: data.make.present ? data.make.value : this.make,+ model: data.model.present ? data.model.value : this.model,+ lens: data.lens.present ? data.lens.value : this.lens,+ orientation: data.orientation.present+ ? data.orientation.value+ : this.orientation,+ timeZone: data.timeZone.present ? data.timeZone.value : this.timeZone,+ rating: data.rating.present ? data.rating.value : this.rating,+ projectionType: data.projectionType.present+ ? data.projectionType.value+ : this.projectionType,+ );+ }++ @override+ String toString() {+ return (StringBuffer('RemoteExifEntityData(')+ ..write('assetId: $assetId, ')+ ..write('city: $city, ')+ ..write('state: $state, ')+ ..write('country: $country, ')+ ..write('dateTimeOriginal: $dateTimeOriginal, ')+ ..write('description: $description, ')+ ..write('height: $height, ')+ ..write('width: $width, ')+ ..write('exposureTime: $exposureTime, ')+ ..write('fNumber: $fNumber, ')+ ..write('fileSize: $fileSize, ')+ ..write('focalLength: $focalLength, ')+ ..write('latitude: $latitude, ')+ ..write('longitude: $longitude, ')+ ..write('iso: $iso, ')+ ..write('make: $make, ')+ ..write('model: $model, ')+ ..write('lens: $lens, ')+ ..write('orientation: $orientation, ')+ ..write('timeZone: $timeZone, ')+ ..write('rating: $rating, ')+ ..write('projectionType: $projectionType')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hashAll([+ assetId,+ city,+ state,+ country,+ dateTimeOriginal,+ description,+ height,+ width,+ exposureTime,+ fNumber,+ fileSize,+ focalLength,+ latitude,+ longitude,+ iso,+ make,+ model,+ lens,+ orientation,+ timeZone,+ rating,+ projectionType,+ ]);+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is RemoteExifEntityData &&+ other.assetId == this.assetId &&+ other.city == this.city &&+ other.state == this.state &&+ other.country == this.country &&+ other.dateTimeOriginal == this.dateTimeOriginal &&+ other.description == this.description &&+ other.height == this.height &&+ other.width == this.width &&+ other.exposureTime == this.exposureTime &&+ other.fNumber == this.fNumber &&+ other.fileSize == this.fileSize &&+ other.focalLength == this.focalLength &&+ other.latitude == this.latitude &&+ other.longitude == this.longitude &&+ other.iso == this.iso &&+ other.make == this.make &&+ other.model == this.model &&+ other.lens == this.lens &&+ other.orientation == this.orientation &&+ other.timeZone == this.timeZone &&+ other.rating == this.rating &&+ other.projectionType == this.projectionType);+}++class RemoteExifEntityCompanion extends UpdateCompanion<RemoteExifEntityData> {+ final Value<String> assetId;+ final Value<String?> city;+ final Value<String?> state;+ final Value<String?> country;+ final Value<DateTime?> dateTimeOriginal;+ final Value<String?> description;+ final Value<int?> height;+ final Value<int?> width;+ final Value<String?> exposureTime;+ final Value<double?> fNumber;+ final Value<int?> fileSize;+ final Value<double?> focalLength;+ final Value<double?> latitude;+ final Value<double?> longitude;+ final Value<int?> iso;+ final Value<String?> make;+ final Value<String?> model;+ final Value<String?> lens;+ final Value<String?> orientation;+ final Value<String?> timeZone;+ final Value<int?> rating;+ final Value<String?> projectionType;+ const RemoteExifEntityCompanion({+ this.assetId = const Value.absent(),+ this.city = const Value.absent(),+ this.state = const Value.absent(),+ this.country = const Value.absent(),+ this.dateTimeOriginal = const Value.absent(),+ this.description = const Value.absent(),+ this.height = const Value.absent(),+ this.width = const Value.absent(),+ this.exposureTime = const Value.absent(),+ this.fNumber = const Value.absent(),+ this.fileSize = const Value.absent(),+ this.focalLength = const Value.absent(),+ this.latitude = const Value.absent(),+ this.longitude = const Value.absent(),+ this.iso = const Value.absent(),+ this.make = const Value.absent(),+ this.model = const Value.absent(),+ this.lens = const Value.absent(),+ this.orientation = const Value.absent(),+ this.timeZone = const Value.absent(),+ this.rating = const Value.absent(),+ this.projectionType = const Value.absent(),+ });+ RemoteExifEntityCompanion.insert({+ required String assetId,+ this.city = const Value.absent(),+ this.state = const Value.absent(),+ this.country = const Value.absent(),+ this.dateTimeOriginal = const Value.absent(),+ this.description = const Value.absent(),+ this.height = const Value.absent(),+ this.width = const Value.absent(),+ this.exposureTime = const Value.absent(),+ this.fNumber = const Value.absent(),+ this.fileSize = const Value.absent(),+ this.focalLength = const Value.absent(),+ this.latitude = const Value.absent(),+ this.longitude = const Value.absent(),+ this.iso = const Value.absent(),+ this.make = const Value.absent(),+ this.model = const Value.absent(),+ this.lens = const Value.absent(),+ this.orientation = const Value.absent(),+ this.timeZone = const Value.absent(),+ this.rating = const Value.absent(),+ this.projectionType = const Value.absent(),+ }) : assetId = Value(assetId);+ static Insertable<RemoteExifEntityData> custom({+ Expression<String>? assetId,+ Expression<String>? city,+ Expression<String>? state,+ Expression<String>? country,+ Expression<DateTime>? dateTimeOriginal,+ Expression<String>? description,+ Expression<int>? height,+ Expression<int>? width,+ Expression<String>? exposureTime,+ Expression<double>? fNumber,+ Expression<int>? fileSize,+ Expression<double>? focalLength,+ Expression<double>? latitude,+ Expression<double>? longitude,+ Expression<int>? iso,+ Expression<String>? make,+ Expression<String>? model,+ Expression<String>? lens,+ Expression<String>? orientation,+ Expression<String>? timeZone,+ Expression<int>? rating,+ Expression<String>? projectionType,+ }) {+ return RawValuesInsertable({+ if (assetId != null) 'asset_id': assetId,+ if (city != null) 'city': city,+ if (state != null) 'state': state,+ if (country != null) 'country': country,+ if (dateTimeOriginal != null) 'date_time_original': dateTimeOriginal,+ if (description != null) 'description': description,+ if (height != null) 'height': height,+ if (width != null) 'width': width,+ if (exposureTime != null) 'exposure_time': exposureTime,+ if (fNumber != null) 'f_number': fNumber,+ if (fileSize != null) 'file_size': fileSize,+ if (focalLength != null) 'focal_length': focalLength,+ if (latitude != null) 'latitude': latitude,+ if (longitude != null) 'longitude': longitude,+ if (iso != null) 'iso': iso,+ if (make != null) 'make': make,+ if (model != null) 'model': model,+ if (lens != null) 'lens': lens,+ if (orientation != null) 'orientation': orientation,+ if (timeZone != null) 'time_zone': timeZone,+ if (rating != null) 'rating': rating,+ if (projectionType != null) 'projection_type': projectionType,+ });+ }++ RemoteExifEntityCompanion copyWith({+ Value<String>? assetId,+ Value<String?>? city,+ Value<String?>? state,+ Value<String?>? country,+ Value<DateTime?>? dateTimeOriginal,+ Value<String?>? description,+ Value<int?>? height,+ Value<int?>? width,+ Value<String?>? exposureTime,+ Value<double?>? fNumber,+ Value<int?>? fileSize,+ Value<double?>? focalLength,+ Value<double?>? latitude,+ Value<double?>? longitude,+ Value<int?>? iso,+ Value<String?>? make,+ Value<String?>? model,+ Value<String?>? lens,+ Value<String?>? orientation,+ Value<String?>? timeZone,+ Value<int?>? rating,+ Value<String?>? projectionType,+ }) {+ return RemoteExifEntityCompanion(+ assetId: assetId ?? this.assetId,+ city: city ?? this.city,+ state: state ?? this.state,+ country: country ?? this.country,+ dateTimeOriginal: dateTimeOriginal ?? this.dateTimeOriginal,+ description: description ?? this.description,+ height: height ?? this.height,+ width: width ?? this.width,+ exposureTime: exposureTime ?? this.exposureTime,+ fNumber: fNumber ?? this.fNumber,+ fileSize: fileSize ?? this.fileSize,+ focalLength: focalLength ?? this.focalLength,+ latitude: latitude ?? this.latitude,+ longitude: longitude ?? this.longitude,+ iso: iso ?? this.iso,+ make: make ?? this.make,+ model: model ?? this.model,+ lens: lens ?? this.lens,+ orientation: orientation ?? this.orientation,+ timeZone: timeZone ?? this.timeZone,+ rating: rating ?? this.rating,+ projectionType: projectionType ?? this.projectionType,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (assetId.present) {+ map['asset_id'] = Variable<String>(assetId.value);+ }+ if (city.present) {+ map['city'] = Variable<String>(city.value);+ }+ if (state.present) {+ map['state'] = Variable<String>(state.value);+ }+ if (country.present) {+ map['country'] = Variable<String>(country.value);+ }+ if (dateTimeOriginal.present) {+ map['date_time_original'] = Variable<DateTime>(dateTimeOriginal.value);+ }+ if (description.present) {+ map['description'] = Variable<String>(description.value);+ }+ if (height.present) {+ map['height'] = Variable<int>(height.value);+ }+ if (width.present) {+ map['width'] = Variable<int>(width.value);+ }+ if (exposureTime.present) {+ map['exposure_time'] = Variable<String>(exposureTime.value);+ }+ if (fNumber.present) {+ map['f_number'] = Variable<double>(fNumber.value);+ }+ if (fileSize.present) {+ map['file_size'] = Variable<int>(fileSize.value);+ }+ if (focalLength.present) {+ map['focal_length'] = Variable<double>(focalLength.value);+ }+ if (latitude.present) {+ map['latitude'] = Variable<double>(latitude.value);+ }+ if (longitude.present) {+ map['longitude'] = Variable<double>(longitude.value);+ }+ if (iso.present) {+ map['iso'] = Variable<int>(iso.value);+ }+ if (make.present) {+ map['make'] = Variable<String>(make.value);+ }+ if (model.present) {+ map['model'] = Variable<String>(model.value);+ }+ if (lens.present) {+ map['lens'] = Variable<String>(lens.value);+ }+ if (orientation.present) {+ map['orientation'] = Variable<String>(orientation.value);+ }+ if (timeZone.present) {+ map['time_zone'] = Variable<String>(timeZone.value);+ }+ if (rating.present) {+ map['rating'] = Variable<int>(rating.value);+ }+ if (projectionType.present) {+ map['projection_type'] = Variable<String>(projectionType.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('RemoteExifEntityCompanion(')+ ..write('assetId: $assetId, ')+ ..write('city: $city, ')+ ..write('state: $state, ')+ ..write('country: $country, ')+ ..write('dateTimeOriginal: $dateTimeOriginal, ')+ ..write('description: $description, ')+ ..write('height: $height, ')+ ..write('width: $width, ')+ ..write('exposureTime: $exposureTime, ')+ ..write('fNumber: $fNumber, ')+ ..write('fileSize: $fileSize, ')+ ..write('focalLength: $focalLength, ')+ ..write('latitude: $latitude, ')+ ..write('longitude: $longitude, ')+ ..write('iso: $iso, ')+ ..write('make: $make, ')+ ..write('model: $model, ')+ ..write('lens: $lens, ')+ ..write('orientation: $orientation, ')+ ..write('timeZone: $timeZone, ')+ ..write('rating: $rating, ')+ ..write('projectionType: $projectionType')+ ..write(')'))+ .toString();+ }+}++class RemoteAlbumAssetEntity extends Table+ with TableInfo<RemoteAlbumAssetEntity, RemoteAlbumAssetEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ RemoteAlbumAssetEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> assetId = GeneratedColumn<String>(+ 'asset_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES remote_asset_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<String> albumId = GeneratedColumn<String>(+ 'album_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES remote_album_entity (id) ON DELETE CASCADE',+ ),+ );+ @override+ List<GeneratedColumn> get $columns => [assetId, albumId];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'remote_album_asset_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {assetId, albumId};+ @override+ RemoteAlbumAssetEntityData map(+ Map<String, dynamic> data, {+ String? tablePrefix,+ }) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return RemoteAlbumAssetEntityData(+ assetId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}asset_id'],+ )!,+ albumId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}album_id'],+ )!,+ );+ }++ @override+ RemoteAlbumAssetEntity createAlias(String alias) {+ return RemoteAlbumAssetEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class RemoteAlbumAssetEntityData extends DataClass+ implements Insertable<RemoteAlbumAssetEntityData> {+ final String assetId;+ final String albumId;+ const RemoteAlbumAssetEntityData({+ required this.assetId,+ required this.albumId,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['asset_id'] = Variable<String>(assetId);+ map['album_id'] = Variable<String>(albumId);+ return map;+ }++ factory RemoteAlbumAssetEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return RemoteAlbumAssetEntityData(+ assetId: serializer.fromJson<String>(json['assetId']),+ albumId: serializer.fromJson<String>(json['albumId']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'assetId': serializer.toJson<String>(assetId),+ 'albumId': serializer.toJson<String>(albumId),+ };+ }++ RemoteAlbumAssetEntityData copyWith({String? assetId, String? albumId}) =>+ RemoteAlbumAssetEntityData(+ assetId: assetId ?? this.assetId,+ albumId: albumId ?? this.albumId,+ );+ RemoteAlbumAssetEntityData copyWithCompanion(+ RemoteAlbumAssetEntityCompanion data,+ ) {+ return RemoteAlbumAssetEntityData(+ assetId: data.assetId.present ? data.assetId.value : this.assetId,+ albumId: data.albumId.present ? data.albumId.value : this.albumId,+ );+ }++ @override+ String toString() {+ return (StringBuffer('RemoteAlbumAssetEntityData(')+ ..write('assetId: $assetId, ')+ ..write('albumId: $albumId')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(assetId, albumId);+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is RemoteAlbumAssetEntityData &&+ other.assetId == this.assetId &&+ other.albumId == this.albumId);+}++class RemoteAlbumAssetEntityCompanion+ extends UpdateCompanion<RemoteAlbumAssetEntityData> {+ final Value<String> assetId;+ final Value<String> albumId;+ const RemoteAlbumAssetEntityCompanion({+ this.assetId = const Value.absent(),+ this.albumId = const Value.absent(),+ });+ RemoteAlbumAssetEntityCompanion.insert({+ required String assetId,+ required String albumId,+ }) : assetId = Value(assetId),+ albumId = Value(albumId);+ static Insertable<RemoteAlbumAssetEntityData> custom({+ Expression<String>? assetId,+ Expression<String>? albumId,+ }) {+ return RawValuesInsertable({+ if (assetId != null) 'asset_id': assetId,+ if (albumId != null) 'album_id': albumId,+ });+ }++ RemoteAlbumAssetEntityCompanion copyWith({+ Value<String>? assetId,+ Value<String>? albumId,+ }) {+ return RemoteAlbumAssetEntityCompanion(+ assetId: assetId ?? this.assetId,+ albumId: albumId ?? this.albumId,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (assetId.present) {+ map['asset_id'] = Variable<String>(assetId.value);+ }+ if (albumId.present) {+ map['album_id'] = Variable<String>(albumId.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('RemoteAlbumAssetEntityCompanion(')+ ..write('assetId: $assetId, ')+ ..write('albumId: $albumId')+ ..write(')'))+ .toString();+ }+}++class RemoteAlbumUserEntity extends Table+ with TableInfo<RemoteAlbumUserEntity, RemoteAlbumUserEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ RemoteAlbumUserEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> albumId = GeneratedColumn<String>(+ 'album_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES remote_album_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<String> userId = GeneratedColumn<String>(+ 'user_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES user_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<int> role = GeneratedColumn<int>(+ 'role',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ @override+ List<GeneratedColumn> get $columns => [albumId, userId, role];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'remote_album_user_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {albumId, userId};+ @override+ RemoteAlbumUserEntityData map(+ Map<String, dynamic> data, {+ String? tablePrefix,+ }) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return RemoteAlbumUserEntityData(+ albumId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}album_id'],+ )!,+ userId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}user_id'],+ )!,+ role: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}role'],+ )!,+ );+ }++ @override+ RemoteAlbumUserEntity createAlias(String alias) {+ return RemoteAlbumUserEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class RemoteAlbumUserEntityData extends DataClass+ implements Insertable<RemoteAlbumUserEntityData> {+ final String albumId;+ final String userId;+ final int role;+ const RemoteAlbumUserEntityData({+ required this.albumId,+ required this.userId,+ required this.role,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['album_id'] = Variable<String>(albumId);+ map['user_id'] = Variable<String>(userId);+ map['role'] = Variable<int>(role);+ return map;+ }++ factory RemoteAlbumUserEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return RemoteAlbumUserEntityData(+ albumId: serializer.fromJson<String>(json['albumId']),+ userId: serializer.fromJson<String>(json['userId']),+ role: serializer.fromJson<int>(json['role']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'albumId': serializer.toJson<String>(albumId),+ 'userId': serializer.toJson<String>(userId),+ 'role': serializer.toJson<int>(role),+ };+ }++ RemoteAlbumUserEntityData copyWith({+ String? albumId,+ String? userId,+ int? role,+ }) => RemoteAlbumUserEntityData(+ albumId: albumId ?? this.albumId,+ userId: userId ?? this.userId,+ role: role ?? this.role,+ );+ RemoteAlbumUserEntityData copyWithCompanion(+ RemoteAlbumUserEntityCompanion data,+ ) {+ return RemoteAlbumUserEntityData(+ albumId: data.albumId.present ? data.albumId.value : this.albumId,+ userId: data.userId.present ? data.userId.value : this.userId,+ role: data.role.present ? data.role.value : this.role,+ );+ }++ @override+ String toString() {+ return (StringBuffer('RemoteAlbumUserEntityData(')+ ..write('albumId: $albumId, ')+ ..write('userId: $userId, ')+ ..write('role: $role')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(albumId, userId, role);+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is RemoteAlbumUserEntityData &&+ other.albumId == this.albumId &&+ other.userId == this.userId &&+ other.role == this.role);+}++class RemoteAlbumUserEntityCompanion+ extends UpdateCompanion<RemoteAlbumUserEntityData> {+ final Value<String> albumId;+ final Value<String> userId;+ final Value<int> role;+ const RemoteAlbumUserEntityCompanion({+ this.albumId = const Value.absent(),+ this.userId = const Value.absent(),+ this.role = const Value.absent(),+ });+ RemoteAlbumUserEntityCompanion.insert({+ required String albumId,+ required String userId,+ required int role,+ }) : albumId = Value(albumId),+ userId = Value(userId),+ role = Value(role);+ static Insertable<RemoteAlbumUserEntityData> custom({+ Expression<String>? albumId,+ Expression<String>? userId,+ Expression<int>? role,+ }) {+ return RawValuesInsertable({+ if (albumId != null) 'album_id': albumId,+ if (userId != null) 'user_id': userId,+ if (role != null) 'role': role,+ });+ }++ RemoteAlbumUserEntityCompanion copyWith({+ Value<String>? albumId,+ Value<String>? userId,+ Value<int>? role,+ }) {+ return RemoteAlbumUserEntityCompanion(+ albumId: albumId ?? this.albumId,+ userId: userId ?? this.userId,+ role: role ?? this.role,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (albumId.present) {+ map['album_id'] = Variable<String>(albumId.value);+ }+ if (userId.present) {+ map['user_id'] = Variable<String>(userId.value);+ }+ if (role.present) {+ map['role'] = Variable<int>(role.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('RemoteAlbumUserEntityCompanion(')+ ..write('albumId: $albumId, ')+ ..write('userId: $userId, ')+ ..write('role: $role')+ ..write(')'))+ .toString();+ }+}++class MemoryEntity extends Table+ with TableInfo<MemoryEntity, MemoryEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ MemoryEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> id = GeneratedColumn<String>(+ 'id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(+ 'created_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(+ 'updated_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(+ 'deleted_at',+ aliasedName,+ true,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> ownerId = GeneratedColumn<String>(+ 'owner_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES user_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<int> type = GeneratedColumn<int>(+ 'type',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> data = GeneratedColumn<String>(+ 'data',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<bool> isSaved = GeneratedColumn<bool>(+ 'is_saved',+ aliasedName,+ false,+ type: DriftSqlType.bool,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("is_saved" IN (0, 1))',+ ),+ defaultValue: const CustomExpression('0'),+ );+ late final GeneratedColumn<DateTime> memoryAt = GeneratedColumn<DateTime>(+ 'memory_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<DateTime> seenAt = GeneratedColumn<DateTime>(+ 'seen_at',+ aliasedName,+ true,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<DateTime> showAt = GeneratedColumn<DateTime>(+ 'show_at',+ aliasedName,+ true,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<DateTime> hideAt = GeneratedColumn<DateTime>(+ 'hide_at',+ aliasedName,+ true,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ );+ @override+ List<GeneratedColumn> get $columns => [+ id,+ createdAt,+ updatedAt,+ deletedAt,+ ownerId,+ type,+ data,+ isSaved,+ memoryAt,+ seenAt,+ showAt,+ hideAt,+ ];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'memory_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {id};+ @override+ MemoryEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return MemoryEntityData(+ id: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}id'],+ )!,+ createdAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}created_at'],+ )!,+ updatedAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}updated_at'],+ )!,+ deletedAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}deleted_at'],+ ),+ ownerId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}owner_id'],+ )!,+ type: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}type'],+ )!,+ data: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}data'],+ )!,+ isSaved: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}is_saved'],+ )!,+ memoryAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}memory_at'],+ )!,+ seenAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}seen_at'],+ ),+ showAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}show_at'],+ ),+ hideAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}hide_at'],+ ),+ );+ }++ @override+ MemoryEntity createAlias(String alias) {+ return MemoryEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class MemoryEntityData extends DataClass+ implements Insertable<MemoryEntityData> {+ final String id;+ final DateTime createdAt;+ final DateTime updatedAt;+ final DateTime? deletedAt;+ final String ownerId;+ final int type;+ final String data;+ final bool isSaved;+ final DateTime memoryAt;+ final DateTime? seenAt;+ final DateTime? showAt;+ final DateTime? hideAt;+ const MemoryEntityData({+ required this.id,+ required this.createdAt,+ required this.updatedAt,+ this.deletedAt,+ required this.ownerId,+ required this.type,+ required this.data,+ required this.isSaved,+ required this.memoryAt,+ this.seenAt,+ this.showAt,+ this.hideAt,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['id'] = Variable<String>(id);+ map['created_at'] = Variable<DateTime>(createdAt);+ map['updated_at'] = Variable<DateTime>(updatedAt);+ if (!nullToAbsent || deletedAt != null) {+ map['deleted_at'] = Variable<DateTime>(deletedAt);+ }+ map['owner_id'] = Variable<String>(ownerId);+ map['type'] = Variable<int>(type);+ map['data'] = Variable<String>(data);+ map['is_saved'] = Variable<bool>(isSaved);+ map['memory_at'] = Variable<DateTime>(memoryAt);+ if (!nullToAbsent || seenAt != null) {+ map['seen_at'] = Variable<DateTime>(seenAt);+ }+ if (!nullToAbsent || showAt != null) {+ map['show_at'] = Variable<DateTime>(showAt);+ }+ if (!nullToAbsent || hideAt != null) {+ map['hide_at'] = Variable<DateTime>(hideAt);+ }+ return map;+ }++ factory MemoryEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return MemoryEntityData(+ id: serializer.fromJson<String>(json['id']),+ createdAt: serializer.fromJson<DateTime>(json['createdAt']),+ updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),+ deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),+ ownerId: serializer.fromJson<String>(json['ownerId']),+ type: serializer.fromJson<int>(json['type']),+ data: serializer.fromJson<String>(json['data']),+ isSaved: serializer.fromJson<bool>(json['isSaved']),+ memoryAt: serializer.fromJson<DateTime>(json['memoryAt']),+ seenAt: serializer.fromJson<DateTime?>(json['seenAt']),+ showAt: serializer.fromJson<DateTime?>(json['showAt']),+ hideAt: serializer.fromJson<DateTime?>(json['hideAt']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'id': serializer.toJson<String>(id),+ 'createdAt': serializer.toJson<DateTime>(createdAt),+ 'updatedAt': serializer.toJson<DateTime>(updatedAt),+ 'deletedAt': serializer.toJson<DateTime?>(deletedAt),+ 'ownerId': serializer.toJson<String>(ownerId),+ 'type': serializer.toJson<int>(type),+ 'data': serializer.toJson<String>(data),+ 'isSaved': serializer.toJson<bool>(isSaved),+ 'memoryAt': serializer.toJson<DateTime>(memoryAt),+ 'seenAt': serializer.toJson<DateTime?>(seenAt),+ 'showAt': serializer.toJson<DateTime?>(showAt),+ 'hideAt': serializer.toJson<DateTime?>(hideAt),+ };+ }++ MemoryEntityData copyWith({+ String? id,+ DateTime? createdAt,+ DateTime? updatedAt,+ Value<DateTime?> deletedAt = const Value.absent(),+ String? ownerId,+ int? type,+ String? data,+ bool? isSaved,+ DateTime? memoryAt,+ Value<DateTime?> seenAt = const Value.absent(),+ Value<DateTime?> showAt = const Value.absent(),+ Value<DateTime?> hideAt = const Value.absent(),+ }) => MemoryEntityData(+ id: id ?? this.id,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,+ ownerId: ownerId ?? this.ownerId,+ type: type ?? this.type,+ data: data ?? this.data,+ isSaved: isSaved ?? this.isSaved,+ memoryAt: memoryAt ?? this.memoryAt,+ seenAt: seenAt.present ? seenAt.value : this.seenAt,+ showAt: showAt.present ? showAt.value : this.showAt,+ hideAt: hideAt.present ? hideAt.value : this.hideAt,+ );+ MemoryEntityData copyWithCompanion(MemoryEntityCompanion data) {+ return MemoryEntityData(+ id: data.id.present ? data.id.value : this.id,+ createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,+ updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,+ deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,+ ownerId: data.ownerId.present ? data.ownerId.value : this.ownerId,+ type: data.type.present ? data.type.value : this.type,+ data: data.data.present ? data.data.value : this.data,+ isSaved: data.isSaved.present ? data.isSaved.value : this.isSaved,+ memoryAt: data.memoryAt.present ? data.memoryAt.value : this.memoryAt,+ seenAt: data.seenAt.present ? data.seenAt.value : this.seenAt,+ showAt: data.showAt.present ? data.showAt.value : this.showAt,+ hideAt: data.hideAt.present ? data.hideAt.value : this.hideAt,+ );+ }++ @override+ String toString() {+ return (StringBuffer('MemoryEntityData(')+ ..write('id: $id, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('deletedAt: $deletedAt, ')+ ..write('ownerId: $ownerId, ')+ ..write('type: $type, ')+ ..write('data: $data, ')+ ..write('isSaved: $isSaved, ')+ ..write('memoryAt: $memoryAt, ')+ ..write('seenAt: $seenAt, ')+ ..write('showAt: $showAt, ')+ ..write('hideAt: $hideAt')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(+ id,+ createdAt,+ updatedAt,+ deletedAt,+ ownerId,+ type,+ data,+ isSaved,+ memoryAt,+ seenAt,+ showAt,+ hideAt,+ );+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is MemoryEntityData &&+ other.id == this.id &&+ other.createdAt == this.createdAt &&+ other.updatedAt == this.updatedAt &&+ other.deletedAt == this.deletedAt &&+ other.ownerId == this.ownerId &&+ other.type == this.type &&+ other.data == this.data &&+ other.isSaved == this.isSaved &&+ other.memoryAt == this.memoryAt &&+ other.seenAt == this.seenAt &&+ other.showAt == this.showAt &&+ other.hideAt == this.hideAt);+}++class MemoryEntityCompanion extends UpdateCompanion<MemoryEntityData> {+ final Value<String> id;+ final Value<DateTime> createdAt;+ final Value<DateTime> updatedAt;+ final Value<DateTime?> deletedAt;+ final Value<String> ownerId;+ final Value<int> type;+ final Value<String> data;+ final Value<bool> isSaved;+ final Value<DateTime> memoryAt;+ final Value<DateTime?> seenAt;+ final Value<DateTime?> showAt;+ final Value<DateTime?> hideAt;+ const MemoryEntityCompanion({+ this.id = const Value.absent(),+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ this.deletedAt = const Value.absent(),+ this.ownerId = const Value.absent(),+ this.type = const Value.absent(),+ this.data = const Value.absent(),+ this.isSaved = const Value.absent(),+ this.memoryAt = const Value.absent(),+ this.seenAt = const Value.absent(),+ this.showAt = const Value.absent(),+ this.hideAt = const Value.absent(),+ });+ MemoryEntityCompanion.insert({+ required String id,+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ this.deletedAt = const Value.absent(),+ required String ownerId,+ required int type,+ required String data,+ this.isSaved = const Value.absent(),+ required DateTime memoryAt,+ this.seenAt = const Value.absent(),+ this.showAt = const Value.absent(),+ this.hideAt = const Value.absent(),+ }) : id = Value(id),+ ownerId = Value(ownerId),+ type = Value(type),+ data = Value(data),+ memoryAt = Value(memoryAt);+ static Insertable<MemoryEntityData> custom({+ Expression<String>? id,+ Expression<DateTime>? createdAt,+ Expression<DateTime>? updatedAt,+ Expression<DateTime>? deletedAt,+ Expression<String>? ownerId,+ Expression<int>? type,+ Expression<String>? data,+ Expression<bool>? isSaved,+ Expression<DateTime>? memoryAt,+ Expression<DateTime>? seenAt,+ Expression<DateTime>? showAt,+ Expression<DateTime>? hideAt,+ }) {+ return RawValuesInsertable({+ if (id != null) 'id': id,+ if (createdAt != null) 'created_at': createdAt,+ if (updatedAt != null) 'updated_at': updatedAt,+ if (deletedAt != null) 'deleted_at': deletedAt,+ if (ownerId != null) 'owner_id': ownerId,+ if (type != null) 'type': type,+ if (data != null) 'data': data,+ if (isSaved != null) 'is_saved': isSaved,+ if (memoryAt != null) 'memory_at': memoryAt,+ if (seenAt != null) 'seen_at': seenAt,+ if (showAt != null) 'show_at': showAt,+ if (hideAt != null) 'hide_at': hideAt,+ });+ }++ MemoryEntityCompanion copyWith({+ Value<String>? id,+ Value<DateTime>? createdAt,+ Value<DateTime>? updatedAt,+ Value<DateTime?>? deletedAt,+ Value<String>? ownerId,+ Value<int>? type,+ Value<String>? data,+ Value<bool>? isSaved,+ Value<DateTime>? memoryAt,+ Value<DateTime?>? seenAt,+ Value<DateTime?>? showAt,+ Value<DateTime?>? hideAt,+ }) {+ return MemoryEntityCompanion(+ id: id ?? this.id,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ deletedAt: deletedAt ?? this.deletedAt,+ ownerId: ownerId ?? this.ownerId,+ type: type ?? this.type,+ data: data ?? this.data,+ isSaved: isSaved ?? this.isSaved,+ memoryAt: memoryAt ?? this.memoryAt,+ seenAt: seenAt ?? this.seenAt,+ showAt: showAt ?? this.showAt,+ hideAt: hideAt ?? this.hideAt,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (id.present) {+ map['id'] = Variable<String>(id.value);+ }+ if (createdAt.present) {+ map['created_at'] = Variable<DateTime>(createdAt.value);+ }+ if (updatedAt.present) {+ map['updated_at'] = Variable<DateTime>(updatedAt.value);+ }+ if (deletedAt.present) {+ map['deleted_at'] = Variable<DateTime>(deletedAt.value);+ }+ if (ownerId.present) {+ map['owner_id'] = Variable<String>(ownerId.value);+ }+ if (type.present) {+ map['type'] = Variable<int>(type.value);+ }+ if (data.present) {+ map['data'] = Variable<String>(data.value);+ }+ if (isSaved.present) {+ map['is_saved'] = Variable<bool>(isSaved.value);+ }+ if (memoryAt.present) {+ map['memory_at'] = Variable<DateTime>(memoryAt.value);+ }+ if (seenAt.present) {+ map['seen_at'] = Variable<DateTime>(seenAt.value);+ }+ if (showAt.present) {+ map['show_at'] = Variable<DateTime>(showAt.value);+ }+ if (hideAt.present) {+ map['hide_at'] = Variable<DateTime>(hideAt.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('MemoryEntityCompanion(')+ ..write('id: $id, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('deletedAt: $deletedAt, ')+ ..write('ownerId: $ownerId, ')+ ..write('type: $type, ')+ ..write('data: $data, ')+ ..write('isSaved: $isSaved, ')+ ..write('memoryAt: $memoryAt, ')+ ..write('seenAt: $seenAt, ')+ ..write('showAt: $showAt, ')+ ..write('hideAt: $hideAt')+ ..write(')'))+ .toString();+ }+}++class MemoryAssetEntity extends Table+ with TableInfo<MemoryAssetEntity, MemoryAssetEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ MemoryAssetEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> assetId = GeneratedColumn<String>(+ 'asset_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES remote_asset_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<String> memoryId = GeneratedColumn<String>(+ 'memory_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES memory_entity (id) ON DELETE CASCADE',+ ),+ );+ @override+ List<GeneratedColumn> get $columns => [assetId, memoryId];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'memory_asset_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {assetId, memoryId};+ @override+ MemoryAssetEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return MemoryAssetEntityData(+ assetId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}asset_id'],+ )!,+ memoryId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}memory_id'],+ )!,+ );+ }++ @override+ MemoryAssetEntity createAlias(String alias) {+ return MemoryAssetEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class MemoryAssetEntityData extends DataClass+ implements Insertable<MemoryAssetEntityData> {+ final String assetId;+ final String memoryId;+ const MemoryAssetEntityData({required this.assetId, required this.memoryId});+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['asset_id'] = Variable<String>(assetId);+ map['memory_id'] = Variable<String>(memoryId);+ return map;+ }++ factory MemoryAssetEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return MemoryAssetEntityData(+ assetId: serializer.fromJson<String>(json['assetId']),+ memoryId: serializer.fromJson<String>(json['memoryId']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'assetId': serializer.toJson<String>(assetId),+ 'memoryId': serializer.toJson<String>(memoryId),+ };+ }++ MemoryAssetEntityData copyWith({String? assetId, String? memoryId}) =>+ MemoryAssetEntityData(+ assetId: assetId ?? this.assetId,+ memoryId: memoryId ?? this.memoryId,+ );+ MemoryAssetEntityData copyWithCompanion(MemoryAssetEntityCompanion data) {+ return MemoryAssetEntityData(+ assetId: data.assetId.present ? data.assetId.value : this.assetId,+ memoryId: data.memoryId.present ? data.memoryId.value : this.memoryId,+ );+ }++ @override+ String toString() {+ return (StringBuffer('MemoryAssetEntityData(')+ ..write('assetId: $assetId, ')+ ..write('memoryId: $memoryId')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(assetId, memoryId);+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is MemoryAssetEntityData &&+ other.assetId == this.assetId &&+ other.memoryId == this.memoryId);+}++class MemoryAssetEntityCompanion+ extends UpdateCompanion<MemoryAssetEntityData> {+ final Value<String> assetId;+ final Value<String> memoryId;+ const MemoryAssetEntityCompanion({+ this.assetId = const Value.absent(),+ this.memoryId = const Value.absent(),+ });+ MemoryAssetEntityCompanion.insert({+ required String assetId,+ required String memoryId,+ }) : assetId = Value(assetId),+ memoryId = Value(memoryId);+ static Insertable<MemoryAssetEntityData> custom({+ Expression<String>? assetId,+ Expression<String>? memoryId,+ }) {+ return RawValuesInsertable({+ if (assetId != null) 'asset_id': assetId,+ if (memoryId != null) 'memory_id': memoryId,+ });+ }++ MemoryAssetEntityCompanion copyWith({+ Value<String>? assetId,+ Value<String>? memoryId,+ }) {+ return MemoryAssetEntityCompanion(+ assetId: assetId ?? this.assetId,+ memoryId: memoryId ?? this.memoryId,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (assetId.present) {+ map['asset_id'] = Variable<String>(assetId.value);+ }+ if (memoryId.present) {+ map['memory_id'] = Variable<String>(memoryId.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('MemoryAssetEntityCompanion(')+ ..write('assetId: $assetId, ')+ ..write('memoryId: $memoryId')+ ..write(')'))+ .toString();+ }+}++class PersonEntity extends Table+ with TableInfo<PersonEntity, PersonEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ PersonEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> id = GeneratedColumn<String>(+ 'id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(+ 'created_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(+ 'updated_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<String> ownerId = GeneratedColumn<String>(+ 'owner_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES user_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<String> name = GeneratedColumn<String>(+ 'name',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> faceAssetId = GeneratedColumn<String>(+ 'face_asset_id',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<bool> isFavorite = GeneratedColumn<bool>(+ 'is_favorite',+ aliasedName,+ false,+ type: DriftSqlType.bool,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("is_favorite" IN (0, 1))',+ ),+ );+ late final GeneratedColumn<bool> isHidden = GeneratedColumn<bool>(+ 'is_hidden',+ aliasedName,+ false,+ type: DriftSqlType.bool,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("is_hidden" IN (0, 1))',+ ),+ );+ late final GeneratedColumn<String> color = GeneratedColumn<String>(+ 'color',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<DateTime> birthDate = GeneratedColumn<DateTime>(+ 'birth_date',+ aliasedName,+ true,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ );+ @override+ List<GeneratedColumn> get $columns => [+ id,+ createdAt,+ updatedAt,+ ownerId,+ name,+ faceAssetId,+ isFavorite,+ isHidden,+ color,+ birthDate,+ ];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'person_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {id};+ @override+ PersonEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return PersonEntityData(+ id: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}id'],+ )!,+ createdAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}created_at'],+ )!,+ updatedAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}updated_at'],+ )!,+ ownerId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}owner_id'],+ )!,+ name: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}name'],+ )!,+ faceAssetId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}face_asset_id'],+ ),+ isFavorite: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}is_favorite'],+ )!,+ isHidden: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}is_hidden'],+ )!,+ color: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}color'],+ ),+ birthDate: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}birth_date'],+ ),+ );+ }++ @override+ PersonEntity createAlias(String alias) {+ return PersonEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class PersonEntityData extends DataClass+ implements Insertable<PersonEntityData> {+ final String id;+ final DateTime createdAt;+ final DateTime updatedAt;+ final String ownerId;+ final String name;+ final String? faceAssetId;+ final bool isFavorite;+ final bool isHidden;+ final String? color;+ final DateTime? birthDate;+ const PersonEntityData({+ required this.id,+ required this.createdAt,+ required this.updatedAt,+ required this.ownerId,+ required this.name,+ this.faceAssetId,+ required this.isFavorite,+ required this.isHidden,+ this.color,+ this.birthDate,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['id'] = Variable<String>(id);+ map['created_at'] = Variable<DateTime>(createdAt);+ map['updated_at'] = Variable<DateTime>(updatedAt);+ map['owner_id'] = Variable<String>(ownerId);+ map['name'] = Variable<String>(name);+ if (!nullToAbsent || faceAssetId != null) {+ map['face_asset_id'] = Variable<String>(faceAssetId);+ }+ map['is_favorite'] = Variable<bool>(isFavorite);+ map['is_hidden'] = Variable<bool>(isHidden);+ if (!nullToAbsent || color != null) {+ map['color'] = Variable<String>(color);+ }+ if (!nullToAbsent || birthDate != null) {+ map['birth_date'] = Variable<DateTime>(birthDate);+ }+ return map;+ }++ factory PersonEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return PersonEntityData(+ id: serializer.fromJson<String>(json['id']),+ createdAt: serializer.fromJson<DateTime>(json['createdAt']),+ updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),+ ownerId: serializer.fromJson<String>(json['ownerId']),+ name: serializer.fromJson<String>(json['name']),+ faceAssetId: serializer.fromJson<String?>(json['faceAssetId']),+ isFavorite: serializer.fromJson<bool>(json['isFavorite']),+ isHidden: serializer.fromJson<bool>(json['isHidden']),+ color: serializer.fromJson<String?>(json['color']),+ birthDate: serializer.fromJson<DateTime?>(json['birthDate']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'id': serializer.toJson<String>(id),+ 'createdAt': serializer.toJson<DateTime>(createdAt),+ 'updatedAt': serializer.toJson<DateTime>(updatedAt),+ 'ownerId': serializer.toJson<String>(ownerId),+ 'name': serializer.toJson<String>(name),+ 'faceAssetId': serializer.toJson<String?>(faceAssetId),+ 'isFavorite': serializer.toJson<bool>(isFavorite),+ 'isHidden': serializer.toJson<bool>(isHidden),+ 'color': serializer.toJson<String?>(color),+ 'birthDate': serializer.toJson<DateTime?>(birthDate),+ };+ }++ PersonEntityData copyWith({+ String? id,+ DateTime? createdAt,+ DateTime? updatedAt,+ String? ownerId,+ String? name,+ Value<String?> faceAssetId = const Value.absent(),+ bool? isFavorite,+ bool? isHidden,+ Value<String?> color = const Value.absent(),+ Value<DateTime?> birthDate = const Value.absent(),+ }) => PersonEntityData(+ id: id ?? this.id,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ ownerId: ownerId ?? this.ownerId,+ name: name ?? this.name,+ faceAssetId: faceAssetId.present ? faceAssetId.value : this.faceAssetId,+ isFavorite: isFavorite ?? this.isFavorite,+ isHidden: isHidden ?? this.isHidden,+ color: color.present ? color.value : this.color,+ birthDate: birthDate.present ? birthDate.value : this.birthDate,+ );+ PersonEntityData copyWithCompanion(PersonEntityCompanion data) {+ return PersonEntityData(+ id: data.id.present ? data.id.value : this.id,+ createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,+ updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,+ ownerId: data.ownerId.present ? data.ownerId.value : this.ownerId,+ name: data.name.present ? data.name.value : this.name,+ faceAssetId: data.faceAssetId.present+ ? data.faceAssetId.value+ : this.faceAssetId,+ isFavorite: data.isFavorite.present+ ? data.isFavorite.value+ : this.isFavorite,+ isHidden: data.isHidden.present ? data.isHidden.value : this.isHidden,+ color: data.color.present ? data.color.value : this.color,+ birthDate: data.birthDate.present ? data.birthDate.value : this.birthDate,+ );+ }++ @override+ String toString() {+ return (StringBuffer('PersonEntityData(')+ ..write('id: $id, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('ownerId: $ownerId, ')+ ..write('name: $name, ')+ ..write('faceAssetId: $faceAssetId, ')+ ..write('isFavorite: $isFavorite, ')+ ..write('isHidden: $isHidden, ')+ ..write('color: $color, ')+ ..write('birthDate: $birthDate')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(+ id,+ createdAt,+ updatedAt,+ ownerId,+ name,+ faceAssetId,+ isFavorite,+ isHidden,+ color,+ birthDate,+ );+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is PersonEntityData &&+ other.id == this.id &&+ other.createdAt == this.createdAt &&+ other.updatedAt == this.updatedAt &&+ other.ownerId == this.ownerId &&+ other.name == this.name &&+ other.faceAssetId == this.faceAssetId &&+ other.isFavorite == this.isFavorite &&+ other.isHidden == this.isHidden &&+ other.color == this.color &&+ other.birthDate == this.birthDate);+}++class PersonEntityCompanion extends UpdateCompanion<PersonEntityData> {+ final Value<String> id;+ final Value<DateTime> createdAt;+ final Value<DateTime> updatedAt;+ final Value<String> ownerId;+ final Value<String> name;+ final Value<String?> faceAssetId;+ final Value<bool> isFavorite;+ final Value<bool> isHidden;+ final Value<String?> color;+ final Value<DateTime?> birthDate;+ const PersonEntityCompanion({+ this.id = const Value.absent(),+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ this.ownerId = const Value.absent(),+ this.name = const Value.absent(),+ this.faceAssetId = const Value.absent(),+ this.isFavorite = const Value.absent(),+ this.isHidden = const Value.absent(),+ this.color = const Value.absent(),+ this.birthDate = const Value.absent(),+ });+ PersonEntityCompanion.insert({+ required String id,+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ required String ownerId,+ required String name,+ this.faceAssetId = const Value.absent(),+ required bool isFavorite,+ required bool isHidden,+ this.color = const Value.absent(),+ this.birthDate = const Value.absent(),+ }) : id = Value(id),+ ownerId = Value(ownerId),+ name = Value(name),+ isFavorite = Value(isFavorite),+ isHidden = Value(isHidden);+ static Insertable<PersonEntityData> custom({+ Expression<String>? id,+ Expression<DateTime>? createdAt,+ Expression<DateTime>? updatedAt,+ Expression<String>? ownerId,+ Expression<String>? name,+ Expression<String>? faceAssetId,+ Expression<bool>? isFavorite,+ Expression<bool>? isHidden,+ Expression<String>? color,+ Expression<DateTime>? birthDate,+ }) {+ return RawValuesInsertable({+ if (id != null) 'id': id,+ if (createdAt != null) 'created_at': createdAt,+ if (updatedAt != null) 'updated_at': updatedAt,+ if (ownerId != null) 'owner_id': ownerId,+ if (name != null) 'name': name,+ if (faceAssetId != null) 'face_asset_id': faceAssetId,+ if (isFavorite != null) 'is_favorite': isFavorite,+ if (isHidden != null) 'is_hidden': isHidden,+ if (color != null) 'color': color,+ if (birthDate != null) 'birth_date': birthDate,+ });+ }++ PersonEntityCompanion copyWith({+ Value<String>? id,+ Value<DateTime>? createdAt,+ Value<DateTime>? updatedAt,+ Value<String>? ownerId,+ Value<String>? name,+ Value<String?>? faceAssetId,+ Value<bool>? isFavorite,+ Value<bool>? isHidden,+ Value<String?>? color,+ Value<DateTime?>? birthDate,+ }) {+ return PersonEntityCompanion(+ id: id ?? this.id,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ ownerId: ownerId ?? this.ownerId,+ name: name ?? this.name,+ faceAssetId: faceAssetId ?? this.faceAssetId,+ isFavorite: isFavorite ?? this.isFavorite,+ isHidden: isHidden ?? this.isHidden,+ color: color ?? this.color,+ birthDate: birthDate ?? this.birthDate,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (id.present) {+ map['id'] = Variable<String>(id.value);+ }+ if (createdAt.present) {+ map['created_at'] = Variable<DateTime>(createdAt.value);+ }+ if (updatedAt.present) {+ map['updated_at'] = Variable<DateTime>(updatedAt.value);+ }+ if (ownerId.present) {+ map['owner_id'] = Variable<String>(ownerId.value);+ }+ if (name.present) {+ map['name'] = Variable<String>(name.value);+ }+ if (faceAssetId.present) {+ map['face_asset_id'] = Variable<String>(faceAssetId.value);+ }+ if (isFavorite.present) {+ map['is_favorite'] = Variable<bool>(isFavorite.value);+ }+ if (isHidden.present) {+ map['is_hidden'] = Variable<bool>(isHidden.value);+ }+ if (color.present) {+ map['color'] = Variable<String>(color.value);+ }+ if (birthDate.present) {+ map['birth_date'] = Variable<DateTime>(birthDate.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('PersonEntityCompanion(')+ ..write('id: $id, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('ownerId: $ownerId, ')+ ..write('name: $name, ')+ ..write('faceAssetId: $faceAssetId, ')+ ..write('isFavorite: $isFavorite, ')+ ..write('isHidden: $isHidden, ')+ ..write('color: $color, ')+ ..write('birthDate: $birthDate')+ ..write(')'))+ .toString();+ }+}++class AssetFaceEntity extends Table+ with TableInfo<AssetFaceEntity, AssetFaceEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ AssetFaceEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> id = GeneratedColumn<String>(+ 'id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> assetId = GeneratedColumn<String>(+ 'asset_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES remote_asset_entity (id) ON DELETE CASCADE',+ ),+ );+ late final GeneratedColumn<String> personId = GeneratedColumn<String>(+ 'person_id',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'REFERENCES person_entity (id) ON DELETE SET NULL',+ ),+ );+ late final GeneratedColumn<int> imageWidth = GeneratedColumn<int>(+ 'image_width',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<int> imageHeight = GeneratedColumn<int>(+ 'image_height',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<int> boundingBoxX1 = GeneratedColumn<int>(+ 'bounding_box_x1',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<int> boundingBoxY1 = GeneratedColumn<int>(+ 'bounding_box_y1',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<int> boundingBoxX2 = GeneratedColumn<int>(+ 'bounding_box_x2',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<int> boundingBoxY2 = GeneratedColumn<int>(+ 'bounding_box_y2',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> sourceType = GeneratedColumn<String>(+ 'source_type',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ @override+ List<GeneratedColumn> get $columns => [+ id,+ assetId,+ personId,+ imageWidth,+ imageHeight,+ boundingBoxX1,+ boundingBoxY1,+ boundingBoxX2,+ boundingBoxY2,+ sourceType,+ ];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'asset_face_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {id};+ @override+ AssetFaceEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return AssetFaceEntityData(+ id: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}id'],+ )!,+ assetId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}asset_id'],+ )!,+ personId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}person_id'],+ ),+ imageWidth: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}image_width'],+ )!,+ imageHeight: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}image_height'],+ )!,+ boundingBoxX1: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}bounding_box_x1'],+ )!,+ boundingBoxY1: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}bounding_box_y1'],+ )!,+ boundingBoxX2: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}bounding_box_x2'],+ )!,+ boundingBoxY2: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}bounding_box_y2'],+ )!,+ sourceType: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}source_type'],+ )!,+ );+ }++ @override+ AssetFaceEntity createAlias(String alias) {+ return AssetFaceEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class AssetFaceEntityData extends DataClass+ implements Insertable<AssetFaceEntityData> {+ final String id;+ final String assetId;+ final String? personId;+ final int imageWidth;+ final int imageHeight;+ final int boundingBoxX1;+ final int boundingBoxY1;+ final int boundingBoxX2;+ final int boundingBoxY2;+ final String sourceType;+ const AssetFaceEntityData({+ required this.id,+ required this.assetId,+ this.personId,+ required this.imageWidth,+ required this.imageHeight,+ required this.boundingBoxX1,+ required this.boundingBoxY1,+ required this.boundingBoxX2,+ required this.boundingBoxY2,+ required this.sourceType,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['id'] = Variable<String>(id);+ map['asset_id'] = Variable<String>(assetId);+ if (!nullToAbsent || personId != null) {+ map['person_id'] = Variable<String>(personId);+ }+ map['image_width'] = Variable<int>(imageWidth);+ map['image_height'] = Variable<int>(imageHeight);+ map['bounding_box_x1'] = Variable<int>(boundingBoxX1);+ map['bounding_box_y1'] = Variable<int>(boundingBoxY1);+ map['bounding_box_x2'] = Variable<int>(boundingBoxX2);+ map['bounding_box_y2'] = Variable<int>(boundingBoxY2);+ map['source_type'] = Variable<String>(sourceType);+ return map;+ }++ factory AssetFaceEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return AssetFaceEntityData(+ id: serializer.fromJson<String>(json['id']),+ assetId: serializer.fromJson<String>(json['assetId']),+ personId: serializer.fromJson<String?>(json['personId']),+ imageWidth: serializer.fromJson<int>(json['imageWidth']),+ imageHeight: serializer.fromJson<int>(json['imageHeight']),+ boundingBoxX1: serializer.fromJson<int>(json['boundingBoxX1']),+ boundingBoxY1: serializer.fromJson<int>(json['boundingBoxY1']),+ boundingBoxX2: serializer.fromJson<int>(json['boundingBoxX2']),+ boundingBoxY2: serializer.fromJson<int>(json['boundingBoxY2']),+ sourceType: serializer.fromJson<String>(json['sourceType']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'id': serializer.toJson<String>(id),+ 'assetId': serializer.toJson<String>(assetId),+ 'personId': serializer.toJson<String?>(personId),+ 'imageWidth': serializer.toJson<int>(imageWidth),+ 'imageHeight': serializer.toJson<int>(imageHeight),+ 'boundingBoxX1': serializer.toJson<int>(boundingBoxX1),+ 'boundingBoxY1': serializer.toJson<int>(boundingBoxY1),+ 'boundingBoxX2': serializer.toJson<int>(boundingBoxX2),+ 'boundingBoxY2': serializer.toJson<int>(boundingBoxY2),+ 'sourceType': serializer.toJson<String>(sourceType),+ };+ }++ AssetFaceEntityData copyWith({+ String? id,+ String? assetId,+ Value<String?> personId = const Value.absent(),+ int? imageWidth,+ int? imageHeight,+ int? boundingBoxX1,+ int? boundingBoxY1,+ int? boundingBoxX2,+ int? boundingBoxY2,+ String? sourceType,+ }) => AssetFaceEntityData(+ id: id ?? this.id,+ assetId: assetId ?? this.assetId,+ personId: personId.present ? personId.value : this.personId,+ imageWidth: imageWidth ?? this.imageWidth,+ imageHeight: imageHeight ?? this.imageHeight,+ boundingBoxX1: boundingBoxX1 ?? this.boundingBoxX1,+ boundingBoxY1: boundingBoxY1 ?? this.boundingBoxY1,+ boundingBoxX2: boundingBoxX2 ?? this.boundingBoxX2,+ boundingBoxY2: boundingBoxY2 ?? this.boundingBoxY2,+ sourceType: sourceType ?? this.sourceType,+ );+ AssetFaceEntityData copyWithCompanion(AssetFaceEntityCompanion data) {+ return AssetFaceEntityData(+ id: data.id.present ? data.id.value : this.id,+ assetId: data.assetId.present ? data.assetId.value : this.assetId,+ personId: data.personId.present ? data.personId.value : this.personId,+ imageWidth: data.imageWidth.present+ ? data.imageWidth.value+ : this.imageWidth,+ imageHeight: data.imageHeight.present+ ? data.imageHeight.value+ : this.imageHeight,+ boundingBoxX1: data.boundingBoxX1.present+ ? data.boundingBoxX1.value+ : this.boundingBoxX1,+ boundingBoxY1: data.boundingBoxY1.present+ ? data.boundingBoxY1.value+ : this.boundingBoxY1,+ boundingBoxX2: data.boundingBoxX2.present+ ? data.boundingBoxX2.value+ : this.boundingBoxX2,+ boundingBoxY2: data.boundingBoxY2.present+ ? data.boundingBoxY2.value+ : this.boundingBoxY2,+ sourceType: data.sourceType.present+ ? data.sourceType.value+ : this.sourceType,+ );+ }++ @override+ String toString() {+ return (StringBuffer('AssetFaceEntityData(')+ ..write('id: $id, ')+ ..write('assetId: $assetId, ')+ ..write('personId: $personId, ')+ ..write('imageWidth: $imageWidth, ')+ ..write('imageHeight: $imageHeight, ')+ ..write('boundingBoxX1: $boundingBoxX1, ')+ ..write('boundingBoxY1: $boundingBoxY1, ')+ ..write('boundingBoxX2: $boundingBoxX2, ')+ ..write('boundingBoxY2: $boundingBoxY2, ')+ ..write('sourceType: $sourceType')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(+ id,+ assetId,+ personId,+ imageWidth,+ imageHeight,+ boundingBoxX1,+ boundingBoxY1,+ boundingBoxX2,+ boundingBoxY2,+ sourceType,+ );+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is AssetFaceEntityData &&+ other.id == this.id &&+ other.assetId == this.assetId &&+ other.personId == this.personId &&+ other.imageWidth == this.imageWidth &&+ other.imageHeight == this.imageHeight &&+ other.boundingBoxX1 == this.boundingBoxX1 &&+ other.boundingBoxY1 == this.boundingBoxY1 &&+ other.boundingBoxX2 == this.boundingBoxX2 &&+ other.boundingBoxY2 == this.boundingBoxY2 &&+ other.sourceType == this.sourceType);+}++class AssetFaceEntityCompanion extends UpdateCompanion<AssetFaceEntityData> {+ final Value<String> id;+ final Value<String> assetId;+ final Value<String?> personId;+ final Value<int> imageWidth;+ final Value<int> imageHeight;+ final Value<int> boundingBoxX1;+ final Value<int> boundingBoxY1;+ final Value<int> boundingBoxX2;+ final Value<int> boundingBoxY2;+ final Value<String> sourceType;+ const AssetFaceEntityCompanion({+ this.id = const Value.absent(),+ this.assetId = const Value.absent(),+ this.personId = const Value.absent(),+ this.imageWidth = const Value.absent(),+ this.imageHeight = const Value.absent(),+ this.boundingBoxX1 = const Value.absent(),+ this.boundingBoxY1 = const Value.absent(),+ this.boundingBoxX2 = const Value.absent(),+ this.boundingBoxY2 = const Value.absent(),+ this.sourceType = const Value.absent(),+ });+ AssetFaceEntityCompanion.insert({+ required String id,+ required String assetId,+ this.personId = const Value.absent(),+ required int imageWidth,+ required int imageHeight,+ required int boundingBoxX1,+ required int boundingBoxY1,+ required int boundingBoxX2,+ required int boundingBoxY2,+ required String sourceType,+ }) : id = Value(id),+ assetId = Value(assetId),+ imageWidth = Value(imageWidth),+ imageHeight = Value(imageHeight),+ boundingBoxX1 = Value(boundingBoxX1),+ boundingBoxY1 = Value(boundingBoxY1),+ boundingBoxX2 = Value(boundingBoxX2),+ boundingBoxY2 = Value(boundingBoxY2),+ sourceType = Value(sourceType);+ static Insertable<AssetFaceEntityData> custom({+ Expression<String>? id,+ Expression<String>? assetId,+ Expression<String>? personId,+ Expression<int>? imageWidth,+ Expression<int>? imageHeight,+ Expression<int>? boundingBoxX1,+ Expression<int>? boundingBoxY1,+ Expression<int>? boundingBoxX2,+ Expression<int>? boundingBoxY2,+ Expression<String>? sourceType,+ }) {+ return RawValuesInsertable({+ if (id != null) 'id': id,+ if (assetId != null) 'asset_id': assetId,+ if (personId != null) 'person_id': personId,+ if (imageWidth != null) 'image_width': imageWidth,+ if (imageHeight != null) 'image_height': imageHeight,+ if (boundingBoxX1 != null) 'bounding_box_x1': boundingBoxX1,+ if (boundingBoxY1 != null) 'bounding_box_y1': boundingBoxY1,+ if (boundingBoxX2 != null) 'bounding_box_x2': boundingBoxX2,+ if (boundingBoxY2 != null) 'bounding_box_y2': boundingBoxY2,+ if (sourceType != null) 'source_type': sourceType,+ });+ }++ AssetFaceEntityCompanion copyWith({+ Value<String>? id,+ Value<String>? assetId,+ Value<String?>? personId,+ Value<int>? imageWidth,+ Value<int>? imageHeight,+ Value<int>? boundingBoxX1,+ Value<int>? boundingBoxY1,+ Value<int>? boundingBoxX2,+ Value<int>? boundingBoxY2,+ Value<String>? sourceType,+ }) {+ return AssetFaceEntityCompanion(+ id: id ?? this.id,+ assetId: assetId ?? this.assetId,+ personId: personId ?? this.personId,+ imageWidth: imageWidth ?? this.imageWidth,+ imageHeight: imageHeight ?? this.imageHeight,+ boundingBoxX1: boundingBoxX1 ?? this.boundingBoxX1,+ boundingBoxY1: boundingBoxY1 ?? this.boundingBoxY1,+ boundingBoxX2: boundingBoxX2 ?? this.boundingBoxX2,+ boundingBoxY2: boundingBoxY2 ?? this.boundingBoxY2,+ sourceType: sourceType ?? this.sourceType,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (id.present) {+ map['id'] = Variable<String>(id.value);+ }+ if (assetId.present) {+ map['asset_id'] = Variable<String>(assetId.value);+ }+ if (personId.present) {+ map['person_id'] = Variable<String>(personId.value);+ }+ if (imageWidth.present) {+ map['image_width'] = Variable<int>(imageWidth.value);+ }+ if (imageHeight.present) {+ map['image_height'] = Variable<int>(imageHeight.value);+ }+ if (boundingBoxX1.present) {+ map['bounding_box_x1'] = Variable<int>(boundingBoxX1.value);+ }+ if (boundingBoxY1.present) {+ map['bounding_box_y1'] = Variable<int>(boundingBoxY1.value);+ }+ if (boundingBoxX2.present) {+ map['bounding_box_x2'] = Variable<int>(boundingBoxX2.value);+ }+ if (boundingBoxY2.present) {+ map['bounding_box_y2'] = Variable<int>(boundingBoxY2.value);+ }+ if (sourceType.present) {+ map['source_type'] = Variable<String>(sourceType.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('AssetFaceEntityCompanion(')+ ..write('id: $id, ')+ ..write('assetId: $assetId, ')+ ..write('personId: $personId, ')+ ..write('imageWidth: $imageWidth, ')+ ..write('imageHeight: $imageHeight, ')+ ..write('boundingBoxX1: $boundingBoxX1, ')+ ..write('boundingBoxY1: $boundingBoxY1, ')+ ..write('boundingBoxX2: $boundingBoxX2, ')+ ..write('boundingBoxY2: $boundingBoxY2, ')+ ..write('sourceType: $sourceType')+ ..write(')'))+ .toString();+ }+}++class StoreEntity extends Table with TableInfo<StoreEntity, StoreEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ StoreEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<int> id = GeneratedColumn<int>(+ 'id',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> stringValue = GeneratedColumn<String>(+ 'string_value',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<int> intValue = GeneratedColumn<int>(+ 'int_value',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ @override+ List<GeneratedColumn> get $columns => [id, stringValue, intValue];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'store_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {id};+ @override+ StoreEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return StoreEntityData(+ id: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}id'],+ )!,+ stringValue: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}string_value'],+ ),+ intValue: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}int_value'],+ ),+ );+ }++ @override+ StoreEntity createAlias(String alias) {+ return StoreEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class StoreEntityData extends DataClass implements Insertable<StoreEntityData> {+ final int id;+ final String? stringValue;+ final int? intValue;+ const StoreEntityData({required this.id, this.stringValue, this.intValue});+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['id'] = Variable<int>(id);+ if (!nullToAbsent || stringValue != null) {+ map['string_value'] = Variable<String>(stringValue);+ }+ if (!nullToAbsent || intValue != null) {+ map['int_value'] = Variable<int>(intValue);+ }+ return map;+ }++ factory StoreEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return StoreEntityData(+ id: serializer.fromJson<int>(json['id']),+ stringValue: serializer.fromJson<String?>(json['stringValue']),+ intValue: serializer.fromJson<int?>(json['intValue']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'id': serializer.toJson<int>(id),+ 'stringValue': serializer.toJson<String?>(stringValue),+ 'intValue': serializer.toJson<int?>(intValue),+ };+ }++ StoreEntityData copyWith({+ int? id,+ Value<String?> stringValue = const Value.absent(),+ Value<int?> intValue = const Value.absent(),+ }) => StoreEntityData(+ id: id ?? this.id,+ stringValue: stringValue.present ? stringValue.value : this.stringValue,+ intValue: intValue.present ? intValue.value : this.intValue,+ );+ StoreEntityData copyWithCompanion(StoreEntityCompanion data) {+ return StoreEntityData(+ id: data.id.present ? data.id.value : this.id,+ stringValue: data.stringValue.present+ ? data.stringValue.value+ : this.stringValue,+ intValue: data.intValue.present ? data.intValue.value : this.intValue,+ );+ }++ @override+ String toString() {+ return (StringBuffer('StoreEntityData(')+ ..write('id: $id, ')+ ..write('stringValue: $stringValue, ')+ ..write('intValue: $intValue')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(id, stringValue, intValue);+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is StoreEntityData &&+ other.id == this.id &&+ other.stringValue == this.stringValue &&+ other.intValue == this.intValue);+}++class StoreEntityCompanion extends UpdateCompanion<StoreEntityData> {+ final Value<int> id;+ final Value<String?> stringValue;+ final Value<int?> intValue;+ const StoreEntityCompanion({+ this.id = const Value.absent(),+ this.stringValue = const Value.absent(),+ this.intValue = const Value.absent(),+ });+ StoreEntityCompanion.insert({+ required int id,+ this.stringValue = const Value.absent(),+ this.intValue = const Value.absent(),+ }) : id = Value(id);+ static Insertable<StoreEntityData> custom({+ Expression<int>? id,+ Expression<String>? stringValue,+ Expression<int>? intValue,+ }) {+ return RawValuesInsertable({+ if (id != null) 'id': id,+ if (stringValue != null) 'string_value': stringValue,+ if (intValue != null) 'int_value': intValue,+ });+ }++ StoreEntityCompanion copyWith({+ Value<int>? id,+ Value<String?>? stringValue,+ Value<int?>? intValue,+ }) {+ return StoreEntityCompanion(+ id: id ?? this.id,+ stringValue: stringValue ?? this.stringValue,+ intValue: intValue ?? this.intValue,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (id.present) {+ map['id'] = Variable<int>(id.value);+ }+ if (stringValue.present) {+ map['string_value'] = Variable<String>(stringValue.value);+ }+ if (intValue.present) {+ map['int_value'] = Variable<int>(intValue.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('StoreEntityCompanion(')+ ..write('id: $id, ')+ ..write('stringValue: $stringValue, ')+ ..write('intValue: $intValue')+ ..write(')'))+ .toString();+ }+}++class TrashedLocalAssetEntity extends Table+ with TableInfo<TrashedLocalAssetEntity, TrashedLocalAssetEntityData> {+ @override+ final GeneratedDatabase attachedDatabase;+ final String? _alias;+ TrashedLocalAssetEntity(this.attachedDatabase, [this._alias]);+ late final GeneratedColumn<String> name = GeneratedColumn<String>(+ 'name',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<int> type = GeneratedColumn<int>(+ 'type',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(+ 'created_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(+ 'updated_at',+ aliasedName,+ false,+ type: DriftSqlType.dateTime,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),+ );+ late final GeneratedColumn<int> width = GeneratedColumn<int>(+ 'width',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<int> height = GeneratedColumn<int>(+ 'height',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<int> durationInSeconds = GeneratedColumn<int>(+ 'duration_in_seconds',+ aliasedName,+ true,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<String> id = GeneratedColumn<String>(+ 'id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> albumId = GeneratedColumn<String>(+ 'album_id',+ aliasedName,+ false,+ type: DriftSqlType.string,+ requiredDuringInsert: true,+ );+ late final GeneratedColumn<String> checksum = GeneratedColumn<String>(+ 'checksum',+ aliasedName,+ true,+ type: DriftSqlType.string,+ requiredDuringInsert: false,+ );+ late final GeneratedColumn<bool> isFavorite = GeneratedColumn<bool>(+ 'is_favorite',+ aliasedName,+ false,+ type: DriftSqlType.bool,+ requiredDuringInsert: false,+ defaultConstraints: GeneratedColumn.constraintIsAlways(+ 'CHECK ("is_favorite" IN (0, 1))',+ ),+ defaultValue: const CustomExpression('0'),+ );+ late final GeneratedColumn<int> orientation = GeneratedColumn<int>(+ 'orientation',+ aliasedName,+ false,+ type: DriftSqlType.int,+ requiredDuringInsert: false,+ defaultValue: const CustomExpression('0'),+ );+ @override+ List<GeneratedColumn> get $columns => [+ name,+ type,+ createdAt,+ updatedAt,+ width,+ height,+ durationInSeconds,+ id,+ albumId,+ checksum,+ isFavorite,+ orientation,+ ];+ @override+ String get aliasedName => _alias ?? actualTableName;+ @override+ String get actualTableName => $name;+ static const String $name = 'trashed_local_asset_entity';+ @override+ Set<GeneratedColumn> get $primaryKey => {id, albumId};+ @override+ TrashedLocalAssetEntityData map(+ Map<String, dynamic> data, {+ String? tablePrefix,+ }) {+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';+ return TrashedLocalAssetEntityData(+ name: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}name'],+ )!,+ type: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}type'],+ )!,+ createdAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}created_at'],+ )!,+ updatedAt: attachedDatabase.typeMapping.read(+ DriftSqlType.dateTime,+ data['${effectivePrefix}updated_at'],+ )!,+ width: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}width'],+ ),+ height: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}height'],+ ),+ durationInSeconds: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}duration_in_seconds'],+ ),+ id: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}id'],+ )!,+ albumId: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}album_id'],+ )!,+ checksum: attachedDatabase.typeMapping.read(+ DriftSqlType.string,+ data['${effectivePrefix}checksum'],+ ),+ isFavorite: attachedDatabase.typeMapping.read(+ DriftSqlType.bool,+ data['${effectivePrefix}is_favorite'],+ )!,+ orientation: attachedDatabase.typeMapping.read(+ DriftSqlType.int,+ data['${effectivePrefix}orientation'],+ )!,+ );+ }++ @override+ TrashedLocalAssetEntity createAlias(String alias) {+ return TrashedLocalAssetEntity(attachedDatabase, alias);+ }++ @override+ bool get withoutRowId => true;+ @override+ bool get isStrict => true;+}++class TrashedLocalAssetEntityData extends DataClass+ implements Insertable<TrashedLocalAssetEntityData> {+ final String name;+ final int type;+ final DateTime createdAt;+ final DateTime updatedAt;+ final int? width;+ final int? height;+ final int? durationInSeconds;+ final String id;+ final String albumId;+ final String? checksum;+ final bool isFavorite;+ final int orientation;+ const TrashedLocalAssetEntityData({+ required this.name,+ required this.type,+ required this.createdAt,+ required this.updatedAt,+ this.width,+ this.height,+ this.durationInSeconds,+ required this.id,+ required this.albumId,+ this.checksum,+ required this.isFavorite,+ required this.orientation,+ });+ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ map['name'] = Variable<String>(name);+ map['type'] = Variable<int>(type);+ map['created_at'] = Variable<DateTime>(createdAt);+ map['updated_at'] = Variable<DateTime>(updatedAt);+ if (!nullToAbsent || width != null) {+ map['width'] = Variable<int>(width);+ }+ if (!nullToAbsent || height != null) {+ map['height'] = Variable<int>(height);+ }+ if (!nullToAbsent || durationInSeconds != null) {+ map['duration_in_seconds'] = Variable<int>(durationInSeconds);+ }+ map['id'] = Variable<String>(id);+ map['album_id'] = Variable<String>(albumId);+ if (!nullToAbsent || checksum != null) {+ map['checksum'] = Variable<String>(checksum);+ }+ map['is_favorite'] = Variable<bool>(isFavorite);+ map['orientation'] = Variable<int>(orientation);+ return map;+ }++ factory TrashedLocalAssetEntityData.fromJson(+ Map<String, dynamic> json, {+ ValueSerializer? serializer,+ }) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return TrashedLocalAssetEntityData(+ name: serializer.fromJson<String>(json['name']),+ type: serializer.fromJson<int>(json['type']),+ createdAt: serializer.fromJson<DateTime>(json['createdAt']),+ updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),+ width: serializer.fromJson<int?>(json['width']),+ height: serializer.fromJson<int?>(json['height']),+ durationInSeconds: serializer.fromJson<int?>(json['durationInSeconds']),+ id: serializer.fromJson<String>(json['id']),+ albumId: serializer.fromJson<String>(json['albumId']),+ checksum: serializer.fromJson<String?>(json['checksum']),+ isFavorite: serializer.fromJson<bool>(json['isFavorite']),+ orientation: serializer.fromJson<int>(json['orientation']),+ );+ }+ @override+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {+ serializer ??= driftRuntimeOptions.defaultSerializer;+ return <String, dynamic>{+ 'name': serializer.toJson<String>(name),+ 'type': serializer.toJson<int>(type),+ 'createdAt': serializer.toJson<DateTime>(createdAt),+ 'updatedAt': serializer.toJson<DateTime>(updatedAt),+ 'width': serializer.toJson<int?>(width),+ 'height': serializer.toJson<int?>(height),+ 'durationInSeconds': serializer.toJson<int?>(durationInSeconds),+ 'id': serializer.toJson<String>(id),+ 'albumId': serializer.toJson<String>(albumId),+ 'checksum': serializer.toJson<String?>(checksum),+ 'isFavorite': serializer.toJson<bool>(isFavorite),+ 'orientation': serializer.toJson<int>(orientation),+ };+ }++ TrashedLocalAssetEntityData copyWith({+ String? name,+ int? type,+ DateTime? createdAt,+ DateTime? updatedAt,+ Value<int?> width = const Value.absent(),+ Value<int?> height = const Value.absent(),+ Value<int?> durationInSeconds = const Value.absent(),+ String? id,+ String? albumId,+ Value<String?> checksum = const Value.absent(),+ bool? isFavorite,+ int? orientation,+ }) => TrashedLocalAssetEntityData(+ name: name ?? this.name,+ type: type ?? this.type,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ width: width.present ? width.value : this.width,+ height: height.present ? height.value : this.height,+ durationInSeconds: durationInSeconds.present+ ? durationInSeconds.value+ : this.durationInSeconds,+ id: id ?? this.id,+ albumId: albumId ?? this.albumId,+ checksum: checksum.present ? checksum.value : this.checksum,+ isFavorite: isFavorite ?? this.isFavorite,+ orientation: orientation ?? this.orientation,+ );+ TrashedLocalAssetEntityData copyWithCompanion(+ TrashedLocalAssetEntityCompanion data,+ ) {+ return TrashedLocalAssetEntityData(+ name: data.name.present ? data.name.value : this.name,+ type: data.type.present ? data.type.value : this.type,+ createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,+ updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,+ width: data.width.present ? data.width.value : this.width,+ height: data.height.present ? data.height.value : this.height,+ durationInSeconds: data.durationInSeconds.present+ ? data.durationInSeconds.value+ : this.durationInSeconds,+ id: data.id.present ? data.id.value : this.id,+ albumId: data.albumId.present ? data.albumId.value : this.albumId,+ checksum: data.checksum.present ? data.checksum.value : this.checksum,+ isFavorite: data.isFavorite.present+ ? data.isFavorite.value+ : this.isFavorite,+ orientation: data.orientation.present+ ? data.orientation.value+ : this.orientation,+ );+ }++ @override+ String toString() {+ return (StringBuffer('TrashedLocalAssetEntityData(')+ ..write('name: $name, ')+ ..write('type: $type, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('width: $width, ')+ ..write('height: $height, ')+ ..write('durationInSeconds: $durationInSeconds, ')+ ..write('id: $id, ')+ ..write('albumId: $albumId, ')+ ..write('checksum: $checksum, ')+ ..write('isFavorite: $isFavorite, ')+ ..write('orientation: $orientation')+ ..write(')'))+ .toString();+ }++ @override+ int get hashCode => Object.hash(+ name,+ type,+ createdAt,+ updatedAt,+ width,+ height,+ durationInSeconds,+ id,+ albumId,+ checksum,+ isFavorite,+ orientation,+ );+ @override+ bool operator ==(Object other) =>+ identical(this, other) ||+ (other is TrashedLocalAssetEntityData &&+ other.name == this.name &&+ other.type == this.type &&+ other.createdAt == this.createdAt &&+ other.updatedAt == this.updatedAt &&+ other.width == this.width &&+ other.height == this.height &&+ other.durationInSeconds == this.durationInSeconds &&+ other.id == this.id &&+ other.albumId == this.albumId &&+ other.checksum == this.checksum &&+ other.isFavorite == this.isFavorite &&+ other.orientation == this.orientation);+}++class TrashedLocalAssetEntityCompanion+ extends UpdateCompanion<TrashedLocalAssetEntityData> {+ final Value<String> name;+ final Value<int> type;+ final Value<DateTime> createdAt;+ final Value<DateTime> updatedAt;+ final Value<int?> width;+ final Value<int?> height;+ final Value<int?> durationInSeconds;+ final Value<String> id;+ final Value<String> albumId;+ final Value<String?> checksum;+ final Value<bool> isFavorite;+ final Value<int> orientation;+ const TrashedLocalAssetEntityCompanion({+ this.name = const Value.absent(),+ this.type = const Value.absent(),+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ this.width = const Value.absent(),+ this.height = const Value.absent(),+ this.durationInSeconds = const Value.absent(),+ this.id = const Value.absent(),+ this.albumId = const Value.absent(),+ this.checksum = const Value.absent(),+ this.isFavorite = const Value.absent(),+ this.orientation = const Value.absent(),+ });+ TrashedLocalAssetEntityCompanion.insert({+ required String name,+ required int type,+ this.createdAt = const Value.absent(),+ this.updatedAt = const Value.absent(),+ this.width = const Value.absent(),+ this.height = const Value.absent(),+ this.durationInSeconds = const Value.absent(),+ required String id,+ required String albumId,+ this.checksum = const Value.absent(),+ this.isFavorite = const Value.absent(),+ this.orientation = const Value.absent(),+ }) : name = Value(name),+ type = Value(type),+ id = Value(id),+ albumId = Value(albumId);+ static Insertable<TrashedLocalAssetEntityData> custom({+ Expression<String>? name,+ Expression<int>? type,+ Expression<DateTime>? createdAt,+ Expression<DateTime>? updatedAt,+ Expression<int>? width,+ Expression<int>? height,+ Expression<int>? durationInSeconds,+ Expression<String>? id,+ Expression<String>? albumId,+ Expression<String>? checksum,+ Expression<bool>? isFavorite,+ Expression<int>? orientation,+ }) {+ return RawValuesInsertable({+ if (name != null) 'name': name,+ if (type != null) 'type': type,+ if (createdAt != null) 'created_at': createdAt,+ if (updatedAt != null) 'updated_at': updatedAt,+ if (width != null) 'width': width,+ if (height != null) 'height': height,+ if (durationInSeconds != null) 'duration_in_seconds': durationInSeconds,+ if (id != null) 'id': id,+ if (albumId != null) 'album_id': albumId,+ if (checksum != null) 'checksum': checksum,+ if (isFavorite != null) 'is_favorite': isFavorite,+ if (orientation != null) 'orientation': orientation,+ });+ }++ TrashedLocalAssetEntityCompanion copyWith({+ Value<String>? name,+ Value<int>? type,+ Value<DateTime>? createdAt,+ Value<DateTime>? updatedAt,+ Value<int?>? width,+ Value<int?>? height,+ Value<int?>? durationInSeconds,+ Value<String>? id,+ Value<String>? albumId,+ Value<String?>? checksum,+ Value<bool>? isFavorite,+ Value<int>? orientation,+ }) {+ return TrashedLocalAssetEntityCompanion(+ name: name ?? this.name,+ type: type ?? this.type,+ createdAt: createdAt ?? this.createdAt,+ updatedAt: updatedAt ?? this.updatedAt,+ width: width ?? this.width,+ height: height ?? this.height,+ durationInSeconds: durationInSeconds ?? this.durationInSeconds,+ id: id ?? this.id,+ albumId: albumId ?? this.albumId,+ checksum: checksum ?? this.checksum,+ isFavorite: isFavorite ?? this.isFavorite,+ orientation: orientation ?? this.orientation,+ );+ }++ @override+ Map<String, Expression> toColumns(bool nullToAbsent) {+ final map = <String, Expression>{};+ if (name.present) {+ map['name'] = Variable<String>(name.value);+ }+ if (type.present) {+ map['type'] = Variable<int>(type.value);+ }+ if (createdAt.present) {+ map['created_at'] = Variable<DateTime>(createdAt.value);+ }+ if (updatedAt.present) {+ map['updated_at'] = Variable<DateTime>(updatedAt.value);+ }+ if (width.present) {+ map['width'] = Variable<int>(width.value);+ }+ if (height.present) {+ map['height'] = Variable<int>(height.value);+ }+ if (durationInSeconds.present) {+ map['duration_in_seconds'] = Variable<int>(durationInSeconds.value);+ }+ if (id.present) {+ map['id'] = Variable<String>(id.value);+ }+ if (albumId.present) {+ map['album_id'] = Variable<String>(albumId.value);+ }+ if (checksum.present) {+ map['checksum'] = Variable<String>(checksum.value);+ }+ if (isFavorite.present) {+ map['is_favorite'] = Variable<bool>(isFavorite.value);+ }+ if (orientation.present) {+ map['orientation'] = Variable<int>(orientation.value);+ }+ return map;+ }++ @override+ String toString() {+ return (StringBuffer('TrashedLocalAssetEntityCompanion(')+ ..write('name: $name, ')+ ..write('type: $type, ')+ ..write('createdAt: $createdAt, ')+ ..write('updatedAt: $updatedAt, ')+ ..write('width: $width, ')+ ..write('height: $height, ')+ ..write('durationInSeconds: $durationInSeconds, ')+ ..write('id: $id, ')+ ..write('albumId: $albumId, ')+ ..write('checksum: $checksum, ')+ ..write('isFavorite: $isFavorite, ')+ ..write('orientation: $orientation')+ ..write(')'))+ .toString();+ }+}++class DatabaseAtV13 extends GeneratedDatabase {+ DatabaseAtV13(QueryExecutor e) : super(e);+ late final UserEntity userEntity = UserEntity(this);+ late final RemoteAssetEntity remoteAssetEntity = RemoteAssetEntity(this);+ late final StackEntity stackEntity = StackEntity(this);+ late final LocalAssetEntity localAssetEntity = LocalAssetEntity(this);+ late final RemoteAlbumEntity remoteAlbumEntity = RemoteAlbumEntity(this);+ late final LocalAlbumEntity localAlbumEntity = LocalAlbumEntity(this);+ late final LocalAlbumAssetEntity localAlbumAssetEntity =+ LocalAlbumAssetEntity(this);+ late final Index idxLocalAssetChecksum = Index(+ 'idx_local_asset_checksum',+ 'CREATE INDEX IF NOT EXISTS idx_local_asset_checksum ON local_asset_entity (checksum)',+ );+ late final Index idxRemoteAssetOwnerChecksum = Index(+ 'idx_remote_asset_owner_checksum',+ 'CREATE INDEX IF NOT EXISTS idx_remote_asset_owner_checksum ON remote_asset_entity (owner_id, checksum)',+ );+ late final Index uQRemoteAssetsOwnerChecksum = 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)',+ );+ late final Index uQRemoteAssetsOwnerLibraryChecksum = 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)',+ );+ late final Index idxRemoteAssetChecksum = Index(+ 'idx_remote_asset_checksum',+ 'CREATE INDEX IF NOT EXISTS idx_remote_asset_checksum ON remote_asset_entity (checksum)',+ );+ late final AuthUserEntity authUserEntity = AuthUserEntity(this);+ late final UserMetadataEntity userMetadataEntity = UserMetadataEntity(this);+ late final PartnerEntity partnerEntity = PartnerEntity(this);+ late final RemoteExifEntity remoteExifEntity = RemoteExifEntity(this);+ late final RemoteAlbumAssetEntity remoteAlbumAssetEntity =+ RemoteAlbumAssetEntity(this);+ late final RemoteAlbumUserEntity remoteAlbumUserEntity =+ RemoteAlbumUserEntity(this);+ late final MemoryEntity memoryEntity = MemoryEntity(this);+ late final MemoryAssetEntity memoryAssetEntity = MemoryAssetEntity(this);+ late final PersonEntity personEntity = PersonEntity(this);+ late final AssetFaceEntity assetFaceEntity = AssetFaceEntity(this);+ late final StoreEntity storeEntity = StoreEntity(this);+ late final TrashedLocalAssetEntity trashedLocalAssetEntity =+ TrashedLocalAssetEntity(this);+ late final Index idxLatLng = Index(+ 'idx_lat_lng',+ 'CREATE INDEX IF NOT EXISTS idx_lat_lng ON remote_exif_entity (latitude, longitude)',+ );+ late final Index idxTrashedLocalAssetChecksum = Index(+ 'idx_trashed_local_asset_checksum',+ 'CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_checksum ON trashed_local_asset_entity (checksum)',+ );+ late final Index idxTrashedLocalAssetAlbum = Index(+ 'idx_trashed_local_asset_album',+ 'CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_album ON trashed_local_asset_entity (album_id)',+ );+ @override+ Iterable<TableInfo<Table, Object?>> get allTables =>+ allSchemaEntities.whereType<TableInfo<Table, Object?>>();+ @override+ List<DatabaseSchemaEntity> get allSchemaEntities => [+ userEntity,+ remoteAssetEntity,+ stackEntity,+ localAssetEntity,+ remoteAlbumEntity,+ localAlbumEntity,+ localAlbumAssetEntity,+ idxLocalAssetChecksum,+ idxRemoteAssetOwnerChecksum,+ uQRemoteAssetsOwnerChecksum,+ uQRemoteAssetsOwnerLibraryChecksum,+ idxRemoteAssetChecksum,+ authUserEntity,+ userMetadataEntity,+ partnerEntity,+ remoteExifEntity,+ remoteAlbumAssetEntity,+ remoteAlbumUserEntity,+ memoryEntity,+ memoryAssetEntity,+ personEntity,+ assetFaceEntity,+ storeEntity,+ trashedLocalAssetEntity,+ idxLatLng,+ idxTrashedLocalAssetChecksum,+ idxTrashedLocalAssetAlbum,+ ];+ @override+ int get schemaVersion => 13;+ @override+ DriftDatabaseOptions get options =>+ const DriftDatabaseOptions(storeDateTimeAsText: true);+}diff --git a/mobile/test/fixtures/sync_stream.stub.dart b/mobile/test/fixtures/sync_stream.stub.dartindex 23c750d6d9..523984f966 100644--- a/mobile/test/fixtures/sync_stream.stub.dart+++ b/mobile/test/fixtures/sync_stream.stub.dart@@ -81,4 +81,67 @@ abstract final class SyncStreamStub {data: SyncMemoryAssetDeleteV1(assetId: "asset-2", memoryId: "memory-1"),ack: "8",);++ static final assetDeleteV1 = SyncEvent(+ type: SyncEntityType.assetDeleteV1,+ data: SyncAssetDeleteV1(assetId: "remote-asset"),+ ack: "asset-delete-ack",+ );++ static SyncEvent assetTrashed({+ required String id,+ required String checksum,+ required String ack,+ DateTime? trashedAt,+ }) {+ return _assetV1(+ id: id,+ checksum: checksum,+ deletedAt: trashedAt ?? DateTime(2025, 1, 1),+ ack: ack,+ );+ }++ static SyncEvent assetModified({+ required String id,+ required String checksum,+ required String ack,+ }) {+ return _assetV1(+ id: id,+ checksum: checksum,+ deletedAt: null,+ ack: ack,+ );+ }++ static SyncEvent _assetV1({+ required String id,+ required String checksum,+ required DateTime? deletedAt,+ required String ack,+ }) {+ return SyncEvent(+ type: SyncEntityType.assetV1,+ data: SyncAssetV1(+ checksum: checksum,+ deletedAt: deletedAt,+ duration: '0',+ fileCreatedAt: DateTime(2025),+ fileModifiedAt: DateTime(2025, 1, 2),+ id: id,+ isFavorite: false,+ libraryId: null,+ livePhotoVideoId: null,+ localDateTime: DateTime(2025, 1, 3),+ originalFileName: '$id.jpg',+ ownerId: 'owner',+ stackId: null,+ thumbhash: null,+ type: AssetTypeEnum.IMAGE,+ visibility: AssetVisibility.timeline,+ ),+ ack: ack,+ );+ }}diff --git a/mobile/test/infrastructure/repository.mock.dart b/mobile/test/infrastructure/repository.mock.dartindex 44e756e88e..becfafe33d 100644--- a/mobile/test/infrastructure/repository.mock.dart+++ b/mobile/test/infrastructure/repository.mock.dart@@ -8,6 +8,7 @@ import 'package:immich_mobile/infrastructure/repositories/storage.repository.darimport 'package:immich_mobile/infrastructure/repositories/store.repository.dart';import 'package:immich_mobile/infrastructure/repositories/sync_api.repository.dart';import 'package:immich_mobile/infrastructure/repositories/sync_stream.repository.dart';+import 'package:immich_mobile/infrastructure/repositories/trashed_local_asset.repository.dart';import 'package:immich_mobile/infrastructure/repositories/user.repository.dart';import 'package:immich_mobile/infrastructure/repositories/user_api.repository.dart';import 'package:immich_mobile/repositories/drift_album_api_repository.dart';@@ -34,6 +35,8 @@ class MockLocalAssetRepository extends Mock implements DriftLocalAssetRepositoryclass MockDriftLocalAssetRepository extends Mock implements DriftLocalAssetRepository {}+class MockTrashedLocalAssetRepository extends Mock implements DriftTrashedLocalAssetRepository {}+class MockStorageRepository extends Mock implements StorageRepository {}class MockDriftBackupRepository extends Mock implements DriftBackupRepository {}diff --git a/mobile/test/mocks/asset_entity.mock.dart b/mobile/test/mocks/asset_entity.mock.dartnew file mode 100644index 0000000000..fdea58315d--- /dev/null+++ b/mobile/test/mocks/asset_entity.mock.dart@@ -0,0 +1,4 @@+import 'package:mocktail/mocktail.dart';+import 'package:photo_manager/photo_manager.dart';++class MockAssetEntity extends Mock implements AssetEntity {}diff --git a/mobile/test/services/hash_service_test.dart b/mobile/test/services/hash_service_test.dartindex 74b8575e40..9429d434b0 100644--- a/mobile/test/services/hash_service_test.dart+++ b/mobile/test/services/hash_service_test.dart@@ -12,16 +12,14 @@ import 'package:immich_mobile/infrastructure/repositories/device_asset.repositorimport 'package:immich_mobile/services/background.service.dart';import 'package:immich_mobile/services/hash.service.dart';import 'package:mocktail/mocktail.dart';-import 'package:photo_manager/photo_manager.dart';import '../fixtures/asset.stub.dart';import '../infrastructure/repository.mock.dart';import '../service.mocks.dart';+import '../mocks/asset_entity.mock.dart';class MockAsset extends Mock implements Asset {}-class MockAssetEntity extends Mock implements AssetEntity {}-void main() {late HashService sut;late BackgroundService mockBackgroundService;diff --git a/mobile/test/services/upload.service_test.dart b/mobile/test/services/upload.service_test.dartindex b18ad7b7d4..d33126782f 100644--- a/mobile/test/services/upload.service_test.dart+++ b/mobile/test/services/upload.service_test.dart@@ -12,14 +12,12 @@ import 'package:immich_mobile/infrastructure/repositories/store.repository.dart'import 'package:immich_mobile/services/app_settings.service.dart';import 'package:immich_mobile/services/upload.service.dart';import 'package:mocktail/mocktail.dart';-import 'package:photo_manager/photo_manager.dart';import '../domain/service.mock.dart';import '../fixtures/asset.stub.dart';import '../infrastructure/repository.mock.dart';import '../repository.mocks.dart';--class MockAssetEntity extends Mock implements AssetEntity {}+import '../mocks/asset_entity.mock.dart';void main() {late UploadService sut;