Skip to content

High performance self-hosted photo and video management solution.

feat(mobile): ocr support (#26523)

Yaros733373c0ca16
diff --git a/mobile/drift_schemas/main/drift_schema_v29.json b/mobile/drift_schemas/main/drift_schema_v29.json
new file mode 100644
index 0000000000..d40878efc2
--- /dev/null
+++ b/mobile/drift_schemas/main/drift_schema_v29.json
@@ -0,0 +1,3603 @@
+{
+ "_meta": {
+ "description": "This file contains a serialized version of schema entities for drift.",
+ "version": "1.3.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_ms",
+ "getter_name": "durationMs",
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "user_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": "uploaded_at",
+ "getter_name": "uploadedAt",
+ "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": []
+ },
+ {
+ "name": "is_edited",
+ "getter_name": "isEdited",
+ "moor_type": "bool",
+ "nullable": false,
+ "customConstraints": null,
+ "defaultConstraints": "CHECK (\"is_edited\" IN (0, 1))",
+ "dialectAwareDefaultConstraints": {
+ "sqlite": "CHECK (\"is_edited\" 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": [
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "user_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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_ms",
+ "getter_name": "durationMs",
+ "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": []
+ },
+ {
+ "name": "i_cloud_id",
+ "getter_name": "iCloudId",
+ "moor_type": "string",
+ "nullable": true,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "adjustment_time",
+ "getter_name": "adjustmentTime",
+ "moor_type": "dateTime",
+ "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": "playback_style",
+ "getter_name": "playbackStyle",
+ "moor_type": "int",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": "const CustomExpression('0')",
+ "default_client_dart": null,
+ "dsl_features": [],
+ "type_converter": {
+ "dart_expr": "const EnumIndexConverter<AssetPlaybackStyle>(AssetPlaybackStyle.values)",
+ "dart_type_name": "AssetPlaybackStyle"
+ }
+ }
+ ],
+ "is_virtual": false,
+ "without_rowid": true,
+ "constraints": [],
+ "strict": true,
+ "explicit_pk": [
+ "id"
+ ]
+ }
+ },
+ {
+ "id": 4,
+ "references": [
+ 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": "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "remote_asset_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "setNull"
+ }
+ }
+ ]
+ },
+ {
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "remote_album_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "setNull"
+ }
+ }
+ ]
+ },
+ {
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "local_asset_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "local_album_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": [
+ 6
+ ],
+ "type": "index",
+ "data": {
+ "on": 6,
+ "name": "idx_local_album_asset_album_asset",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_local_album_asset_album_asset ON local_album_asset_entity (album_id, asset_id)",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 8,
+ "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": 9,
+ "references": [
+ 3
+ ],
+ "type": "index",
+ "data": {
+ "on": 3,
+ "name": "idx_local_asset_cloud_id",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_local_asset_cloud_id ON local_asset_entity (i_cloud_id)",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 10,
+ "references": [
+ 3
+ ],
+ "type": "index",
+ "data": {
+ "on": 3,
+ "name": "idx_local_asset_created_at",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_local_asset_created_at ON local_asset_entity (created_at)",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 11,
+ "references": [
+ 2
+ ],
+ "type": "index",
+ "data": {
+ "on": 2,
+ "name": "idx_stack_primary_asset_id",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_stack_primary_asset_id ON stack_entity (primary_asset_id)",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 12,
+ "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": 13,
+ "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": 14,
+ "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": 15,
+ "references": [
+ 1
+ ],
+ "type": "index",
+ "data": {
+ "on": 1,
+ "name": "idx_remote_asset_stack_id",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_remote_asset_stack_id ON remote_asset_entity (stack_id)",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 16,
+ "references": [
+ 1
+ ],
+ "type": "index",
+ "data": {
+ "on": 1,
+ "name": "idx_remote_asset_owner_visibility_deleted_created",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_remote_asset_owner_visibility_deleted_created\nON remote_asset_entity (owner_id, visibility, deleted_at, created_at DESC)\n",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 17,
+ "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": 18,
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "user_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": 19,
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "user_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "user_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": 20,
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "remote_asset_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": 21,
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "remote_asset_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "remote_album_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ }
+ ],
+ "is_virtual": false,
+ "without_rowid": true,
+ "constraints": [],
+ "strict": true,
+ "explicit_pk": [
+ "asset_id",
+ "album_id"
+ ]
+ }
+ },
+ {
+ "id": 22,
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "remote_album_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "user_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": 23,
+ "references": [
+ 1
+ ],
+ "type": "table",
+ "data": {
+ "name": "remote_asset_cloud_id_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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "remote_asset_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "name": "cloud_id",
+ "getter_name": "cloudId",
+ "moor_type": "string",
+ "nullable": true,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "created_at",
+ "getter_name": "createdAt",
+ "moor_type": "dateTime",
+ "nullable": true,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "adjustment_time",
+ "getter_name": "adjustmentTime",
+ "moor_type": "dateTime",
+ "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": []
+ }
+ ],
+ "is_virtual": false,
+ "without_rowid": true,
+ "constraints": [],
+ "strict": true,
+ "explicit_pk": [
+ "asset_id"
+ ]
+ }
+ },
+ {
+ "id": 24,
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "user_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": 25,
+ "references": [
+ 1,
+ 24
+ ],
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "remote_asset_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "memory_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ }
+ ],
+ "is_virtual": false,
+ "without_rowid": true,
+ "constraints": [],
+ "strict": true,
+ "explicit_pk": [
+ "asset_id",
+ "memory_id"
+ ]
+ }
+ },
+ {
+ "id": 26,
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "user_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": 27,
+ "references": [
+ 1,
+ 26
+ ],
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "remote_asset_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "person_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "setNull"
+ }
+ }
+ ]
+ },
+ {
+ "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": []
+ },
+ {
+ "name": "is_visible",
+ "getter_name": "isVisible",
+ "moor_type": "bool",
+ "nullable": false,
+ "customConstraints": null,
+ "defaultConstraints": "CHECK (\"is_visible\" IN (0, 1))",
+ "dialectAwareDefaultConstraints": {
+ "sqlite": "CHECK (\"is_visible\" IN (0, 1))"
+ },
+ "default_dart": "const CustomExpression('1')",
+ "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": []
+ }
+ ],
+ "is_virtual": false,
+ "without_rowid": true,
+ "constraints": [],
+ "strict": true,
+ "explicit_pk": [
+ "id"
+ ]
+ }
+ },
+ {
+ "id": 28,
+ "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": 29,
+ "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_ms",
+ "getter_name": "durationMs",
+ "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": []
+ },
+ {
+ "name": "source",
+ "getter_name": "source",
+ "moor_type": "int",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": [],
+ "type_converter": {
+ "dart_expr": "const EnumIndexConverter<TrashOrigin>(TrashOrigin.values)",
+ "dart_type_name": "TrashOrigin"
+ }
+ },
+ {
+ "name": "playback_style",
+ "getter_name": "playbackStyle",
+ "moor_type": "int",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": "const CustomExpression('0')",
+ "default_client_dart": null,
+ "dsl_features": [],
+ "type_converter": {
+ "dart_expr": "const EnumIndexConverter<AssetPlaybackStyle>(AssetPlaybackStyle.values)",
+ "dart_type_name": "AssetPlaybackStyle"
+ }
+ }
+ ],
+ "is_virtual": false,
+ "without_rowid": true,
+ "constraints": [],
+ "strict": true,
+ "explicit_pk": [
+ "id",
+ "album_id"
+ ]
+ }
+ },
+ {
+ "id": 30,
+ "references": [
+ 1
+ ],
+ "type": "table",
+ "data": {
+ "name": "asset_edit_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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "remote_asset_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "name": "action",
+ "getter_name": "action",
+ "moor_type": "int",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": [],
+ "type_converter": {
+ "dart_expr": "const EnumIndexConverter<AssetEditAction>(AssetEditAction.values)",
+ "dart_type_name": "AssetEditAction"
+ }
+ },
+ {
+ "name": "parameters",
+ "getter_name": "parameters",
+ "moor_type": "blob",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": [],
+ "type_converter": {
+ "dart_expr": "editParameterConverter",
+ "dart_type_name": "Map<String, Object?>"
+ }
+ },
+ {
+ "name": "sequence",
+ "getter_name": "sequence",
+ "moor_type": "int",
+ "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": 31,
+ "references": [],
+ "type": "table",
+ "data": {
+ "name": "settings",
+ "was_declared_in_moor": false,
+ "columns": [
+ {
+ "name": "key",
+ "getter_name": "key",
+ "moor_type": "string",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "value",
+ "getter_name": "value",
+ "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": []
+ }
+ ],
+ "is_virtual": false,
+ "without_rowid": true,
+ "constraints": [],
+ "strict": true,
+ "explicit_pk": [
+ "key"
+ ]
+ }
+ },
+ {
+ "id": 32,
+ "references": [
+ 1
+ ],
+ "type": "table",
+ "data": {
+ "name": "asset_ocr_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": [
+ {
+ "foreign_key": {
+ "to": {
+ "table": "remote_asset_entity",
+ "column": "id"
+ },
+ "initially_deferred": false,
+ "on_update": null,
+ "on_delete": "cascade"
+ }
+ }
+ ]
+ },
+ {
+ "name": "x1",
+ "getter_name": "x1",
+ "moor_type": "double",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "y1",
+ "getter_name": "y1",
+ "moor_type": "double",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "x2",
+ "getter_name": "x2",
+ "moor_type": "double",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "y2",
+ "getter_name": "y2",
+ "moor_type": "double",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "x3",
+ "getter_name": "x3",
+ "moor_type": "double",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "y3",
+ "getter_name": "y3",
+ "moor_type": "double",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "x4",
+ "getter_name": "x4",
+ "moor_type": "double",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "y4",
+ "getter_name": "y4",
+ "moor_type": "double",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "box_score",
+ "getter_name": "boxScore",
+ "moor_type": "double",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "text_score",
+ "getter_name": "textScore",
+ "moor_type": "double",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "recognized_text",
+ "getter_name": "recognizedText",
+ "moor_type": "string",
+ "nullable": false,
+ "customConstraints": null,
+ "default_dart": null,
+ "default_client_dart": null,
+ "dsl_features": []
+ },
+ {
+ "name": "is_visible",
+ "getter_name": "isVisible",
+ "moor_type": "bool",
+ "nullable": false,
+ "customConstraints": null,
+ "defaultConstraints": "CHECK (\"is_visible\" IN (0, 1))",
+ "dialectAwareDefaultConstraints": {
+ "sqlite": "CHECK (\"is_visible\" IN (0, 1))"
+ },
+ "default_dart": "const CustomExpression('1')",
+ "default_client_dart": null,
+ "dsl_features": []
+ }
+ ],
+ "is_virtual": false,
+ "without_rowid": true,
+ "constraints": [],
+ "strict": true,
+ "explicit_pk": [
+ "id"
+ ]
+ }
+ },
+ {
+ "id": 33,
+ "references": [
+ 19
+ ],
+ "type": "index",
+ "data": {
+ "on": 19,
+ "name": "idx_partner_shared_with_id",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_partner_shared_with_id ON partner_entity (shared_with_id)",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 34,
+ "references": [
+ 20
+ ],
+ "type": "index",
+ "data": {
+ "on": 20,
+ "name": "idx_lat_lng",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_lat_lng ON remote_exif_entity (latitude, longitude)",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 35,
+ "references": [
+ 20
+ ],
+ "type": "index",
+ "data": {
+ "on": 20,
+ "name": "idx_remote_exif_city",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_remote_exif_city\nON remote_exif_entity (city) WHERE city IS NOT NULL\n",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 36,
+ "references": [
+ 21
+ ],
+ "type": "index",
+ "data": {
+ "on": 21,
+ "name": "idx_remote_album_asset_album_asset",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_remote_album_asset_album_asset ON remote_album_asset_entity (album_id, asset_id)",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 37,
+ "references": [
+ 23
+ ],
+ "type": "index",
+ "data": {
+ "on": 23,
+ "name": "idx_remote_asset_cloud_id",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_remote_asset_cloud_id ON remote_asset_cloud_id_entity (cloud_id)",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 38,
+ "references": [
+ 26
+ ],
+ "type": "index",
+ "data": {
+ "on": 26,
+ "name": "idx_person_owner_id",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_person_owner_id ON person_entity (owner_id)",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 39,
+ "references": [
+ 27
+ ],
+ "type": "index",
+ "data": {
+ "on": 27,
+ "name": "idx_asset_face_person_id",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_asset_face_person_id ON asset_face_entity (person_id)",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 40,
+ "references": [
+ 27
+ ],
+ "type": "index",
+ "data": {
+ "on": 27,
+ "name": "idx_asset_face_asset_id",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_asset_face_asset_id ON asset_face_entity (asset_id)",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 41,
+ "references": [
+ 27
+ ],
+ "type": "index",
+ "data": {
+ "on": 27,
+ "name": "idx_asset_face_visible_person",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_asset_face_visible_person\nON asset_face_entity (person_id, asset_id)\nWHERE is_visible = 1 AND deleted_at IS NULL\n",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 42,
+ "references": [
+ 29
+ ],
+ "type": "index",
+ "data": {
+ "on": 29,
+ "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": 43,
+ "references": [
+ 29
+ ],
+ "type": "index",
+ "data": {
+ "on": 29,
+ "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": []
+ }
+ },
+ {
+ "id": 44,
+ "references": [
+ 30
+ ],
+ "type": "index",
+ "data": {
+ "on": 30,
+ "name": "idx_asset_edit_asset_id",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_asset_edit_asset_id ON asset_edit_entity (asset_id)",
+ "unique": false,
+ "columns": []
+ }
+ },
+ {
+ "id": 45,
+ "references": [
+ 32
+ ],
+ "type": "index",
+ "data": {
+ "on": 32,
+ "name": "idx_asset_ocr_asset_id",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_asset_ocr_asset_id ON asset_ocr_entity (asset_id)",
+ "unique": false,
+ "columns": []
+ }
+ }
+ ],
+ "fixed_sql": [
+ {
+ "name": "user_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"user_entity\" (\"id\" TEXT NOT NULL, \"name\" TEXT NOT NULL, \"email\" TEXT NOT NULL, \"has_profile_image\" INTEGER NOT NULL DEFAULT 0 CHECK (\"has_profile_image\" IN (0, 1)), \"profile_changed_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"avatar_color\" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (\"id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "remote_asset_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"remote_asset_entity\" (\"name\" TEXT NOT NULL, \"type\" INTEGER NOT NULL, \"created_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"updated_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"width\" INTEGER NULL, \"height\" INTEGER NULL, \"duration_ms\" INTEGER NULL, \"id\" TEXT NOT NULL, \"checksum\" TEXT NOT NULL, \"is_favorite\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_favorite\" IN (0, 1)), \"owner_id\" TEXT NOT NULL REFERENCES user_entity (id) ON DELETE CASCADE, \"local_date_time\" TEXT NULL, \"thumb_hash\" TEXT NULL, \"deleted_at\" TEXT NULL, \"uploaded_at\" TEXT NULL, \"live_photo_video_id\" TEXT NULL, \"visibility\" INTEGER NOT NULL, \"stack_id\" TEXT NULL, \"library_id\" TEXT NULL, \"is_edited\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_edited\" IN (0, 1)), PRIMARY KEY (\"id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "stack_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"stack_entity\" (\"id\" TEXT NOT NULL, \"created_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"updated_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"owner_id\" TEXT NOT NULL REFERENCES user_entity (id) ON DELETE CASCADE, \"primary_asset_id\" TEXT NOT NULL, PRIMARY KEY (\"id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "local_asset_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"local_asset_entity\" (\"name\" TEXT NOT NULL, \"type\" INTEGER NOT NULL, \"created_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"updated_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"width\" INTEGER NULL, \"height\" INTEGER NULL, \"duration_ms\" INTEGER NULL, \"id\" TEXT NOT NULL, \"checksum\" TEXT NULL, \"is_favorite\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_favorite\" IN (0, 1)), \"orientation\" INTEGER NOT NULL DEFAULT 0, \"i_cloud_id\" TEXT NULL, \"adjustment_time\" TEXT NULL, \"latitude\" REAL NULL, \"longitude\" REAL NULL, \"playback_style\" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (\"id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "remote_album_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"remote_album_entity\" (\"id\" TEXT NOT NULL, \"name\" TEXT NOT NULL, \"description\" TEXT NOT NULL DEFAULT '', \"created_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"updated_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"thumbnail_asset_id\" TEXT NULL REFERENCES remote_asset_entity (id) ON DELETE SET NULL, \"is_activity_enabled\" INTEGER NOT NULL DEFAULT 1 CHECK (\"is_activity_enabled\" IN (0, 1)), \"order\" INTEGER NOT NULL, PRIMARY KEY (\"id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "local_album_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"local_album_entity\" (\"id\" TEXT NOT NULL, \"name\" TEXT NOT NULL, \"updated_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"backup_selection\" INTEGER NOT NULL, \"is_ios_shared_album\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_ios_shared_album\" IN (0, 1)), \"linked_remote_album_id\" TEXT NULL REFERENCES remote_album_entity (id) ON DELETE SET NULL, \"marker\" INTEGER NULL CHECK (\"marker\" IN (0, 1)), PRIMARY KEY (\"id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "local_album_asset_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"local_album_asset_entity\" (\"asset_id\" TEXT NOT NULL REFERENCES local_asset_entity (id) ON DELETE CASCADE, \"album_id\" TEXT NOT NULL REFERENCES local_album_entity (id) ON DELETE CASCADE, \"marker\" INTEGER NULL CHECK (\"marker\" IN (0, 1)), PRIMARY KEY (\"asset_id\", \"album_id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "idx_local_album_asset_album_asset",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_local_album_asset_album_asset ON local_album_asset_entity (album_id, asset_id)"
+ }
+ ]
+ },
+ {
+ "name": "idx_local_asset_checksum",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_local_asset_checksum ON local_asset_entity (checksum)"
+ }
+ ]
+ },
+ {
+ "name": "idx_local_asset_cloud_id",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_local_asset_cloud_id ON local_asset_entity (i_cloud_id)"
+ }
+ ]
+ },
+ {
+ "name": "idx_local_asset_created_at",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_local_asset_created_at ON local_asset_entity (created_at)"
+ }
+ ]
+ },
+ {
+ "name": "idx_stack_primary_asset_id",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_stack_primary_asset_id ON stack_entity (primary_asset_id)"
+ }
+ ]
+ },
+ {
+ "name": "UQ_remote_assets_owner_checksum",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE UNIQUE INDEX IF NOT EXISTS UQ_remote_assets_owner_checksum ON remote_asset_entity (owner_id, checksum) WHERE(library_id IS NULL)"
+ }
+ ]
+ },
+ {
+ "name": "UQ_remote_assets_owner_library_checksum",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE UNIQUE INDEX IF NOT EXISTS UQ_remote_assets_owner_library_checksum ON remote_asset_entity (owner_id, library_id, checksum) WHERE(library_id IS NOT NULL)"
+ }
+ ]
+ },
+ {
+ "name": "idx_remote_asset_checksum",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_remote_asset_checksum ON remote_asset_entity (checksum)"
+ }
+ ]
+ },
+ {
+ "name": "idx_remote_asset_stack_id",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_remote_asset_stack_id ON remote_asset_entity (stack_id)"
+ }
+ ]
+ },
+ {
+ "name": "idx_remote_asset_owner_visibility_deleted_created",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_remote_asset_owner_visibility_deleted_created ON remote_asset_entity (owner_id, visibility, deleted_at, created_at DESC)"
+ }
+ ]
+ },
+ {
+ "name": "auth_user_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"auth_user_entity\" (\"id\" TEXT NOT NULL, \"name\" TEXT NOT NULL, \"email\" TEXT NOT NULL, \"is_admin\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_admin\" IN (0, 1)), \"has_profile_image\" INTEGER NOT NULL DEFAULT 0 CHECK (\"has_profile_image\" IN (0, 1)), \"profile_changed_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"avatar_color\" INTEGER NOT NULL, \"quota_size_in_bytes\" INTEGER NOT NULL DEFAULT 0, \"quota_usage_in_bytes\" INTEGER NOT NULL DEFAULT 0, \"pin_code\" TEXT NULL, PRIMARY KEY (\"id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "user_metadata_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"user_metadata_entity\" (\"user_id\" TEXT NOT NULL REFERENCES user_entity (id) ON DELETE CASCADE, \"key\" INTEGER NOT NULL, \"value\" BLOB NOT NULL, PRIMARY KEY (\"user_id\", \"key\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "partner_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"partner_entity\" (\"shared_by_id\" TEXT NOT NULL REFERENCES user_entity (id) ON DELETE CASCADE, \"shared_with_id\" TEXT NOT NULL REFERENCES user_entity (id) ON DELETE CASCADE, \"in_timeline\" INTEGER NOT NULL DEFAULT 0 CHECK (\"in_timeline\" IN (0, 1)), PRIMARY KEY (\"shared_by_id\", \"shared_with_id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "remote_exif_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"remote_exif_entity\" (\"asset_id\" TEXT NOT NULL REFERENCES remote_asset_entity (id) ON DELETE CASCADE, \"city\" TEXT NULL, \"state\" TEXT NULL, \"country\" TEXT NULL, \"date_time_original\" TEXT NULL, \"description\" TEXT NULL, \"height\" INTEGER NULL, \"width\" INTEGER NULL, \"exposure_time\" TEXT NULL, \"f_number\" REAL NULL, \"file_size\" INTEGER NULL, \"focal_length\" REAL NULL, \"latitude\" REAL NULL, \"longitude\" REAL NULL, \"iso\" INTEGER NULL, \"make\" TEXT NULL, \"model\" TEXT NULL, \"lens\" TEXT NULL, \"orientation\" TEXT NULL, \"time_zone\" TEXT NULL, \"rating\" INTEGER NULL, \"projection_type\" TEXT NULL, PRIMARY KEY (\"asset_id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "remote_album_asset_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"remote_album_asset_entity\" (\"asset_id\" TEXT NOT NULL REFERENCES remote_asset_entity (id) ON DELETE CASCADE, \"album_id\" TEXT NOT NULL REFERENCES remote_album_entity (id) ON DELETE CASCADE, PRIMARY KEY (\"asset_id\", \"album_id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "remote_album_user_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"remote_album_user_entity\" (\"album_id\" TEXT NOT NULL REFERENCES remote_album_entity (id) ON DELETE CASCADE, \"user_id\" TEXT NOT NULL REFERENCES user_entity (id) ON DELETE CASCADE, \"role\" INTEGER NOT NULL, PRIMARY KEY (\"album_id\", \"user_id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "remote_asset_cloud_id_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"remote_asset_cloud_id_entity\" (\"asset_id\" TEXT NOT NULL REFERENCES remote_asset_entity (id) ON DELETE CASCADE, \"cloud_id\" TEXT NULL, \"created_at\" TEXT NULL, \"adjustment_time\" TEXT NULL, \"latitude\" REAL NULL, \"longitude\" REAL NULL, PRIMARY KEY (\"asset_id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "memory_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"memory_entity\" (\"id\" TEXT NOT NULL, \"created_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"updated_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"deleted_at\" TEXT NULL, \"owner_id\" TEXT NOT NULL REFERENCES user_entity (id) ON DELETE CASCADE, \"type\" INTEGER NOT NULL, \"data\" TEXT NOT NULL, \"is_saved\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_saved\" IN (0, 1)), \"memory_at\" TEXT NOT NULL, \"seen_at\" TEXT NULL, \"show_at\" TEXT NULL, \"hide_at\" TEXT NULL, PRIMARY KEY (\"id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "memory_asset_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"memory_asset_entity\" (\"asset_id\" TEXT NOT NULL REFERENCES remote_asset_entity (id) ON DELETE CASCADE, \"memory_id\" TEXT NOT NULL REFERENCES memory_entity (id) ON DELETE CASCADE, PRIMARY KEY (\"asset_id\", \"memory_id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "person_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"person_entity\" (\"id\" TEXT NOT NULL, \"created_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"updated_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"owner_id\" TEXT NOT NULL REFERENCES user_entity (id) ON DELETE CASCADE, \"name\" TEXT NOT NULL, \"face_asset_id\" TEXT NULL, \"is_favorite\" INTEGER NOT NULL CHECK (\"is_favorite\" IN (0, 1)), \"is_hidden\" INTEGER NOT NULL CHECK (\"is_hidden\" IN (0, 1)), \"color\" TEXT NULL, \"birth_date\" TEXT NULL, PRIMARY KEY (\"id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "asset_face_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"asset_face_entity\" (\"id\" TEXT NOT NULL, \"asset_id\" TEXT NOT NULL REFERENCES remote_asset_entity (id) ON DELETE CASCADE, \"person_id\" TEXT NULL REFERENCES person_entity (id) ON DELETE SET NULL, \"image_width\" INTEGER NOT NULL, \"image_height\" INTEGER NOT NULL, \"bounding_box_x1\" INTEGER NOT NULL, \"bounding_box_y1\" INTEGER NOT NULL, \"bounding_box_x2\" INTEGER NOT NULL, \"bounding_box_y2\" INTEGER NOT NULL, \"source_type\" TEXT NOT NULL, \"is_visible\" INTEGER NOT NULL DEFAULT 1 CHECK (\"is_visible\" IN (0, 1)), \"deleted_at\" TEXT NULL, PRIMARY KEY (\"id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "store_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"store_entity\" (\"id\" INTEGER NOT NULL, \"string_value\" TEXT NULL, \"int_value\" INTEGER NULL, PRIMARY KEY (\"id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "trashed_local_asset_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"trashed_local_asset_entity\" (\"name\" TEXT NOT NULL, \"type\" INTEGER NOT NULL, \"created_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"updated_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), \"width\" INTEGER NULL, \"height\" INTEGER NULL, \"duration_ms\" INTEGER NULL, \"id\" TEXT NOT NULL, \"album_id\" TEXT NOT NULL, \"checksum\" TEXT NULL, \"is_favorite\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_favorite\" IN (0, 1)), \"orientation\" INTEGER NOT NULL DEFAULT 0, \"source\" INTEGER NOT NULL, \"playback_style\" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (\"id\", \"album_id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "asset_edit_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"asset_edit_entity\" (\"id\" TEXT NOT NULL, \"asset_id\" TEXT NOT NULL REFERENCES remote_asset_entity (id) ON DELETE CASCADE, \"action\" INTEGER NOT NULL, \"parameters\" BLOB NOT NULL, \"sequence\" INTEGER NOT NULL, PRIMARY KEY (\"id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "settings",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"settings\" (\"key\" TEXT NOT NULL, \"value\" TEXT NOT NULL, \"updated_at\" TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP), PRIMARY KEY (\"key\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "asset_ocr_entity",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE TABLE IF NOT EXISTS \"asset_ocr_entity\" (\"id\" TEXT NOT NULL, \"asset_id\" TEXT NOT NULL REFERENCES remote_asset_entity (id) ON DELETE CASCADE, \"x1\" REAL NOT NULL, \"y1\" REAL NOT NULL, \"x2\" REAL NOT NULL, \"y2\" REAL NOT NULL, \"x3\" REAL NOT NULL, \"y3\" REAL NOT NULL, \"x4\" REAL NOT NULL, \"y4\" REAL NOT NULL, \"box_score\" REAL NOT NULL, \"text_score\" REAL NOT NULL, \"recognized_text\" TEXT NOT NULL, \"is_visible\" INTEGER NOT NULL DEFAULT 1 CHECK (\"is_visible\" IN (0, 1)), PRIMARY KEY (\"id\")) WITHOUT ROWID, STRICT;"
+ }
+ ]
+ },
+ {
+ "name": "idx_partner_shared_with_id",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_partner_shared_with_id ON partner_entity (shared_with_id)"
+ }
+ ]
+ },
+ {
+ "name": "idx_lat_lng",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_lat_lng ON remote_exif_entity (latitude, longitude)"
+ }
+ ]
+ },
+ {
+ "name": "idx_remote_exif_city",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_remote_exif_city ON remote_exif_entity (city) WHERE city IS NOT NULL"
+ }
+ ]
+ },
+ {
+ "name": "idx_remote_album_asset_album_asset",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_remote_album_asset_album_asset ON remote_album_asset_entity (album_id, asset_id)"
+ }
+ ]
+ },
+ {
+ "name": "idx_remote_asset_cloud_id",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_remote_asset_cloud_id ON remote_asset_cloud_id_entity (cloud_id)"
+ }
+ ]
+ },
+ {
+ "name": "idx_person_owner_id",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_person_owner_id ON person_entity (owner_id)"
+ }
+ ]
+ },
+ {
+ "name": "idx_asset_face_person_id",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_asset_face_person_id ON asset_face_entity (person_id)"
+ }
+ ]
+ },
+ {
+ "name": "idx_asset_face_asset_id",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_asset_face_asset_id ON asset_face_entity (asset_id)"
+ }
+ ]
+ },
+ {
+ "name": "idx_asset_face_visible_person",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_asset_face_visible_person ON asset_face_entity (person_id, asset_id) WHERE is_visible = 1 AND deleted_at IS NULL"
+ }
+ ]
+ },
+ {
+ "name": "idx_trashed_local_asset_checksum",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_checksum ON trashed_local_asset_entity (checksum)"
+ }
+ ]
+ },
+ {
+ "name": "idx_trashed_local_asset_album",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_album ON trashed_local_asset_entity (album_id)"
+ }
+ ]
+ },
+ {
+ "name": "idx_asset_edit_asset_id",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_asset_edit_asset_id ON asset_edit_entity (asset_id)"
+ }
+ ]
+ },
+ {
+ "name": "idx_asset_ocr_asset_id",
+ "sql": [
+ {
+ "dialect": "sqlite",
+ "sql": "CREATE INDEX IF NOT EXISTS idx_asset_ocr_asset_id ON asset_ocr_entity (asset_id)"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/mobile/lib/domain/models/ocr.model.dart b/mobile/lib/domain/models/ocr.model.dart
new file mode 100644
index 0000000000..403c06d44e
--- /dev/null
+++ b/mobile/lib/domain/models/ocr.model.dart
@@ -0,0 +1,128 @@
+class Ocr {
+ final String id;
+ final String assetId;
+ final double x1;
+ final double y1;
+ final double x2;
+ final double y2;
+ final double x3;
+ final double y3;
+ final double x4;
+ final double y4;
+ final double boxScore;
+ final double textScore;
+ final String text;
+ final bool isVisible;
+
+ const Ocr({
+ required this.id,
+ required this.assetId,
+ required this.x1,
+ required this.y1,
+ required this.x2,
+ required this.y2,
+ required this.x3,
+ required this.y3,
+ required this.x4,
+ required this.y4,
+ required this.boxScore,
+ required this.textScore,
+ required this.text,
+ required this.isVisible,
+ });
+
+ Ocr copyWith({
+ String? id,
+ String? assetId,
+ double? x1,
+ double? y1,
+ double? x2,
+ double? y2,
+ double? x3,
+ double? y3,
+ double? x4,
+ double? y4,
+ double? boxScore,
+ double? textScore,
+ String? text,
+ bool? isVisible,
+ }) {
+ return Ocr(
+ id: id ?? this.id,
+ assetId: assetId ?? this.assetId,
+ x1: x1 ?? this.x1,
+ y1: y1 ?? this.y1,
+ x2: x2 ?? this.x2,
+ y2: y2 ?? this.y2,
+ x3: x3 ?? this.x3,
+ y3: y3 ?? this.y3,
+ x4: x4 ?? this.x4,
+ y4: y4 ?? this.y4,
+ boxScore: boxScore ?? this.boxScore,
+ textScore: textScore ?? this.textScore,
+ text: text ?? this.text,
+ isVisible: isVisible ?? this.isVisible,
+ );
+ }
+
+ @override
+ String toString() {
+ return '''Ocr {
+ id: $id,
+ assetId: $assetId,
+ x1: $x1,
+ y1: $y1,
+ x2: $x2,
+ y2: $y2,
+ x3: $x3,
+ y3: $y3,
+ x4: $x4,
+ y4: $y4,
+ boxScore: $boxScore,
+ textScore: $textScore,
+ text: $text,
+ isVisible: $isVisible
+ }''';
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (identical(this, other)) {
+ return true;
+ }
+
+ return other is Ocr &&
+ other.id == id &&
+ other.assetId == assetId &&
+ other.x1 == x1 &&
+ other.y1 == y1 &&
+ other.x2 == x2 &&
+ other.y2 == y2 &&
+ other.x3 == x3 &&
+ other.y3 == y3 &&
+ other.x4 == x4 &&
+ other.y4 == y4 &&
+ other.boxScore == boxScore &&
+ other.textScore == textScore &&
+ other.text == text &&
+ other.isVisible == isVisible;
+ }
+
+ @override
+ int get hashCode {
+ return id.hashCode ^
+ assetId.hashCode ^
+ x1.hashCode ^
+ y1.hashCode ^
+ x2.hashCode ^
+ y2.hashCode ^
+ x3.hashCode ^
+ y3.hashCode ^
+ x4.hashCode ^
+ y4.hashCode ^
+ boxScore.hashCode ^
+ textScore.hashCode ^
+ text.hashCode ^
+ isVisible.hashCode;
+ }
+}
diff --git a/mobile/lib/domain/services/ocr.service.dart b/mobile/lib/domain/services/ocr.service.dart
new file mode 100644
index 0000000000..2786b1ce22
--- /dev/null
+++ b/mobile/lib/domain/services/ocr.service.dart
@@ -0,0 +1,12 @@
+import 'package:immich_mobile/domain/models/ocr.model.dart';
+import 'package:immich_mobile/infrastructure/repositories/ocr.repository.dart';
+
+class OcrService {
+ final OcrRepository _repository;
+
+ const OcrService(this._repository);
+
+ Future<List<Ocr>?> get(String assetId) {
+ return _repository.get(assetId);
+ }
+}
diff --git a/mobile/lib/domain/services/sync_stream.service.dart b/mobile/lib/domain/services/sync_stream.service.dart
index 08109b25d3..5a197dc88a 100644
--- a/mobile/lib/domain/services/sync_stream.service.dart
+++ b/mobile/lib/domain/services/sync_stream.service.dart
@@ -317,6 +317,10 @@ class SyncStreamService {
return _syncStreamRepository.updateAssetFacesV2(data.cast());
case SyncEntityType.assetFaceDeleteV1:
return _syncStreamRepository.deleteAssetFacesV1(data.cast());
+ case SyncEntityType.assetOcrV1:
+ return _syncStreamRepository.updateAssetOcrV1(data.cast());
+ case SyncEntityType.assetOcrDeleteV1:
+ return _syncStreamRepository.deleteAssetOcrV1(data.cast());
default:
_logger.warning("Unknown sync data type: $type");
}
diff --git a/mobile/lib/infrastructure/entities/asset_ocr.entity.dart b/mobile/lib/infrastructure/entities/asset_ocr.entity.dart
new file mode 100644
index 0000000000..40438ca1ed
--- /dev/null
+++ b/mobile/lib/infrastructure/entities/asset_ocr.entity.dart
@@ -0,0 +1,34 @@
+import 'package:drift/drift.dart';
+import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart';
+import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
+
[email protected]('CREATE INDEX IF NOT EXISTS idx_asset_ocr_asset_id ON asset_ocr_entity (asset_id)')
+class AssetOcrEntity extends Table with DriftDefaultsMixin {
+ const AssetOcrEntity();
+
+ TextColumn get id => text()();
+
+ TextColumn get assetId => text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
+
+ RealColumn get x1 => real()();
+ RealColumn get y1 => real()();
+
+ RealColumn get x2 => real()();
+ RealColumn get y2 => real()();
+
+ RealColumn get x3 => real()();
+ RealColumn get y3 => real()();
+
+ RealColumn get x4 => real()();
+ RealColumn get y4 => real()();
+
+ RealColumn get boxScore => real()();
+ RealColumn get textScore => real()();
+
+ TextColumn get recognizedText => text()();
+
+ BoolColumn get isVisible => boolean().withDefault(const Constant(true))();
+
+ @override
+ Set<Column> get primaryKey => {id};
+}
diff --git a/mobile/lib/infrastructure/entities/asset_ocr.entity.drift.dart b/mobile/lib/infrastructure/entities/asset_ocr.entity.drift.dart
new file mode 100644
index 0000000000..5d6d8787de
--- /dev/null
+++ b/mobile/lib/infrastructure/entities/asset_ocr.entity.drift.dart
@@ -0,0 +1,1288 @@
+// dart format width=80
+// ignore_for_file: type=lint
+import 'package:drift/drift.dart' as i0;
+import 'package:immich_mobile/infrastructure/entities/asset_ocr.entity.drift.dart'
+ as i1;
+import 'package:immich_mobile/infrastructure/entities/asset_ocr.entity.dart'
+ as i2;
+import 'package:drift/src/runtime/query_builder/query_builder.dart' as i3;
+import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.drift.dart'
+ as i4;
+import 'package:drift/internal/modular.dart' as i5;
+
+typedef $$AssetOcrEntityTableCreateCompanionBuilder =
+ i1.AssetOcrEntityCompanion Function({
+ required String id,
+ required String assetId,
+ required double x1,
+ required double y1,
+ required double x2,
+ required double y2,
+ required double x3,
+ required double y3,
+ required double x4,
+ required double y4,
+ required double boxScore,
+ required double textScore,
+ required String recognizedText,
+ i0.Value<bool> isVisible,
+ });
+typedef $$AssetOcrEntityTableUpdateCompanionBuilder =
+ i1.AssetOcrEntityCompanion Function({
+ i0.Value<String> id,
+ i0.Value<String> assetId,
+ i0.Value<double> x1,
+ i0.Value<double> y1,
+ i0.Value<double> x2,
+ i0.Value<double> y2,
+ i0.Value<double> x3,
+ i0.Value<double> y3,
+ i0.Value<double> x4,
+ i0.Value<double> y4,
+ i0.Value<double> boxScore,
+ i0.Value<double> textScore,
+ i0.Value<String> recognizedText,
+ i0.Value<bool> isVisible,
+ });
+
+final class $$AssetOcrEntityTableReferences
+ extends
+ i0.BaseReferences<
+ i0.GeneratedDatabase,
+ i1.$AssetOcrEntityTable,
+ i1.AssetOcrEntityData
+ > {
+ $$AssetOcrEntityTableReferences(
+ super.$_db,
+ super.$_table,
+ super.$_typedResult,
+ );
+
+ static i4.$RemoteAssetEntityTable _assetIdTable(i0.GeneratedDatabase db) =>
+ i5.ReadDatabaseContainer(db)
+ .resultSet<i4.$RemoteAssetEntityTable>('remote_asset_entity')
+ .createAlias(
+ i0.$_aliasNameGenerator(
+ i5.ReadDatabaseContainer(
+ db,
+ ).resultSet<i1.$AssetOcrEntityTable>('asset_ocr_entity').assetId,
+ i5.ReadDatabaseContainer(
+ db,
+ ).resultSet<i4.$RemoteAssetEntityTable>('remote_asset_entity').id,
+ ),
+ );
+
+ i4.$$RemoteAssetEntityTableProcessedTableManager get assetId {
+ final $_column = $_itemColumn<String>('asset_id')!;
+
+ final manager = i4
+ .$$RemoteAssetEntityTableTableManager(
+ $_db,
+ i5.ReadDatabaseContainer(
+ $_db,
+ ).resultSet<i4.$RemoteAssetEntityTable>('remote_asset_entity'),
+ )
+ .filter((f) => f.id.sqlEquals($_column));
+ final item = $_typedResult.readTableOrNull(_assetIdTable($_db));
+ if (item == null) return manager;
+ return i0.ProcessedTableManager(
+ manager.$state.copyWith(prefetchedData: [item]),
+ );
+ }
+}
+
+class $$AssetOcrEntityTableFilterComposer
+ extends i0.Composer<i0.GeneratedDatabase, i1.$AssetOcrEntityTable> {
+ $$AssetOcrEntityTableFilterComposer({
+ required super.$db,
+ required super.$table,
+ super.joinBuilder,
+ super.$addJoinBuilderToRootComposer,
+ super.$removeJoinBuilderFromRootComposer,
+ });
+ i0.ColumnFilters<String> get id => $composableBuilder(
+ column: $table.id,
+ builder: (column) => i0.ColumnFilters(column),
+ );
+
+ i0.ColumnFilters<double> get x1 => $composableBuilder(
+ column: $table.x1,
+ builder: (column) => i0.ColumnFilters(column),
+ );
+
+ i0.ColumnFilters<double> get y1 => $composableBuilder(
+ column: $table.y1,
+ builder: (column) => i0.ColumnFilters(column),
+ );
+
+ i0.ColumnFilters<double> get x2 => $composableBuilder(
+ column: $table.x2,
+ builder: (column) => i0.ColumnFilters(column),
+ );
+
+ i0.ColumnFilters<double> get y2 => $composableBuilder(
+ column: $table.y2,
+ builder: (column) => i0.ColumnFilters(column),
+ );
+
+ i0.ColumnFilters<double> get x3 => $composableBuilder(
+ column: $table.x3,
+ builder: (column) => i0.ColumnFilters(column),
+ );
+
+ i0.ColumnFilters<double> get y3 => $composableBuilder(
+ column: $table.y3,
+ builder: (column) => i0.ColumnFilters(column),
+ );
+
+ i0.ColumnFilters<double> get x4 => $composableBuilder(
+ column: $table.x4,
+ builder: (column) => i0.ColumnFilters(column),
+ );
+
+ i0.ColumnFilters<double> get y4 => $composableBuilder(
+ column: $table.y4,
+ builder: (column) => i0.ColumnFilters(column),
+ );
+
+ i0.ColumnFilters<double> get boxScore => $composableBuilder(
+ column: $table.boxScore,
+ builder: (column) => i0.ColumnFilters(column),
+ );
+
+ i0.ColumnFilters<double> get textScore => $composableBuilder(
+ column: $table.textScore,
+ builder: (column) => i0.ColumnFilters(column),
+ );
+
+ i0.ColumnFilters<String> get recognizedText => $composableBuilder(
+ column: $table.recognizedText,
+ builder: (column) => i0.ColumnFilters(column),
+ );
+
+ i0.ColumnFilters<bool> get isVisible => $composableBuilder(
+ column: $table.isVisible,
+ builder: (column) => i0.ColumnFilters(column),
+ );
+
+ i4.$$RemoteAssetEntityTableFilterComposer get assetId {
+ final i4.$$RemoteAssetEntityTableFilterComposer composer = $composerBuilder(
+ composer: this,
+ getCurrentColumn: (t) => t.assetId,
+ referencedTable: i5.ReadDatabaseContainer(
+ $db,
+ ).resultSet<i4.$RemoteAssetEntityTable>('remote_asset_entity'),
+ getReferencedColumn: (t) => t.id,
+ builder:
+ (
+ joinBuilder, {
+ $addJoinBuilderToRootComposer,
+ $removeJoinBuilderFromRootComposer,
+ }) => i4.$$RemoteAssetEntityTableFilterComposer(
+ $db: $db,
+ $table: i5.ReadDatabaseContainer(
+ $db,
+ ).resultSet<i4.$RemoteAssetEntityTable>('remote_asset_entity'),
+ $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
+ joinBuilder: joinBuilder,
+ $removeJoinBuilderFromRootComposer:
+ $removeJoinBuilderFromRootComposer,
+ ),
+ );
+ return composer;
+ }
+}
+
+class $$AssetOcrEntityTableOrderingComposer
+ extends i0.Composer<i0.GeneratedDatabase, i1.$AssetOcrEntityTable> {
+ $$AssetOcrEntityTableOrderingComposer({
+ required super.$db,
+ required super.$table,
+ super.joinBuilder,
+ super.$addJoinBuilderToRootComposer,
+ super.$removeJoinBuilderFromRootComposer,
+ });
+ i0.ColumnOrderings<String> get id => $composableBuilder(
+ column: $table.id,
+ builder: (column) => i0.ColumnOrderings(column),
+ );
+
+ i0.ColumnOrderings<double> get x1 => $composableBuilder(
+ column: $table.x1,
+ builder: (column) => i0.ColumnOrderings(column),
+ );
+
+ i0.ColumnOrderings<double> get y1 => $composableBuilder(
+ column: $table.y1,
+ builder: (column) => i0.ColumnOrderings(column),
+ );
+
+ i0.ColumnOrderings<double> get x2 => $composableBuilder(
+ column: $table.x2,
+ builder: (column) => i0.ColumnOrderings(column),
+ );
+
+ i0.ColumnOrderings<double> get y2 => $composableBuilder(
+ column: $table.y2,
+ builder: (column) => i0.ColumnOrderings(column),
+ );
+
+ i0.ColumnOrderings<double> get x3 => $composableBuilder(
+ column: $table.x3,
+ builder: (column) => i0.ColumnOrderings(column),
+ );
+
+ i0.ColumnOrderings<double> get y3 => $composableBuilder(
+ column: $table.y3,
+ builder: (column) => i0.ColumnOrderings(column),
+ );
+
+ i0.ColumnOrderings<double> get x4 => $composableBuilder(
+ column: $table.x4,
+ builder: (column) => i0.ColumnOrderings(column),
+ );
+
+ i0.ColumnOrderings<double> get y4 => $composableBuilder(
+ column: $table.y4,
+ builder: (column) => i0.ColumnOrderings(column),
+ );
+
+ i0.ColumnOrderings<double> get boxScore => $composableBuilder(
+ column: $table.boxScore,
+ builder: (column) => i0.ColumnOrderings(column),
+ );
+
+ i0.ColumnOrderings<double> get textScore => $composableBuilder(
+ column: $table.textScore,
+ builder: (column) => i0.ColumnOrderings(column),
+ );
+
+ i0.ColumnOrderings<String> get recognizedText => $composableBuilder(
+ column: $table.recognizedText,
+ builder: (column) => i0.ColumnOrderings(column),
+ );
+
+ i0.ColumnOrderings<bool> get isVisible => $composableBuilder(
+ column: $table.isVisible,
+ builder: (column) => i0.ColumnOrderings(column),
+ );
+
+ i4.$$RemoteAssetEntityTableOrderingComposer get assetId {
+ final i4.$$RemoteAssetEntityTableOrderingComposer composer =
+ $composerBuilder(
+ composer: this,
+ getCurrentColumn: (t) => t.assetId,
+ referencedTable: i5.ReadDatabaseContainer(
+ $db,
+ ).resultSet<i4.$RemoteAssetEntityTable>('remote_asset_entity'),
+ getReferencedColumn: (t) => t.id,
+ builder:
+ (
+ joinBuilder, {
+ $addJoinBuilderToRootComposer,
+ $removeJoinBuilderFromRootComposer,
+ }) => i4.$$RemoteAssetEntityTableOrderingComposer(
+ $db: $db,
+ $table: i5.ReadDatabaseContainer(
+ $db,
+ ).resultSet<i4.$RemoteAssetEntityTable>('remote_asset_entity'),
+ $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
+ joinBuilder: joinBuilder,
+ $removeJoinBuilderFromRootComposer:
+ $removeJoinBuilderFromRootComposer,
+ ),
+ );
+ return composer;
+ }
+}
+
+class $$AssetOcrEntityTableAnnotationComposer
+ extends i0.Composer<i0.GeneratedDatabase, i1.$AssetOcrEntityTable> {
+ $$AssetOcrEntityTableAnnotationComposer({
+ required super.$db,
+ required super.$table,
+ super.joinBuilder,
+ super.$addJoinBuilderToRootComposer,
+ super.$removeJoinBuilderFromRootComposer,
+ });
+ i0.GeneratedColumn<String> get id =>
+ $composableBuilder(column: $table.id, builder: (column) => column);
+
+ i0.GeneratedColumn<double> get x1 =>
+ $composableBuilder(column: $table.x1, builder: (column) => column);
+
+ i0.GeneratedColumn<double> get y1 =>
+ $composableBuilder(column: $table.y1, builder: (column) => column);
+
+ i0.GeneratedColumn<double> get x2 =>
+ $composableBuilder(column: $table.x2, builder: (column) => column);
+
+ i0.GeneratedColumn<double> get y2 =>
+ $composableBuilder(column: $table.y2, builder: (column) => column);
+
+ i0.GeneratedColumn<double> get x3 =>
+ $composableBuilder(column: $table.x3, builder: (column) => column);
+
+ i0.GeneratedColumn<double> get y3 =>
+ $composableBuilder(column: $table.y3, builder: (column) => column);
+
+ i0.GeneratedColumn<double> get x4 =>
+ $composableBuilder(column: $table.x4, builder: (column) => column);
+
+ i0.GeneratedColumn<double> get y4 =>
+ $composableBuilder(column: $table.y4, builder: (column) => column);
+
+ i0.GeneratedColumn<double> get boxScore =>
+ $composableBuilder(column: $table.boxScore, builder: (column) => column);
+
+ i0.GeneratedColumn<double> get textScore =>
+ $composableBuilder(column: $table.textScore, builder: (column) => column);
+
+ i0.GeneratedColumn<String> get recognizedText => $composableBuilder(
+ column: $table.recognizedText,
+ builder: (column) => column,
+ );
+
+ i0.GeneratedColumn<bool> get isVisible =>
+ $composableBuilder(column: $table.isVisible, builder: (column) => column);
+
+ i4.$$RemoteAssetEntityTableAnnotationComposer get assetId {
+ final i4.$$RemoteAssetEntityTableAnnotationComposer composer =
+ $composerBuilder(
+ composer: this,
+ getCurrentColumn: (t) => t.assetId,
+ referencedTable: i5.ReadDatabaseContainer(
+ $db,
+ ).resultSet<i4.$RemoteAssetEntityTable>('remote_asset_entity'),
+ getReferencedColumn: (t) => t.id,
+ builder:
+ (
+ joinBuilder, {
+ $addJoinBuilderToRootComposer,
+ $removeJoinBuilderFromRootComposer,
+ }) => i4.$$RemoteAssetEntityTableAnnotationComposer(
+ $db: $db,
+ $table: i5.ReadDatabaseContainer(
+ $db,
+ ).resultSet<i4.$RemoteAssetEntityTable>('remote_asset_entity'),
+ $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
+ joinBuilder: joinBuilder,
+ $removeJoinBuilderFromRootComposer:
+ $removeJoinBuilderFromRootComposer,
+ ),
+ );
+ return composer;
+ }
+}
+
+class $$AssetOcrEntityTableTableManager
+ extends
+ i0.RootTableManager<
+ i0.GeneratedDatabase,
+ i1.$AssetOcrEntityTable,
+ i1.AssetOcrEntityData,
+ i1.$$AssetOcrEntityTableFilterComposer,
+ i1.$$AssetOcrEntityTableOrderingComposer,
+ i1.$$AssetOcrEntityTableAnnotationComposer,
+ $$AssetOcrEntityTableCreateCompanionBuilder,
+ $$AssetOcrEntityTableUpdateCompanionBuilder,
+ (i1.AssetOcrEntityData, i1.$$AssetOcrEntityTableReferences),
+ i1.AssetOcrEntityData,
+ i0.PrefetchHooks Function({bool assetId})
+ > {
+ $$AssetOcrEntityTableTableManager(
+ i0.GeneratedDatabase db,
+ i1.$AssetOcrEntityTable table,
+ ) : super(
+ i0.TableManagerState(
+ db: db,
+ table: table,
+ createFilteringComposer: () =>
+ i1.$$AssetOcrEntityTableFilterComposer($db: db, $table: table),
+ createOrderingComposer: () =>
+ i1.$$AssetOcrEntityTableOrderingComposer($db: db, $table: table),
+ createComputedFieldComposer: () => i1
+ .$$AssetOcrEntityTableAnnotationComposer($db: db, $table: table),
+ updateCompanionCallback:
+ ({
+ i0.Value<String> id = const i0.Value.absent(),
+ i0.Value<String> assetId = const i0.Value.absent(),
+ i0.Value<double> x1 = const i0.Value.absent(),
+ i0.Value<double> y1 = const i0.Value.absent(),
+ i0.Value<double> x2 = const i0.Value.absent(),
+ i0.Value<double> y2 = const i0.Value.absent(),
+ i0.Value<double> x3 = const i0.Value.absent(),
+ i0.Value<double> y3 = const i0.Value.absent(),
+ i0.Value<double> x4 = const i0.Value.absent(),
+ i0.Value<double> y4 = const i0.Value.absent(),
+ i0.Value<double> boxScore = const i0.Value.absent(),
+ i0.Value<double> textScore = const i0.Value.absent(),
+ i0.Value<String> recognizedText = const i0.Value.absent(),
+ i0.Value<bool> isVisible = const i0.Value.absent(),
+ }) => i1.AssetOcrEntityCompanion(
+ id: id,
+ assetId: assetId,
+ x1: x1,
+ y1: y1,
+ x2: x2,
+ y2: y2,
+ x3: x3,
+ y3: y3,
+ x4: x4,
+ y4: y4,
+ boxScore: boxScore,
+ textScore: textScore,
+ recognizedText: recognizedText,
+ isVisible: isVisible,
+ ),
+ createCompanionCallback:
+ ({
+ required String id,
+ required String assetId,
+ required double x1,
+ required double y1,
+ required double x2,
+ required double y2,
+ required double x3,
+ required double y3,
+ required double x4,
+ required double y4,
+ required double boxScore,
+ required double textScore,
+ required String recognizedText,
+ i0.Value<bool> isVisible = const i0.Value.absent(),
+ }) => i1.AssetOcrEntityCompanion.insert(
+ id: id,
+ assetId: assetId,
+ x1: x1,
+ y1: y1,
+ x2: x2,
+ y2: y2,
+ x3: x3,
+ y3: y3,
+ x4: x4,
+ y4: y4,
+ boxScore: boxScore,
+ textScore: textScore,
+ recognizedText: recognizedText,
+ isVisible: isVisible,
+ ),
+ withReferenceMapper: (p0) => p0
+ .map(
+ (e) => (
+ e.readTable(table),
+ i1.$$AssetOcrEntityTableReferences(db, table, e),
+ ),
+ )
+ .toList(),
+ prefetchHooksCallback: ({assetId = false}) {
+ return i0.PrefetchHooks(
+ db: db,
+ explicitlyWatchedTables: [],
+ addJoins:
+ <
+ T extends i0.TableManagerState<
+ dynamic,
+ dynamic,
+ dynamic,
+ dynamic,
+ dynamic,
+ dynamic,
+ dynamic,
+ dynamic,
+ dynamic,
+ dynamic,
+ dynamic
+ >
+ >(state) {
+ if (assetId) {
+ state =
+ state.withJoin(
+ currentTable: table,
+ currentColumn: table.assetId,
+ referencedTable: i1
+ .$$AssetOcrEntityTableReferences
+ ._assetIdTable(db),
+ referencedColumn: i1
+ .$$AssetOcrEntityTableReferences
+ ._assetIdTable(db)
+ .id,
+ )
+ as T;
+ }
+
+ return state;
+ },
+ getPrefetchedDataCallback: (items) async {
+ return [];
+ },
+ );
+ },
+ ),
+ );
+}
+
+typedef $$AssetOcrEntityTableProcessedTableManager =
+ i0.ProcessedTableManager<
+ i0.GeneratedDatabase,
+ i1.$AssetOcrEntityTable,
+ i1.AssetOcrEntityData,
+ i1.$$AssetOcrEntityTableFilterComposer,
+ i1.$$AssetOcrEntityTableOrderingComposer,
+ i1.$$AssetOcrEntityTableAnnotationComposer,
+ $$AssetOcrEntityTableCreateCompanionBuilder,
+ $$AssetOcrEntityTableUpdateCompanionBuilder,
+ (i1.AssetOcrEntityData, i1.$$AssetOcrEntityTableReferences),
+ i1.AssetOcrEntityData,
+ i0.PrefetchHooks Function({bool assetId})
+ >;
+i0.Index get idxAssetOcrAssetId => i0.Index(
+ 'idx_asset_ocr_asset_id',
+ 'CREATE INDEX IF NOT EXISTS idx_asset_ocr_asset_id ON asset_ocr_entity (asset_id)',
+);
+
+class $AssetOcrEntityTable extends i2.AssetOcrEntity
+ with i0.TableInfo<$AssetOcrEntityTable, i1.AssetOcrEntityData> {
+ @override
+ final i0.GeneratedDatabase attachedDatabase;
+ final String? _alias;
+ $AssetOcrEntityTable(this.attachedDatabase, [this._alias]);
+ 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 _assetIdMeta = const i0.VerificationMeta(
+ 'assetId',
+ );
+ @override
+ late final i0.GeneratedColumn<String> assetId = i0.GeneratedColumn<String>(
+ 'asset_id',
+ aliasedName,
+ false,
+ type: i0.DriftSqlType.string,
+ requiredDuringInsert: true,
+ defaultConstraints: i0.GeneratedColumn.constraintIsAlways(
+ 'REFERENCES remote_asset_entity (id) ON DELETE CASCADE',
+ ),
+ );
+ static const i0.VerificationMeta _x1Meta = const i0.VerificationMeta('x1');
+ @override
+ late final i0.GeneratedColumn<double> x1 = i0.GeneratedColumn<double>(
+ 'x1',
+ aliasedName,
+ false,
+ type: i0.DriftSqlType.double,
+ requiredDuringInsert: true,
+ );
+ static const i0.VerificationMeta _y1Meta = const i0.VerificationMeta('y1');
+ @override
+ late final i0.GeneratedColumn<double> y1 = i0.GeneratedColumn<double>(
+ 'y1',
+ aliasedName,
+ false,
+ type: i0.DriftSqlType.double,
+ requiredDuringInsert: true,
+ );
+ static const i0.VerificationMeta _x2Meta = const i0.VerificationMeta('x2');
+ @override
+ late final i0.GeneratedColumn<double> x2 = i0.GeneratedColumn<double>(
+ 'x2',
+ aliasedName,
+ false,
+ type: i0.DriftSqlType.double,
+ requiredDuringInsert: true,
+ );
+ static const i0.VerificationMeta _y2Meta = const i0.VerificationMeta('y2');
+ @override
+ late final i0.GeneratedColumn<double> y2 = i0.GeneratedColumn<double>(
+ 'y2',
+ aliasedName,
+ false,
+ type: i0.DriftSqlType.double,
+ requiredDuringInsert: true,
+ );
+ static const i0.VerificationMeta _x3Meta = const i0.VerificationMeta('x3');
+ @override
+ late final i0.GeneratedColumn<double> x3 = i0.GeneratedColumn<double>(
+ 'x3',
+ aliasedName,
+ false,
+ type: i0.DriftSqlType.double,
+ requiredDuringInsert: true,
+ );
+ static const i0.VerificationMeta _y3Meta = const i0.VerificationMeta('y3');
+ @override
+ late final i0.GeneratedColumn<double> y3 = i0.GeneratedColumn<double>(
+ 'y3',
+ aliasedName,
+ false,
+ type: i0.DriftSqlType.double,
+ requiredDuringInsert: true,
+ );
+ static const i0.VerificationMeta _x4Meta = const i0.VerificationMeta('x4');
+ @override
+ late final i0.GeneratedColumn<double> x4 = i0.GeneratedColumn<double>(
+ 'x4',
+ aliasedName,
+ false,
+ type: i0.DriftSqlType.double,
+ requiredDuringInsert: true,
+ );
+ static const i0.VerificationMeta _y4Meta = const i0.VerificationMeta('y4');
+ @override
+ late final i0.GeneratedColumn<double> y4 = i0.GeneratedColumn<double>(
+ 'y4',
+ aliasedName,
+ false,
+ type: i0.DriftSqlType.double,
+ requiredDuringInsert: true,
+ );
+ static const i0.VerificationMeta _boxScoreMeta = const i0.VerificationMeta(
+ 'boxScore',
+ );
+ @override
+ late final i0.GeneratedColumn<double> boxScore = i0.GeneratedColumn<double>(
+ 'box_score',
+ aliasedName,
+ false,
+ type: i0.DriftSqlType.double,
+ requiredDuringInsert: true,
+ );
+ static const i0.VerificationMeta _textScoreMeta = const i0.VerificationMeta(
+ 'textScore',
+ );
+ @override
+ late final i0.GeneratedColumn<double> textScore = i0.GeneratedColumn<double>(
+ 'text_score',
+ aliasedName,
+ false,
+ type: i0.DriftSqlType.double,
+ requiredDuringInsert: true,
+ );
+ static const i0.VerificationMeta _recognizedTextMeta =
+ const i0.VerificationMeta('recognizedText');
+ @override
+ late final i0.GeneratedColumn<String> recognizedText =
+ i0.GeneratedColumn<String>(
+ 'recognized_text',
+ aliasedName,
+ false,
+ type: i0.DriftSqlType.string,
+ requiredDuringInsert: true,
+ );
+ static const i0.VerificationMeta _isVisibleMeta = const i0.VerificationMeta(
+ 'isVisible',
+ );
+ @override
+ late final i0.GeneratedColumn<bool> isVisible = i0.GeneratedColumn<bool>(
+ 'is_visible',
+ aliasedName,
+ false,
+ type: i0.DriftSqlType.bool,
+ requiredDuringInsert: false,
+ defaultConstraints: i0.GeneratedColumn.constraintIsAlways(
+ 'CHECK ("is_visible" IN (0, 1))',
+ ),
+ defaultValue: const i3.Constant(true),
+ );
+ @override
+ List<i0.GeneratedColumn> get $columns => [
+ id,
+ assetId,
+ x1,
+ y1,
+ x2,
+ y2,
+ x3,
+ y3,
+ x4,
+ y4,
+ boxScore,
+ textScore,
+ recognizedText,
+ isVisible,
+ ];
+ @override
+ String get aliasedName => _alias ?? actualTableName;
+ @override
+ String get actualTableName => $name;
+ static const String $name = 'asset_ocr_entity';
+ @override
+ i0.VerificationContext validateIntegrity(
+ i0.Insertable<i1.AssetOcrEntityData> instance, {
+ bool isInserting = false,
+ }) {
+ final context = i0.VerificationContext();
+ final data = instance.toColumns(true);
+ if (data.containsKey('id')) {
+ context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
+ } else if (isInserting) {
+ context.missing(_idMeta);
+ }
+ if (data.containsKey('asset_id')) {
+ context.handle(
+ _assetIdMeta,
+ assetId.isAcceptableOrUnknown(data['asset_id']!, _assetIdMeta),
+ );
+ } else if (isInserting) {
+ context.missing(_assetIdMeta);
+ }
+ if (data.containsKey('x1')) {
+ context.handle(_x1Meta, x1.isAcceptableOrUnknown(data['x1']!, _x1Meta));
+ } else if (isInserting) {
+ context.missing(_x1Meta);
+ }
+ if (data.containsKey('y1')) {
+ context.handle(_y1Meta, y1.isAcceptableOrUnknown(data['y1']!, _y1Meta));
+ } else if (isInserting) {
+ context.missing(_y1Meta);
+ }
+ if (data.containsKey('x2')) {
+ context.handle(_x2Meta, x2.isAcceptableOrUnknown(data['x2']!, _x2Meta));
+ } else if (isInserting) {
+ context.missing(_x2Meta);
+ }
+ if (data.containsKey('y2')) {
+ context.handle(_y2Meta, y2.isAcceptableOrUnknown(data['y2']!, _y2Meta));
+ } else if (isInserting) {
+ context.missing(_y2Meta);
+ }
+ if (data.containsKey('x3')) {
+ context.handle(_x3Meta, x3.isAcceptableOrUnknown(data['x3']!, _x3Meta));
+ } else if (isInserting) {
+ context.missing(_x3Meta);
+ }
+ if (data.containsKey('y3')) {
+ context.handle(_y3Meta, y3.isAcceptableOrUnknown(data['y3']!, _y3Meta));
+ } else if (isInserting) {
+ context.missing(_y3Meta);
+ }
+ if (data.containsKey('x4')) {
+ context.handle(_x4Meta, x4.isAcceptableOrUnknown(data['x4']!, _x4Meta));
+ } else if (isInserting) {
+ context.missing(_x4Meta);
+ }
+ if (data.containsKey('y4')) {
+ context.handle(_y4Meta, y4.isAcceptableOrUnknown(data['y4']!, _y4Meta));
+ } else if (isInserting) {
+ context.missing(_y4Meta);
+ }
+ if (data.containsKey('box_score')) {
+ context.handle(
+ _boxScoreMeta,
+ boxScore.isAcceptableOrUnknown(data['box_score']!, _boxScoreMeta),
+ );
+ } else if (isInserting) {
+ context.missing(_boxScoreMeta);
+ }
+ if (data.containsKey('text_score')) {
+ context.handle(
+ _textScoreMeta,
+ textScore.isAcceptableOrUnknown(data['text_score']!, _textScoreMeta),
+ );
+ } else if (isInserting) {
+ context.missing(_textScoreMeta);
+ }
+ if (data.containsKey('recognized_text')) {
+ context.handle(
+ _recognizedTextMeta,
+ recognizedText.isAcceptableOrUnknown(
+ data['recognized_text']!,
+ _recognizedTextMeta,
+ ),
+ );
+ } else if (isInserting) {
+ context.missing(_recognizedTextMeta);
+ }
+ if (data.containsKey('is_visible')) {
+ context.handle(
+ _isVisibleMeta,
+ isVisible.isAcceptableOrUnknown(data['is_visible']!, _isVisibleMeta),
+ );
+ }
+ return context;
+ }
+
+ @override
+ Set<i0.GeneratedColumn> get $primaryKey => {id};
+ @override
+ i1.AssetOcrEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {
+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
+ return i1.AssetOcrEntityData(
+ id: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.string,
+ data['${effectivePrefix}id'],
+ )!,
+ assetId: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.string,
+ data['${effectivePrefix}asset_id'],
+ )!,
+ x1: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.double,
+ data['${effectivePrefix}x1'],
+ )!,
+ y1: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.double,
+ data['${effectivePrefix}y1'],
+ )!,
+ x2: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.double,
+ data['${effectivePrefix}x2'],
+ )!,
+ y2: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.double,
+ data['${effectivePrefix}y2'],
+ )!,
+ x3: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.double,
+ data['${effectivePrefix}x3'],
+ )!,
+ y3: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.double,
+ data['${effectivePrefix}y3'],
+ )!,
+ x4: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.double,
+ data['${effectivePrefix}x4'],
+ )!,
+ y4: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.double,
+ data['${effectivePrefix}y4'],
+ )!,
+ boxScore: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.double,
+ data['${effectivePrefix}box_score'],
+ )!,
+ textScore: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.double,
+ data['${effectivePrefix}text_score'],
+ )!,
+ recognizedText: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.string,
+ data['${effectivePrefix}recognized_text'],
+ )!,
+ isVisible: attachedDatabase.typeMapping.read(
+ i0.DriftSqlType.bool,
+ data['${effectivePrefix}is_visible'],
+ )!,
+ );
+ }
+
+ @override
+ $AssetOcrEntityTable createAlias(String alias) {
+ return $AssetOcrEntityTable(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+}
+
+class AssetOcrEntityData extends i0.DataClass
+ implements i0.Insertable<i1.AssetOcrEntityData> {
+ final String id;
+ final String assetId;
+ final double x1;
+ final double y1;
+ final double x2;
+ final double y2;
+ final double x3;
+ final double y3;
+ final double x4;
+ final double y4;
+ final double boxScore;
+ final double textScore;
+ final String recognizedText;
+ final bool isVisible;
+ const AssetOcrEntityData({
+ required this.id,
+ required this.assetId,
+ required this.x1,
+ required this.y1,
+ required this.x2,
+ required this.y2,
+ required this.x3,
+ required this.y3,
+ required this.x4,
+ required this.y4,
+ required this.boxScore,
+ required this.textScore,
+ required this.recognizedText,
+ required this.isVisible,
+ });
+ @override
+ Map<String, i0.Expression> toColumns(bool nullToAbsent) {
+ final map = <String, i0.Expression>{};
+ map['id'] = i0.Variable<String>(id);
+ map['asset_id'] = i0.Variable<String>(assetId);
+ map['x1'] = i0.Variable<double>(x1);
+ map['y1'] = i0.Variable<double>(y1);
+ map['x2'] = i0.Variable<double>(x2);
+ map['y2'] = i0.Variable<double>(y2);
+ map['x3'] = i0.Variable<double>(x3);
+ map['y3'] = i0.Variable<double>(y3);
+ map['x4'] = i0.Variable<double>(x4);
+ map['y4'] = i0.Variable<double>(y4);
+ map['box_score'] = i0.Variable<double>(boxScore);
+ map['text_score'] = i0.Variable<double>(textScore);
+ map['recognized_text'] = i0.Variable<String>(recognizedText);
+ map['is_visible'] = i0.Variable<bool>(isVisible);
+ return map;
+ }
+
+ factory AssetOcrEntityData.fromJson(
+ Map<String, dynamic> json, {
+ i0.ValueSerializer? serializer,
+ }) {
+ serializer ??= i0.driftRuntimeOptions.defaultSerializer;
+ return AssetOcrEntityData(
+ id: serializer.fromJson<String>(json['id']),
+ assetId: serializer.fromJson<String>(json['assetId']),
+ x1: serializer.fromJson<double>(json['x1']),
+ y1: serializer.fromJson<double>(json['y1']),
+ x2: serializer.fromJson<double>(json['x2']),
+ y2: serializer.fromJson<double>(json['y2']),
+ x3: serializer.fromJson<double>(json['x3']),
+ y3: serializer.fromJson<double>(json['y3']),
+ x4: serializer.fromJson<double>(json['x4']),
+ y4: serializer.fromJson<double>(json['y4']),
+ boxScore: serializer.fromJson<double>(json['boxScore']),
+ textScore: serializer.fromJson<double>(json['textScore']),
+ recognizedText: serializer.fromJson<String>(json['recognizedText']),
+ isVisible: serializer.fromJson<bool>(json['isVisible']),
+ );
+ }
+ @override
+ Map<String, dynamic> toJson({i0.ValueSerializer? serializer}) {
+ serializer ??= i0.driftRuntimeOptions.defaultSerializer;
+ return <String, dynamic>{
+ 'id': serializer.toJson<String>(id),
+ 'assetId': serializer.toJson<String>(assetId),
+ 'x1': serializer.toJson<double>(x1),
+ 'y1': serializer.toJson<double>(y1),
+ 'x2': serializer.toJson<double>(x2),
+ 'y2': serializer.toJson<double>(y2),
+ 'x3': serializer.toJson<double>(x3),
+ 'y3': serializer.toJson<double>(y3),
+ 'x4': serializer.toJson<double>(x4),
+ 'y4': serializer.toJson<double>(y4),
+ 'boxScore': serializer.toJson<double>(boxScore),
+ 'textScore': serializer.toJson<double>(textScore),
+ 'recognizedText': serializer.toJson<String>(recognizedText),
+ 'isVisible': serializer.toJson<bool>(isVisible),
+ };
+ }
+
+ i1.AssetOcrEntityData copyWith({
+ String? id,
+ String? assetId,
+ double? x1,
+ double? y1,
+ double? x2,
+ double? y2,
+ double? x3,
+ double? y3,
+ double? x4,
+ double? y4,
+ double? boxScore,
+ double? textScore,
+ String? recognizedText,
+ bool? isVisible,
+ }) => i1.AssetOcrEntityData(
+ id: id ?? this.id,
+ assetId: assetId ?? this.assetId,
+ x1: x1 ?? this.x1,
+ y1: y1 ?? this.y1,
+ x2: x2 ?? this.x2,
+ y2: y2 ?? this.y2,
+ x3: x3 ?? this.x3,
+ y3: y3 ?? this.y3,
+ x4: x4 ?? this.x4,
+ y4: y4 ?? this.y4,
+ boxScore: boxScore ?? this.boxScore,
+ textScore: textScore ?? this.textScore,
+ recognizedText: recognizedText ?? this.recognizedText,
+ isVisible: isVisible ?? this.isVisible,
+ );
+ AssetOcrEntityData copyWithCompanion(i1.AssetOcrEntityCompanion data) {
+ return AssetOcrEntityData(
+ id: data.id.present ? data.id.value : this.id,
+ assetId: data.assetId.present ? data.assetId.value : this.assetId,
+ x1: data.x1.present ? data.x1.value : this.x1,
+ y1: data.y1.present ? data.y1.value : this.y1,
+ x2: data.x2.present ? data.x2.value : this.x2,
+ y2: data.y2.present ? data.y2.value : this.y2,
+ x3: data.x3.present ? data.x3.value : this.x3,
+ y3: data.y3.present ? data.y3.value : this.y3,
+ x4: data.x4.present ? data.x4.value : this.x4,
+ y4: data.y4.present ? data.y4.value : this.y4,
+ boxScore: data.boxScore.present ? data.boxScore.value : this.boxScore,
+ textScore: data.textScore.present ? data.textScore.value : this.textScore,
+ recognizedText: data.recognizedText.present
+ ? data.recognizedText.value
+ : this.recognizedText,
+ isVisible: data.isVisible.present ? data.isVisible.value : this.isVisible,
+ );
+ }
+
+ @override
+ String toString() {
+ return (StringBuffer('AssetOcrEntityData(')
+ ..write('id: $id, ')
+ ..write('assetId: $assetId, ')
+ ..write('x1: $x1, ')
+ ..write('y1: $y1, ')
+ ..write('x2: $x2, ')
+ ..write('y2: $y2, ')
+ ..write('x3: $x3, ')
+ ..write('y3: $y3, ')
+ ..write('x4: $x4, ')
+ ..write('y4: $y4, ')
+ ..write('boxScore: $boxScore, ')
+ ..write('textScore: $textScore, ')
+ ..write('recognizedText: $recognizedText, ')
+ ..write('isVisible: $isVisible')
+ ..write(')'))
+ .toString();
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ id,
+ assetId,
+ x1,
+ y1,
+ x2,
+ y2,
+ x3,
+ y3,
+ x4,
+ y4,
+ boxScore,
+ textScore,
+ recognizedText,
+ isVisible,
+ );
+ @override
+ bool operator ==(Object other) =>
+ identical(this, other) ||
+ (other is i1.AssetOcrEntityData &&
+ other.id == this.id &&
+ other.assetId == this.assetId &&
+ other.x1 == this.x1 &&
+ other.y1 == this.y1 &&
+ other.x2 == this.x2 &&
+ other.y2 == this.y2 &&
+ other.x3 == this.x3 &&
+ other.y3 == this.y3 &&
+ other.x4 == this.x4 &&
+ other.y4 == this.y4 &&
+ other.boxScore == this.boxScore &&
+ other.textScore == this.textScore &&
+ other.recognizedText == this.recognizedText &&
+ other.isVisible == this.isVisible);
+}
+
+class AssetOcrEntityCompanion
+ extends i0.UpdateCompanion<i1.AssetOcrEntityData> {
+ final i0.Value<String> id;
+ final i0.Value<String> assetId;
+ final i0.Value<double> x1;
+ final i0.Value<double> y1;
+ final i0.Value<double> x2;
+ final i0.Value<double> y2;
+ final i0.Value<double> x3;
+ final i0.Value<double> y3;
+ final i0.Value<double> x4;
+ final i0.Value<double> y4;
+ final i0.Value<double> boxScore;
+ final i0.Value<double> textScore;
+ final i0.Value<String> recognizedText;
+ final i0.Value<bool> isVisible;
+ const AssetOcrEntityCompanion({
+ this.id = const i0.Value.absent(),
+ this.assetId = const i0.Value.absent(),
+ this.x1 = const i0.Value.absent(),
+ this.y1 = const i0.Value.absent(),
+ this.x2 = const i0.Value.absent(),
+ this.y2 = const i0.Value.absent(),
+ this.x3 = const i0.Value.absent(),
+ this.y3 = const i0.Value.absent(),
+ this.x4 = const i0.Value.absent(),
+ this.y4 = const i0.Value.absent(),
+ this.boxScore = const i0.Value.absent(),
+ this.textScore = const i0.Value.absent(),
+ this.recognizedText = const i0.Value.absent(),
+ this.isVisible = const i0.Value.absent(),
+ });
+ AssetOcrEntityCompanion.insert({
+ required String id,
+ required String assetId,
+ required double x1,
+ required double y1,
+ required double x2,
+ required double y2,
+ required double x3,
+ required double y3,
+ required double x4,
+ required double y4,
+ required double boxScore,
+ required double textScore,
+ required String recognizedText,
+ this.isVisible = const i0.Value.absent(),
+ }) : id = i0.Value(id),
+ assetId = i0.Value(assetId),
+ x1 = i0.Value(x1),
+ y1 = i0.Value(y1),
+ x2 = i0.Value(x2),
+ y2 = i0.Value(y2),
+ x3 = i0.Value(x3),
+ y3 = i0.Value(y3),
+ x4 = i0.Value(x4),
+ y4 = i0.Value(y4),
+ boxScore = i0.Value(boxScore),
+ textScore = i0.Value(textScore),
+ recognizedText = i0.Value(recognizedText);
+ static i0.Insertable<i1.AssetOcrEntityData> custom({
+ i0.Expression<String>? id,
+ i0.Expression<String>? assetId,
+ i0.Expression<double>? x1,
+ i0.Expression<double>? y1,
+ i0.Expression<double>? x2,
+ i0.Expression<double>? y2,
+ i0.Expression<double>? x3,
+ i0.Expression<double>? y3,
+ i0.Expression<double>? x4,
+ i0.Expression<double>? y4,
+ i0.Expression<double>? boxScore,
+ i0.Expression<double>? textScore,
+ i0.Expression<String>? recognizedText,
+ i0.Expression<bool>? isVisible,
+ }) {
+ return i0.RawValuesInsertable({
+ if (id != null) 'id': id,
+ if (assetId != null) 'asset_id': assetId,
+ if (x1 != null) 'x1': x1,
+ if (y1 != null) 'y1': y1,
+ if (x2 != null) 'x2': x2,
+ if (y2 != null) 'y2': y2,
+ if (x3 != null) 'x3': x3,
+ if (y3 != null) 'y3': y3,
+ if (x4 != null) 'x4': x4,
+ if (y4 != null) 'y4': y4,
+ if (boxScore != null) 'box_score': boxScore,
+ if (textScore != null) 'text_score': textScore,
+ if (recognizedText != null) 'recognized_text': recognizedText,
+ if (isVisible != null) 'is_visible': isVisible,
+ });
+ }
+
+ i1.AssetOcrEntityCompanion copyWith({
+ i0.Value<String>? id,
+ i0.Value<String>? assetId,
+ i0.Value<double>? x1,
+ i0.Value<double>? y1,
+ i0.Value<double>? x2,
+ i0.Value<double>? y2,
+ i0.Value<double>? x3,
+ i0.Value<double>? y3,
+ i0.Value<double>? x4,
+ i0.Value<double>? y4,
+ i0.Value<double>? boxScore,
+ i0.Value<double>? textScore,
+ i0.Value<String>? recognizedText,
+ i0.Value<bool>? isVisible,
+ }) {
+ return i1.AssetOcrEntityCompanion(
+ id: id ?? this.id,
+ assetId: assetId ?? this.assetId,
+ x1: x1 ?? this.x1,
+ y1: y1 ?? this.y1,
+ x2: x2 ?? this.x2,
+ y2: y2 ?? this.y2,
+ x3: x3 ?? this.x3,
+ y3: y3 ?? this.y3,
+ x4: x4 ?? this.x4,
+ y4: y4 ?? this.y4,
+ boxScore: boxScore ?? this.boxScore,
+ textScore: textScore ?? this.textScore,
+ recognizedText: recognizedText ?? this.recognizedText,
+ isVisible: isVisible ?? this.isVisible,
+ );
+ }
+
+ @override
+ Map<String, i0.Expression> toColumns(bool nullToAbsent) {
+ final map = <String, i0.Expression>{};
+ if (id.present) {
+ map['id'] = i0.Variable<String>(id.value);
+ }
+ if (assetId.present) {
+ map['asset_id'] = i0.Variable<String>(assetId.value);
+ }
+ if (x1.present) {
+ map['x1'] = i0.Variable<double>(x1.value);
+ }
+ if (y1.present) {
+ map['y1'] = i0.Variable<double>(y1.value);
+ }
+ if (x2.present) {
+ map['x2'] = i0.Variable<double>(x2.value);
+ }
+ if (y2.present) {
+ map['y2'] = i0.Variable<double>(y2.value);
+ }
+ if (x3.present) {
+ map['x3'] = i0.Variable<double>(x3.value);
+ }
+ if (y3.present) {
+ map['y3'] = i0.Variable<double>(y3.value);
+ }
+ if (x4.present) {
+ map['x4'] = i0.Variable<double>(x4.value);
+ }
+ if (y4.present) {
+ map['y4'] = i0.Variable<double>(y4.value);
+ }
+ if (boxScore.present) {
+ map['box_score'] = i0.Variable<double>(boxScore.value);
+ }
+ if (textScore.present) {
+ map['text_score'] = i0.Variable<double>(textScore.value);
+ }
+ if (recognizedText.present) {
+ map['recognized_text'] = i0.Variable<String>(recognizedText.value);
+ }
+ if (isVisible.present) {
+ map['is_visible'] = i0.Variable<bool>(isVisible.value);
+ }
+ return map;
+ }
+
+ @override
+ String toString() {
+ return (StringBuffer('AssetOcrEntityCompanion(')
+ ..write('id: $id, ')
+ ..write('assetId: $assetId, ')
+ ..write('x1: $x1, ')
+ ..write('y1: $y1, ')
+ ..write('x2: $x2, ')
+ ..write('y2: $y2, ')
+ ..write('x3: $x3, ')
+ ..write('y3: $y3, ')
+ ..write('x4: $x4, ')
+ ..write('y4: $y4, ')
+ ..write('boxScore: $boxScore, ')
+ ..write('textScore: $textScore, ')
+ ..write('recognizedText: $recognizedText, ')
+ ..write('isVisible: $isVisible')
+ ..write(')'))
+ .toString();
+ }
+}
diff --git a/mobile/lib/infrastructure/repositories/db.repository.dart b/mobile/lib/infrastructure/repositories/db.repository.dart
index 2499a08a36..b6089b3cb2 100644
--- a/mobile/lib/infrastructure/repositories/db.repository.dart
+++ b/mobile/lib/infrastructure/repositories/db.repository.dart
@@ -6,6 +6,7 @@ import 'package:drift_sqlite_async/drift_sqlite_async.dart';
import 'package:flutter/foundation.dart';
import 'package:immich_mobile/infrastructure/entities/asset_edit.entity.dart';
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.dart';
+import 'package:immich_mobile/infrastructure/entities/asset_ocr.entity.dart';
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.dart';
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart';
import 'package:immich_mobile/infrastructure/entities/local_album.entity.dart';
@@ -62,6 +63,7 @@ import 'package:sqlite_async/sqlite_async.dart';
TrashedLocalAssetEntity,
AssetEditEntity,
SettingsEntity,
+ AssetOcrEntity,
],
include: {'package:immich_mobile/infrastructure/entities/merged_asset.drift'},
)
@@ -105,7 +107,7 @@ class Drift extends $Drift {
}
@override
- int get schemaVersion => 28;
+ int get schemaVersion => 29;
@override
MigrationStrategy get migration => MigrationStrategy(
@@ -289,6 +291,10 @@ class Drift extends $Drift {
from27To28: (m, v28) async {
await m.createIndex(v28.idxLocalAssetCreatedAt);
},
+ from28To29: (m, v29) async {
+ await m.createTable(v29.assetOcrEntity);
+ await m.createIndex(v29.idxAssetOcrAssetId);
+ },
),
);
diff --git a/mobile/lib/infrastructure/repositories/db.repository.drift.dart b/mobile/lib/infrastructure/repositories/db.repository.drift.dart
index 3a913dda97..887daea723 100644
--- a/mobile/lib/infrastructure/repositories/db.repository.drift.dart
+++ b/mobile/lib/infrastructure/repositories/db.repository.drift.dart
@@ -45,9 +45,11 @@ import 'package:immich_mobile/infrastructure/entities/asset_edit.entity.drift.da
as i21;
import 'package:immich_mobile/infrastructure/entities/settings.entity.drift.dart'
as i22;
-import 'package:immich_mobile/infrastructure/entities/merged_asset.drift.dart'
+import 'package:immich_mobile/infrastructure/entities/asset_ocr.entity.drift.dart'
as i23;
-import 'package:drift/internal/modular.dart' as i24;
+import 'package:immich_mobile/infrastructure/entities/merged_asset.drift.dart'
+ as i24;
+import 'package:drift/internal/modular.dart' as i25;
abstract class $Drift extends i0.GeneratedDatabase {
$Drift(i0.QueryExecutor e) : super(e);
@@ -94,9 +96,12 @@ abstract class $Drift extends i0.GeneratedDatabase {
late final i22.$SettingsEntityTable settingsEntity = i22.$SettingsEntityTable(
this,
);
- i23.MergedAssetDrift get mergedAssetDrift => i24.ReadDatabaseContainer(
+ late final i23.$AssetOcrEntityTable assetOcrEntity = i23.$AssetOcrEntityTable(
this,
- ).accessor<i23.MergedAssetDrift>(i23.MergedAssetDrift.new);
+ );
+ i24.MergedAssetDrift get mergedAssetDrift => i25.ReadDatabaseContainer(
+ this,
+ ).accessor<i24.MergedAssetDrift>(i24.MergedAssetDrift.new);
@override
Iterable<i0.TableInfo<i0.Table, Object?>> get allTables =>
allSchemaEntities.whereType<i0.TableInfo<i0.Table, Object?>>();
@@ -134,6 +139,7 @@ abstract class $Drift extends i0.GeneratedDatabase {
trashedLocalAssetEntity,
assetEditEntity,
settingsEntity,
+ assetOcrEntity,
i10.idxPartnerSharedWithId,
i11.idxLatLng,
i11.idxRemoteExifCity,
@@ -146,6 +152,7 @@ abstract class $Drift extends i0.GeneratedDatabase {
i20.idxTrashedLocalAssetChecksum,
i20.idxTrashedLocalAssetAlbum,
i21.idxAssetEditAssetId,
+ i23.idxAssetOcrAssetId,
];
@override
i0.StreamQueryUpdateRules
@@ -335,6 +342,13 @@ abstract class $Drift extends i0.GeneratedDatabase {
),
result: [i0.TableUpdate('asset_edit_entity', kind: i0.UpdateKind.delete)],
),
+ i0.WritePropagation(
+ on: i0.TableUpdateQuery.onTableName(
+ 'remote_asset_entity',
+ limitUpdateKind: i0.UpdateKind.delete,
+ ),
+ result: [i0.TableUpdate('asset_ocr_entity', kind: i0.UpdateKind.delete)],
+ ),
]);
@override
i0.DriftDatabaseOptions get options =>
@@ -398,4 +412,6 @@ class $DriftManager {
i21.$$AssetEditEntityTableTableManager(_db, _db.assetEditEntity);
i22.$$SettingsEntityTableTableManager get settingsEntity =>
i22.$$SettingsEntityTableTableManager(_db, _db.settingsEntity);
+ i23.$$AssetOcrEntityTableTableManager get assetOcrEntity =>
+ i23.$$AssetOcrEntityTableTableManager(_db, _db.assetOcrEntity);
}
diff --git a/mobile/lib/infrastructure/repositories/db.repository.steps.dart b/mobile/lib/infrastructure/repositories/db.repository.steps.dart
index 9f3498df49..72d72d69e9 100644
--- a/mobile/lib/infrastructure/repositories/db.repository.steps.dart
+++ b/mobile/lib/infrastructure/repositories/db.repository.steps.dart
@@ -14631,6 +14631,706 @@ final class Schema28 extends i0.VersionedSchema {
);
}
+final class Schema29 extends i0.VersionedSchema {
+ Schema29({required super.database}) : super(version: 29);
+ @override
+ late final List<i1.DatabaseSchemaEntity> entities = [
+ userEntity,
+ remoteAssetEntity,
+ stackEntity,
+ localAssetEntity,
+ remoteAlbumEntity,
+ localAlbumEntity,
+ localAlbumAssetEntity,
+ idxLocalAlbumAssetAlbumAsset,
+ idxLocalAssetChecksum,
+ idxLocalAssetCloudId,
+ idxLocalAssetCreatedAt,
+ idxStackPrimaryAssetId,
+ uQRemoteAssetsOwnerChecksum,
+ uQRemoteAssetsOwnerLibraryChecksum,
+ idxRemoteAssetChecksum,
+ idxRemoteAssetStackId,
+ idxRemoteAssetOwnerVisibilityDeletedCreated,
+ authUserEntity,
+ userMetadataEntity,
+ partnerEntity,
+ remoteExifEntity,
+ remoteAlbumAssetEntity,
+ remoteAlbumUserEntity,
+ remoteAssetCloudIdEntity,
+ memoryEntity,
+ memoryAssetEntity,
+ personEntity,
+ assetFaceEntity,
+ storeEntity,
+ trashedLocalAssetEntity,
+ assetEditEntity,
+ settings,
+ assetOcrEntity,
+ idxPartnerSharedWithId,
+ idxLatLng,
+ idxRemoteExifCity,
+ idxRemoteAlbumAssetAlbumAsset,
+ idxRemoteAssetCloudId,
+ idxPersonOwnerId,
+ idxAssetFacePersonId,
+ idxAssetFaceAssetId,
+ idxAssetFaceVisiblePerson,
+ idxTrashedLocalAssetChecksum,
+ idxTrashedLocalAssetAlbum,
+ idxAssetEditAssetId,
+ idxAssetOcrAssetId,
+ ];
+ late final Shape33 userEntity = Shape33(
+ source: i0.VersionedTable(
+ entityName: 'user_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(id)'],
+ columns: [
+ _column_107,
+ _column_108,
+ _column_109,
+ _column_110,
+ _column_111,
+ _column_112,
+ ],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape50 remoteAssetEntity = Shape50(
+ source: i0.VersionedTable(
+ entityName: 'remote_asset_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(id)'],
+ columns: [
+ _column_108,
+ _column_113,
+ _column_114,
+ _column_115,
+ _column_116,
+ _column_117,
+ _column_118,
+ _column_107,
+ _column_119,
+ _column_120,
+ _column_121,
+ _column_122,
+ _column_123,
+ _column_124,
+ _column_212,
+ _column_125,
+ _column_126,
+ _column_127,
+ _column_128,
+ _column_129,
+ ],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape35 stackEntity = Shape35(
+ source: i0.VersionedTable(
+ entityName: 'stack_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(id)'],
+ columns: [
+ _column_107,
+ _column_114,
+ _column_115,
+ _column_121,
+ _column_130,
+ ],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape36 localAssetEntity = Shape36(
+ source: i0.VersionedTable(
+ entityName: 'local_asset_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(id)'],
+ columns: [
+ _column_108,
+ _column_113,
+ _column_114,
+ _column_115,
+ _column_116,
+ _column_117,
+ _column_118,
+ _column_107,
+ _column_131,
+ _column_120,
+ _column_132,
+ _column_133,
+ _column_134,
+ _column_135,
+ _column_136,
+ _column_137,
+ ],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape48 remoteAlbumEntity = Shape48(
+ source: i0.VersionedTable(
+ entityName: 'remote_album_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(id)'],
+ columns: [
+ _column_107,
+ _column_108,
+ _column_138,
+ _column_114,
+ _column_115,
+ _column_139,
+ _column_140,
+ _column_141,
+ ],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape38 localAlbumEntity = Shape38(
+ source: i0.VersionedTable(
+ entityName: 'local_album_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(id)'],
+ columns: [
+ _column_107,
+ _column_108,
+ _column_115,
+ _column_142,
+ _column_143,
+ _column_144,
+ _column_145,
+ ],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape39 localAlbumAssetEntity = Shape39(
+ source: i0.VersionedTable(
+ entityName: 'local_album_asset_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(asset_id, album_id)'],
+ columns: [_column_146, _column_147, _column_145],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ final i1.Index idxLocalAlbumAssetAlbumAsset = i1.Index(
+ 'idx_local_album_asset_album_asset',
+ 'CREATE INDEX IF NOT EXISTS idx_local_album_asset_album_asset ON local_album_asset_entity (album_id, asset_id)',
+ );
+ 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 idxLocalAssetCloudId = i1.Index(
+ 'idx_local_asset_cloud_id',
+ 'CREATE INDEX IF NOT EXISTS idx_local_asset_cloud_id ON local_asset_entity (i_cloud_id)',
+ );
+ final i1.Index idxLocalAssetCreatedAt = i1.Index(
+ 'idx_local_asset_created_at',
+ 'CREATE INDEX IF NOT EXISTS idx_local_asset_created_at ON local_asset_entity (created_at)',
+ );
+ final i1.Index idxStackPrimaryAssetId = i1.Index(
+ 'idx_stack_primary_asset_id',
+ 'CREATE INDEX IF NOT EXISTS idx_stack_primary_asset_id ON stack_entity (primary_asset_id)',
+ );
+ 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)',
+ );
+ final i1.Index idxRemoteAssetStackId = i1.Index(
+ 'idx_remote_asset_stack_id',
+ 'CREATE INDEX IF NOT EXISTS idx_remote_asset_stack_id ON remote_asset_entity (stack_id)',
+ );
+ final i1.Index idxRemoteAssetOwnerVisibilityDeletedCreated = i1.Index(
+ 'idx_remote_asset_owner_visibility_deleted_created',
+ 'CREATE INDEX IF NOT EXISTS idx_remote_asset_owner_visibility_deleted_created ON remote_asset_entity (owner_id, visibility, deleted_at, created_at DESC)',
+ );
+ late final Shape40 authUserEntity = Shape40(
+ source: i0.VersionedTable(
+ entityName: 'auth_user_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(id)'],
+ columns: [
+ _column_107,
+ _column_108,
+ _column_109,
+ _column_148,
+ _column_110,
+ _column_111,
+ _column_149,
+ _column_150,
+ _column_151,
+ _column_152,
+ ],
+ 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_153, _column_154, _column_155],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape41 partnerEntity = Shape41(
+ source: i0.VersionedTable(
+ entityName: 'partner_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(shared_by_id, shared_with_id)'],
+ columns: [_column_156, _column_157, _column_158],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape42 remoteExifEntity = Shape42(
+ source: i0.VersionedTable(
+ entityName: 'remote_exif_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(asset_id)'],
+ columns: [
+ _column_159,
+ _column_160,
+ _column_161,
+ _column_162,
+ _column_163,
+ _column_164,
+ _column_117,
+ _column_116,
+ _column_165,
+ _column_166,
+ _column_167,
+ _column_168,
+ _column_135,
+ _column_136,
+ _column_169,
+ _column_170,
+ _column_171,
+ _column_172,
+ _column_173,
+ _column_174,
+ _column_175,
+ _column_176,
+ ],
+ 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_159, _column_177],
+ 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_177, _column_153, _column_178],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape43 remoteAssetCloudIdEntity = Shape43(
+ source: i0.VersionedTable(
+ entityName: 'remote_asset_cloud_id_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(asset_id)'],
+ columns: [
+ _column_159,
+ _column_179,
+ _column_180,
+ _column_134,
+ _column_135,
+ _column_136,
+ ],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape44 memoryEntity = Shape44(
+ source: i0.VersionedTable(
+ entityName: 'memory_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(id)'],
+ columns: [
+ _column_107,
+ _column_114,
+ _column_115,
+ _column_124,
+ _column_121,
+ _column_113,
+ _column_181,
+ _column_182,
+ _column_183,
+ _column_184,
+ _column_185,
+ _column_186,
+ ],
+ 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_159, _column_187],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape45 personEntity = Shape45(
+ source: i0.VersionedTable(
+ entityName: 'person_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(id)'],
+ columns: [
+ _column_107,
+ _column_114,
+ _column_115,
+ _column_121,
+ _column_108,
+ _column_188,
+ _column_189,
+ _column_190,
+ _column_191,
+ _column_192,
+ ],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape46 assetFaceEntity = Shape46(
+ source: i0.VersionedTable(
+ entityName: 'asset_face_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(id)'],
+ columns: [
+ _column_107,
+ _column_159,
+ _column_193,
+ _column_194,
+ _column_195,
+ _column_196,
+ _column_197,
+ _column_198,
+ _column_199,
+ _column_200,
+ _column_201,
+ _column_124,
+ ],
+ 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_202, _column_203, _column_204],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape47 trashedLocalAssetEntity = Shape47(
+ source: i0.VersionedTable(
+ entityName: 'trashed_local_asset_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(id, album_id)'],
+ columns: [
+ _column_108,
+ _column_113,
+ _column_114,
+ _column_115,
+ _column_116,
+ _column_117,
+ _column_118,
+ _column_107,
+ _column_205,
+ _column_131,
+ _column_120,
+ _column_132,
+ _column_206,
+ _column_137,
+ ],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape32 assetEditEntity = Shape32(
+ source: i0.VersionedTable(
+ entityName: 'asset_edit_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(id)'],
+ columns: [
+ _column_107,
+ _column_159,
+ _column_207,
+ _column_208,
+ _column_209,
+ ],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape49 settings = Shape49(
+ source: i0.VersionedTable(
+ entityName: 'settings',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY("key")'],
+ columns: [_column_210, _column_211, _column_115],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ late final Shape51 assetOcrEntity = Shape51(
+ source: i0.VersionedTable(
+ entityName: 'asset_ocr_entity',
+ withoutRowId: true,
+ isStrict: true,
+ tableConstraints: ['PRIMARY KEY(id)'],
+ columns: [
+ _column_107,
+ _column_159,
+ _column_213,
+ _column_214,
+ _column_215,
+ _column_216,
+ _column_217,
+ _column_218,
+ _column_219,
+ _column_220,
+ _column_221,
+ _column_222,
+ _column_223,
+ _column_201,
+ ],
+ attachedDatabase: database,
+ ),
+ alias: null,
+ );
+ final i1.Index idxPartnerSharedWithId = i1.Index(
+ 'idx_partner_shared_with_id',
+ 'CREATE INDEX IF NOT EXISTS idx_partner_shared_with_id ON partner_entity (shared_with_id)',
+ );
+ 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 idxRemoteExifCity = i1.Index(
+ 'idx_remote_exif_city',
+ 'CREATE INDEX IF NOT EXISTS idx_remote_exif_city ON remote_exif_entity (city) WHERE city IS NOT NULL',
+ );
+ final i1.Index idxRemoteAlbumAssetAlbumAsset = i1.Index(
+ 'idx_remote_album_asset_album_asset',
+ 'CREATE INDEX IF NOT EXISTS idx_remote_album_asset_album_asset ON remote_album_asset_entity (album_id, asset_id)',
+ );
+ final i1.Index idxRemoteAssetCloudId = i1.Index(
+ 'idx_remote_asset_cloud_id',
+ 'CREATE INDEX IF NOT EXISTS idx_remote_asset_cloud_id ON remote_asset_cloud_id_entity (cloud_id)',
+ );
+ final i1.Index idxPersonOwnerId = i1.Index(
+ 'idx_person_owner_id',
+ 'CREATE INDEX IF NOT EXISTS idx_person_owner_id ON person_entity (owner_id)',
+ );
+ final i1.Index idxAssetFacePersonId = i1.Index(
+ 'idx_asset_face_person_id',
+ 'CREATE INDEX IF NOT EXISTS idx_asset_face_person_id ON asset_face_entity (person_id)',
+ );
+ final i1.Index idxAssetFaceAssetId = i1.Index(
+ 'idx_asset_face_asset_id',
+ 'CREATE INDEX IF NOT EXISTS idx_asset_face_asset_id ON asset_face_entity (asset_id)',
+ );
+ final i1.Index idxAssetFaceVisiblePerson = i1.Index(
+ 'idx_asset_face_visible_person',
+ 'CREATE INDEX IF NOT EXISTS idx_asset_face_visible_person ON asset_face_entity (person_id, asset_id) WHERE is_visible = 1 AND deleted_at IS NULL',
+ );
+ 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)',
+ );
+ final i1.Index idxAssetEditAssetId = i1.Index(
+ 'idx_asset_edit_asset_id',
+ 'CREATE INDEX IF NOT EXISTS idx_asset_edit_asset_id ON asset_edit_entity (asset_id)',
+ );
+ final i1.Index idxAssetOcrAssetId = i1.Index(
+ 'idx_asset_ocr_asset_id',
+ 'CREATE INDEX IF NOT EXISTS idx_asset_ocr_asset_id ON asset_ocr_entity (asset_id)',
+ );
+}
+
+class Shape51 extends i0.VersionedTable {
+ Shape51({required super.source, required super.alias}) : super.aliased();
+ i1.GeneratedColumn<String> get id =>
+ columnsByName['id']! as i1.GeneratedColumn<String>;
+ i1.GeneratedColumn<String> get assetId =>
+ columnsByName['asset_id']! as i1.GeneratedColumn<String>;
+ i1.GeneratedColumn<double> get x1 =>
+ columnsByName['x1']! as i1.GeneratedColumn<double>;
+ i1.GeneratedColumn<double> get y1 =>
+ columnsByName['y1']! as i1.GeneratedColumn<double>;
+ i1.GeneratedColumn<double> get x2 =>
+ columnsByName['x2']! as i1.GeneratedColumn<double>;
+ i1.GeneratedColumn<double> get y2 =>
+ columnsByName['y2']! as i1.GeneratedColumn<double>;
+ i1.GeneratedColumn<double> get x3 =>
+ columnsByName['x3']! as i1.GeneratedColumn<double>;
+ i1.GeneratedColumn<double> get y3 =>
+ columnsByName['y3']! as i1.GeneratedColumn<double>;
+ i1.GeneratedColumn<double> get x4 =>
+ columnsByName['x4']! as i1.GeneratedColumn<double>;
+ i1.GeneratedColumn<double> get y4 =>
+ columnsByName['y4']! as i1.GeneratedColumn<double>;
+ i1.GeneratedColumn<double> get boxScore =>
+ columnsByName['box_score']! as i1.GeneratedColumn<double>;
+ i1.GeneratedColumn<double> get textScore =>
+ columnsByName['text_score']! as i1.GeneratedColumn<double>;
+ i1.GeneratedColumn<String> get recognizedText =>
+ columnsByName['recognized_text']! as i1.GeneratedColumn<String>;
+ i1.GeneratedColumn<int> get isVisible =>
+ columnsByName['is_visible']! as i1.GeneratedColumn<int>;
+}
+
+i1.GeneratedColumn<double> _column_213(String aliasedName) =>
+ i1.GeneratedColumn<double>(
+ 'x1',
+ aliasedName,
+ false,
+ type: i1.DriftSqlType.double,
+ $customConstraints: 'NOT NULL',
+ );
+i1.GeneratedColumn<double> _column_214(String aliasedName) =>
+ i1.GeneratedColumn<double>(
+ 'y1',
+ aliasedName,
+ false,
+ type: i1.DriftSqlType.double,
+ $customConstraints: 'NOT NULL',
+ );
+i1.GeneratedColumn<double> _column_215(String aliasedName) =>
+ i1.GeneratedColumn<double>(
+ 'x2',
+ aliasedName,
+ false,
+ type: i1.DriftSqlType.double,
+ $customConstraints: 'NOT NULL',
+ );
+i1.GeneratedColumn<double> _column_216(String aliasedName) =>
+ i1.GeneratedColumn<double>(
+ 'y2',
+ aliasedName,
+ false,
+ type: i1.DriftSqlType.double,
+ $customConstraints: 'NOT NULL',
+ );
+i1.GeneratedColumn<double> _column_217(String aliasedName) =>
+ i1.GeneratedColumn<double>(
+ 'x3',
+ aliasedName,
+ false,
+ type: i1.DriftSqlType.double,
+ $customConstraints: 'NOT NULL',
+ );
+i1.GeneratedColumn<double> _column_218(String aliasedName) =>
+ i1.GeneratedColumn<double>(
+ 'y3',
+ aliasedName,
+ false,
+ type: i1.DriftSqlType.double,
+ $customConstraints: 'NOT NULL',
+ );
+i1.GeneratedColumn<double> _column_219(String aliasedName) =>
+ i1.GeneratedColumn<double>(
+ 'x4',
+ aliasedName,
+ false,
+ type: i1.DriftSqlType.double,
+ $customConstraints: 'NOT NULL',
+ );
+i1.GeneratedColumn<double> _column_220(String aliasedName) =>
+ i1.GeneratedColumn<double>(
+ 'y4',
+ aliasedName,
+ false,
+ type: i1.DriftSqlType.double,
+ $customConstraints: 'NOT NULL',
+ );
+i1.GeneratedColumn<double> _column_221(String aliasedName) =>
+ i1.GeneratedColumn<double>(
+ 'box_score',
+ aliasedName,
+ false,
+ type: i1.DriftSqlType.double,
+ $customConstraints: 'NOT NULL',
+ );
+i1.GeneratedColumn<double> _column_222(String aliasedName) =>
+ i1.GeneratedColumn<double>(
+ 'text_score',
+ aliasedName,
+ false,
+ type: i1.DriftSqlType.double,
+ $customConstraints: 'NOT NULL',
+ );
+i1.GeneratedColumn<String> _column_223(String aliasedName) =>
+ i1.GeneratedColumn<String>(
+ 'recognized_text',
+ aliasedName,
+ false,
+ type: i1.DriftSqlType.string,
+ $customConstraints: 'NOT NULL',
+ );
i0.MigrationStepWithVersion migrationSteps({
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
@@ -14659,6 +15359,7 @@ i0.MigrationStepWithVersion migrationSteps({
required Future<void> Function(i1.Migrator m, Schema26 schema) from25To26,
required Future<void> Function(i1.Migrator m, Schema27 schema) from26To27,
required Future<void> Function(i1.Migrator m, Schema28 schema) from27To28,
+ required Future<void> Function(i1.Migrator m, Schema29 schema) from28To29,
}) {
return (currentVersion, database) async {
switch (currentVersion) {
@@ -14797,6 +15498,11 @@ i0.MigrationStepWithVersion migrationSteps({
final migrator = i1.Migrator(database, schema);
await from27To28(migrator, schema);
return 28;
+ case 28:
+ final schema = Schema29(database: database);
+ final migrator = i1.Migrator(database, schema);
+ await from28To29(migrator, schema);
+ return 29;
default:
throw ArgumentError.value('Unknown migration from $currentVersion');
}
@@ -14831,6 +15537,7 @@ i1.OnUpgrade stepByStep({
required Future<void> Function(i1.Migrator m, Schema26 schema) from25To26,
required Future<void> Function(i1.Migrator m, Schema27 schema) from26To27,
required Future<void> Function(i1.Migrator m, Schema28 schema) from27To28,
+ required Future<void> Function(i1.Migrator m, Schema29 schema) from28To29,
}) => i0.VersionedSchema.stepByStepHelper(
step: migrationSteps(
from1To2: from1To2,
@@ -14860,5 +15567,6 @@ i1.OnUpgrade stepByStep({
from25To26: from25To26,
from26To27: from26To27,
from27To28: from27To28,
+ from28To29: from28To29,
),
);
diff --git a/mobile/lib/infrastructure/repositories/ocr.repository.dart b/mobile/lib/infrastructure/repositories/ocr.repository.dart
new file mode 100644
index 0000000000..99f4fa4675
--- /dev/null
+++ b/mobile/lib/infrastructure/repositories/ocr.repository.dart
@@ -0,0 +1,38 @@
+import 'package:immich_mobile/domain/models/ocr.model.dart';
+import 'package:immich_mobile/infrastructure/entities/asset_ocr.entity.drift.dart';
+import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
+import 'package:drift/drift.dart';
+
+class OcrRepository extends DriftDatabaseRepository {
+ final Drift _db;
+ const OcrRepository(this._db) : super(_db);
+
+ Future<List<Ocr>> get(String assetId) async {
+ final query = _db.select(_db.assetOcrEntity)
+ ..where((row) => row.assetId.equals(assetId) & row.isVisible.equals(true));
+
+ final result = await query.get();
+ return result.map((e) => e.toDto()).toList();
+ }
+}
+
+extension on AssetOcrEntityData {
+ Ocr toDto() {
+ return Ocr(
+ id: id,
+ assetId: assetId,
+ x1: x1,
+ y1: y1,
+ x2: x2,
+ y2: y2,
+ x3: x3,
+ y3: y3,
+ x4: x4,
+ y4: y4,
+ boxScore: boxScore,
+ textScore: textScore,
+ text: recognizedText,
+ isVisible: isVisible,
+ );
+ }
+}
diff --git a/mobile/lib/infrastructure/repositories/sync_api.repository.dart b/mobile/lib/infrastructure/repositories/sync_api.repository.dart
index 65214f3846..e9d57f7506 100644
--- a/mobile/lib/infrastructure/repositories/sync_api.repository.dart
+++ b/mobile/lib/infrastructure/repositories/sync_api.repository.dart
@@ -74,6 +74,7 @@ class SyncApiRepository {
serverVersion >= const SemVer(major: 2, minor: 6, patch: 0)
? SyncRequestType.assetFacesV2
: SyncRequestType.assetFacesV1,
+ if (serverVersion >= const SemVer(major: 3, minor: 0, patch: 0)) SyncRequestType.assetOcrV1,
],
).toJson(),
);
@@ -204,6 +205,8 @@ const _kResponseMap = <SyncEntityType, Function(Object)>{
SyncEntityType.assetFaceV1: SyncAssetFaceV1.fromJson,
SyncEntityType.assetFaceV2: SyncAssetFaceV2.fromJson,
SyncEntityType.assetFaceDeleteV1: SyncAssetFaceDeleteV1.fromJson,
+ SyncEntityType.assetOcrV1: SyncAssetOcrV1.fromJson,
+ SyncEntityType.assetOcrDeleteV1: SyncAssetOcrDeleteV1.fromJson,
SyncEntityType.syncCompleteV1: _SyncEmptyDto.fromJson,
};
diff --git a/mobile/lib/infrastructure/repositories/sync_stream.repository.dart b/mobile/lib/infrastructure/repositories/sync_stream.repository.dart
index bd672171bc..8de76f1412 100644
--- a/mobile/lib/infrastructure/repositories/sync_stream.repository.dart
+++ b/mobile/lib/infrastructure/repositories/sync_stream.repository.dart
@@ -12,6 +12,7 @@ import 'package:immich_mobile/domain/models/user_metadata.model.dart';
import 'package:immich_mobile/extensions/string_extensions.dart';
import 'package:immich_mobile/infrastructure/entities/asset_edit.entity.drift.dart';
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.drift.dart';
+import 'package:immich_mobile/infrastructure/entities/asset_ocr.entity.drift.dart';
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.drift.dart';
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart';
import 'package:immich_mobile/infrastructure/entities/local_album.entity.drift.dart';
@@ -69,6 +70,7 @@ class SyncStreamRepository extends DriftDatabaseRepository {
await _db.userMetadataEntity.deleteAll();
await _db.remoteAssetCloudIdEntity.deleteAll();
await _db.assetEditEntity.deleteAll();
+ await _db.assetOcrEntity.deleteAll();
});
} finally {
// re-enable FK even if the transaction throws, otherwise the connection
@@ -848,6 +850,52 @@ class SyncStreamRepository extends DriftDatabaseRepository {
}
}
+ Future<void> updateAssetOcrV1(Iterable<SyncAssetOcrV1> data) async {
+ try {
+ await _db.batch((batch) {
+ for (final assetOcr in data) {
+ final companion = AssetOcrEntityCompanion(
+ assetId: Value(assetOcr.assetId),
+ recognizedText: Value(assetOcr.text),
+ x1: Value(assetOcr.x1),
+ y1: Value(assetOcr.y1),
+ x2: Value(assetOcr.x2),
+ y2: Value(assetOcr.y2),
+ x3: Value(assetOcr.x3),
+ y3: Value(assetOcr.y3),
+ x4: Value(assetOcr.x4),
+ y4: Value(assetOcr.y4),
+ boxScore: Value(assetOcr.boxScore),
+ textScore: Value(assetOcr.textScore),
+ isVisible: Value(assetOcr.isVisible),
+ );
+
+ batch.insert(
+ _db.assetOcrEntity,
+ companion.copyWith(id: Value(assetOcr.id)),
+ onConflict: DoUpdate((_) => companion),
+ );
+ }
+ });
+ } catch (error, stack) {
+ _logger.severe('Error: updateAssetOcrV1', error, stack);
+ rethrow;
+ }
+ }
+
+ Future<void> deleteAssetOcrV1(Iterable<SyncAssetOcrDeleteV1> data) async {
+ try {
+ await _db.batch((batch) {
+ for (final assetOcr in data) {
+ batch.deleteWhere(_db.assetOcrEntity, (row) => row.id.equals(assetOcr.id));
+ }
+ });
+ } catch (error, stack) {
+ _logger.severe('Error: deleteAssetOcrV1', error, stack);
+ rethrow;
+ }
+ }
+
Future<void> pruneAssets() async {
try {
await _db.transaction(() async {
diff --git a/mobile/lib/presentation/widgets/asset_viewer/asset_page.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/asset_page.widget.dart
index fdedd15a0f..5e60d754fd 100644
--- a/mobile/lib/presentation/widgets/asset_viewer/asset_page.widget.dart
+++ b/mobile/lib/presentation/widgets/asset_viewer/asset_page.widget.dart
@@ -14,6 +14,7 @@ import 'package:immich_mobile/extensions/scroll_extensions.dart';
import 'package:immich_mobile/presentation/widgets/asset_viewer/asset_details.widget.dart';
import 'package:immich_mobile/presentation/widgets/asset_viewer/asset_stack.provider.dart';
import 'package:immich_mobile/presentation/widgets/asset_viewer/asset_stack.widget.dart';
+import 'package:immich_mobile/presentation/widgets/asset_viewer/ocr_overlay.widget.dart';
import 'package:immich_mobile/presentation/widgets/asset_viewer/video_viewer.widget.dart';
import 'package:immich_mobile/presentation/widgets/images/image_provider.dart';
import 'package:immich_mobile/presentation/widgets/images/thumbnail.widget.dart';
@@ -394,6 +395,7 @@ class _AssetPageState extends ConsumerState<AssetPage> {
final stackIndex = ref.watch(assetViewerProvider.select((s) => s.stackIndex));
final isPlayingMotionVideo = ref.watch(isPlayingMotionVideoProvider);
final timelineOrigin = ref.read(timelineServiceProvider).origin;
+ final showingOcr = ref.watch(assetViewerProvider.select((s) => s.showingOcr));
final asset = _asset;
if (asset == null) {
@@ -446,6 +448,15 @@ class _AssetPageState extends ConsumerState<AssetPage> {
localFilePath: viewIntentFilePath,
),
),
+ if (showingOcr && displayAsset.width != null && displayAsset.height != null)
+ Positioned.fill(
+ child: OcrOverlay(
+ asset: displayAsset,
+ imageSize: Size(displayAsset.width!.toDouble(), displayAsset.height!.toDouble()),
+ viewportSize: Size(viewportWidth, viewportHeight),
+ controller: _viewController,
+ ),
+ ),
IgnorePointer(
ignoring: !_showingDetails,
child: Column(
diff --git a/mobile/lib/presentation/widgets/asset_viewer/ocr_overlay.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/ocr_overlay.widget.dart
new file mode 100644
index 0000000000..86941a4550
--- /dev/null
+++ b/mobile/lib/presentation/widgets/asset_viewer/ocr_overlay.widget.dart
@@ -0,0 +1,343 @@
+import 'dart:async';
+import 'dart:math' as math;
+
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
+import 'package:immich_mobile/domain/models/ocr.model.dart';
+import 'package:immich_mobile/extensions/build_context_extensions.dart';
+import 'package:immich_mobile/providers/infrastructure/ocr.provider.dart';
+import 'package:immich_mobile/widgets/photo_view/photo_view.dart';
+
+class OcrOverlay extends ConsumerStatefulWidget {
+ final BaseAsset asset;
+ final Size imageSize;
+ final Size viewportSize;
+ final PhotoViewControllerBase? controller;
+
+ const OcrOverlay({
+ super.key,
+ required this.asset,
+ required this.imageSize,
+ required this.viewportSize,
+ this.controller,
+ });
+
+ @override
+ ConsumerState<OcrOverlay> createState() => _OcrOverlayState();
+}
+
+class _OcrOverlayState extends ConsumerState<OcrOverlay> {
+ int? _selectedBoxIndex;
+
+ // Current transform read from the PhotoView controller.
+ // Null until the controller has emitted at least one real event or until
+ // we can seed a reliable value from controller.value on init.
+ PhotoViewControllerValue? _controllerValue;
+ StreamSubscription<PhotoViewControllerValue>? _controllerSub;
+
+ @override
+ void initState() {
+ super.initState();
+ _attachController(widget.controller);
+ }
+
+ @override
+ void didUpdateWidget(OcrOverlay oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ if (oldWidget.controller != widget.controller) {
+ _detachController();
+ _attachController(widget.controller);
+ }
+ }
+
+ @override
+ void dispose() {
+ _detachController();
+ super.dispose();
+ }
+
+ void _attachController(PhotoViewControllerBase? controller) {
+ if (controller == null) {
+ return;
+ }
+
+ // Seed with the current value only when scaleBoundaries is already set.
+ // Before the image finishes loading, PhotoView uses childSize = outerSize
+ // (viewport) as a placeholder, which sets scale = 1.0. That placeholder
+ // is wrong for any image that doesn't exactly fill the viewport.
+ // Once scaleBoundaries is set the value is trustworthy (the image has rendered
+ // at least one frame and setScaleInvisibly has been called with the real
+ // initial/zoomed scale).
+ if (controller.scaleBoundaries != null) {
+ _controllerValue = controller.value;
+ }
+
+ _controllerSub = controller.outputStateStream.listen((value) {
+ if (mounted) {
+ setState(() => _controllerValue = value);
+ }
+ });
+ }
+
+ void _detachController() {
+ _controllerSub?.cancel();
+ _controllerSub = null;
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ if (widget.asset is! RemoteAsset) {
+ return const SizedBox.shrink();
+ }
+
+ final ocrData = ref.watch(ocrAssetProvider((widget.asset as RemoteAsset).id));
+
+ return ocrData.when(
+ data: (data) {
+ if (data == null || data.isEmpty) {
+ return const SizedBox.shrink();
+ }
+ return _OcrBoxes(
+ ocrData: data,
+ controller: widget.controller,
+ imageSize: widget.imageSize,
+ viewportSize: widget.viewportSize,
+ controllerValue: _controllerValue,
+ selectedBoxIndex: _selectedBoxIndex,
+ onSelectionChanged: (index) => setState(() => _selectedBoxIndex = index),
+ );
+ },
+ loading: () => const SizedBox.shrink(),
+ error: (_, __) => const SizedBox.shrink(),
+ );
+ }
+}
+
+class _OcrBoxes extends StatelessWidget {
+ final List<Ocr> ocrData;
+ final PhotoViewControllerBase? controller;
+ final Size imageSize;
+ final Size viewportSize;
+ final PhotoViewControllerValue? controllerValue;
+ final int? selectedBoxIndex;
+ final ValueChanged<int?> onSelectionChanged;
+
+ const _OcrBoxes({
+ required this.ocrData,
+ required this.controller,
+ required this.imageSize,
+ required this.viewportSize,
+ required this.controllerValue,
+ required this.selectedBoxIndex,
+ required this.onSelectionChanged,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ // Use the actual decoded image size from PhotoView's scaleBoundaries when
+ // available. The image provider may serve a downscaled preview (e.g. Immich
+ // serves a ~1440px preview for large originals), so the decoded dimensions
+ // can differ significantly from the stored asset dimensions. Using the wrong
+ // size would scale every coordinate by the ratio between the two resolutions.
+ final resolvedImageSize = controller?.scaleBoundaries?.childSize ?? imageSize;
+
+ final scale =
+ controllerValue?.scale ??
+ math.min(viewportSize.width / resolvedImageSize.width, viewportSize.height / resolvedImageSize.height);
+ final position = controllerValue?.position ?? Offset.zero;
+
+ final imageWidth = resolvedImageSize.width;
+ final imageHeight = resolvedImageSize.height;
+ final viewportWidth = viewportSize.width;
+ final viewportHeight = viewportSize.height;
+
+ // Image center in viewport space, accounting for pan
+ final cx = viewportWidth / 2 + position.dx;
+ final cy = viewportHeight / 2 + position.dy;
+
+ return GestureDetector(
+ behavior: HitTestBehavior.translucent,
+ onTap: () => onSelectionChanged(null),
+ child: ClipRect(
+ child: Stack(
+ children: [
+ // Fills the viewport so taps outside boxes deselect
+ SizedBox(width: viewportWidth, height: viewportHeight),
+ ...ocrData.asMap().entries.map((entry) {
+ final index = entry.key;
+ final ocr = entry.value;
+
+ // Map normalized image coords (0–1) to viewport space
+ final x1 = cx + (ocr.x1 - 0.5) * imageWidth * scale;
+ final y1 = cy + (ocr.y1 - 0.5) * imageHeight * scale;
+ final x2 = cx + (ocr.x2 - 0.5) * imageWidth * scale;
+ final y2 = cy + (ocr.y2 - 0.5) * imageHeight * scale;
+ final x3 = cx + (ocr.x3 - 0.5) * imageWidth * scale;
+ final y3 = cy + (ocr.y3 - 0.5) * imageHeight * scale;
+ final x4 = cx + (ocr.x4 - 0.5) * imageWidth * scale;
+ final y4 = cy + (ocr.y4 - 0.5) * imageHeight * scale;
+
+ // Bounding rectangle for hit testing and Positioned placement
+ final minX = [x1, x2, x3, x4].reduce((a, b) => a < b ? a : b);
+ final maxX = [x1, x2, x3, x4].reduce((a, b) => a > b ? a : b);
+ final minY = [y1, y2, y3, y4].reduce((a, b) => a < b ? a : b);
+ final maxY = [y1, y2, y3, y4].reduce((a, b) => a > b ? a : b);
+
+ return _OcrBoxItem(
+ key: ValueKey(index),
+ ocr: ocr,
+ index: index,
+ isSelected: selectedBoxIndex == index,
+ points: [
+ Offset(x1 - minX, y1 - minY),
+ Offset(x2 - minX, y2 - minY),
+ Offset(x3 - minX, y3 - minY),
+ Offset(x4 - minX, y4 - minY),
+ ],
+ left: minX,
+ top: minY,
+ width: maxX - minX,
+ height: maxY - minY,
+ angle: math.atan2(y2 - y1, x2 - x1),
+ labelDx: (minX + maxX) / 2 - minX,
+ labelDy: (minY + maxY) / 2 - minY,
+ onSelectionChanged: onSelectionChanged,
+ );
+ }),
+ ],
+ ),
+ ),
+ );
+ }
+}
+
+class _OcrBoxItem extends StatelessWidget {
+ final Ocr ocr;
+ final int index;
+ final bool isSelected;
+ final List<Offset> points;
+ final double left;
+ final double top;
+ final double width;
+ final double height;
+ final double angle;
+ final double labelDx;
+ final double labelDy;
+ final ValueChanged<int?> onSelectionChanged;
+
+ const _OcrBoxItem({
+ super.key,
+ required this.ocr,
+ required this.index,
+ required this.isSelected,
+ required this.points,
+ required this.left,
+ required this.top,
+ required this.width,
+ required this.height,
+ required this.angle,
+ required this.labelDx,
+ required this.labelDy,
+ required this.onSelectionChanged,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ return Positioned(
+ left: left,
+ top: top,
+ child: GestureDetector(
+ onTap: () => onSelectionChanged(isSelected ? null : index),
+ behavior: HitTestBehavior.translucent,
+ child: SizedBox(
+ width: width,
+ height: height,
+ child: Stack(
+ children: [
+ CustomPaint(
+ painter: _OcrBoxPainter(
+ points: points,
+ isSelected: isSelected,
+ colorScheme: context.themeData.colorScheme,
+ ),
+ size: Size(width, height),
+ ),
+ if (isSelected)
+ Positioned(
+ left: labelDx,
+ top: labelDy,
+ child: FractionalTranslation(
+ translation: const Offset(-0.5, -0.5),
+ child: Transform.rotate(
+ angle: angle,
+ alignment: Alignment.center,
+ child: Container(
+ margin: const EdgeInsets.all(2),
+ padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
+ decoration: BoxDecoration(
+ color: Colors.grey[800]?.withValues(alpha: 0.4),
+ borderRadius: const BorderRadius.all(Radius.circular(4)),
+ ),
+ child: ConstrainedBox(
+ constraints: BoxConstraints(maxWidth: math.max(50, width), maxHeight: math.max(20, height)),
+ child: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: SelectableText(
+ ocr.text,
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: math.max(12, height * 0.6),
+ fontWeight: FontWeight.bold,
+ ),
+ textAlign: TextAlign.center,
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+class _OcrBoxPainter extends CustomPainter {
+ final List<Offset> points;
+ final bool isSelected;
+ final ColorScheme colorScheme;
+
+ const _OcrBoxPainter({required this.points, required this.isSelected, required this.colorScheme});
+
+ @override
+ void paint(Canvas canvas, Size size) {
+ final paint = Paint()
+ ..color = isSelected ? colorScheme.primary : colorScheme.secondary
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = 2.0;
+
+ final fillPaint = Paint()
+ ..color = (isSelected ? colorScheme.primary : colorScheme.secondary).withValues(alpha: 0.1)
+ ..style = PaintingStyle.fill;
+
+ final path = Path()
+ ..moveTo(points[0].dx, points[0].dy)
+ ..lineTo(points[1].dx, points[1].dy)
+ ..lineTo(points[2].dx, points[2].dy)
+ ..lineTo(points[3].dx, points[3].dy)
+ ..close();
+
+ canvas.drawPath(path, fillPaint);
+ canvas.drawPath(path, paint);
+ }
+
+ @override
+ bool shouldRepaint(_OcrBoxPainter oldDelegate) {
+ return oldDelegate.isSelected != isSelected || !listEquals(oldDelegate.points, points);
+ }
+}
diff --git a/mobile/lib/presentation/widgets/asset_viewer/viewer_top_app_bar.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/viewer_top_app_bar.widget.dart
index 3b158c63a8..f7ccf3ba12 100644
--- a/mobile/lib/presentation/widgets/asset_viewer/viewer_top_app_bar.widget.dart
+++ b/mobile/lib/presentation/widgets/asset_viewer/viewer_top_app_bar.widget.dart
@@ -13,6 +13,7 @@ import 'package:immich_mobile/providers/activity.provider.dart';
import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/providers/infrastructure/asset_viewer/asset.provider.dart';
import 'package:immich_mobile/providers/infrastructure/current_album.provider.dart';
+import 'package:immich_mobile/providers/infrastructure/ocr.provider.dart';
import 'package:immich_mobile/providers/infrastructure/readonly_mode.provider.dart';
import 'package:immich_mobile/providers/routes.provider.dart';
import 'package:immich_mobile/providers/user.provider.dart';
@@ -35,6 +36,7 @@ class ViewerTopAppBar extends ConsumerWidget implements PreferredSizeWidget {
final isOwner = asset is RemoteAsset && asset.ownerId == user?.id;
final isInLockedView = ref.watch(inLockedViewProvider);
final isReadonlyModeEnabled = ref.watch(readonlyModeProvider);
+ final hasOcr = asset is RemoteAsset && ref.watch(ocrAssetProvider(asset.id)).valueOrNull?.isNotEmpty == true;
final showingDetails = ref.watch(assetViewerProvider.select((state) => state.showingDetails));
@@ -46,8 +48,15 @@ class ViewerTopAppBar extends ConsumerWidget implements PreferredSizeWidget {
double opacity = ref.watch(assetViewerProvider.select((s) => s.backgroundOpacity)) * (showingControls ? 1 : 0);
final originalTheme = context.themeData;
+ final showingOcr = ref.watch(assetViewerProvider.select((state) => state.showingOcr));
final actions = <Widget>[
+ if (hasOcr)
+ IconButton(
+ icon: Icon(showingOcr ? Icons.text_fields : Icons.text_fields_outlined),
+ onPressed: ref.read(assetViewerProvider.notifier).toggleOcr,
+ color: showingOcr ? context.primaryColor : null,
+ ),
if (asset.isMotionPhoto) const MotionPhotoActionButton(iconOnly: true),
if (album != null && album.isActivityEnabled && album.isShared)
IconButton(
diff --git a/mobile/lib/providers/asset_viewer/asset_viewer.provider.dart b/mobile/lib/providers/asset_viewer/asset_viewer.provider.dart
index 9f3b05b9b0..5c9f3c92a3 100644
--- a/mobile/lib/providers/asset_viewer/asset_viewer.provider.dart
+++ b/mobile/lib/providers/asset_viewer/asset_viewer.provider.dart
@@ -8,6 +8,7 @@ class AssetViewerState {
final bool showingDetails;
final bool showingControls;
final bool isZoomed;
+ final bool showingOcr;
final BaseAsset? currentAsset;
final int stackIndex;
@@ -16,6 +17,7 @@ class AssetViewerState {
this.showingDetails = false,
this.showingControls = true,
this.isZoomed = false,
+ this.showingOcr = false,
this.currentAsset,
this.stackIndex = 0,
});
@@ -25,6 +27,7 @@ class AssetViewerState {
bool? showingDetails,
bool? showingControls,
bool? isZoomed,
+ bool? showingOcr,
BaseAsset? currentAsset,
int? stackIndex,
}) {
@@ -33,6 +36,7 @@ class AssetViewerState {
showingDetails: showingDetails ?? this.showingDetails,
showingControls: showingControls ?? this.showingControls,
isZoomed: isZoomed ?? this.isZoomed,
+ showingOcr: showingOcr ?? this.showingOcr,
currentAsset: currentAsset ?? this.currentAsset,
stackIndex: stackIndex ?? this.stackIndex,
);
@@ -40,7 +44,7 @@ class AssetViewerState {
@override
String toString() {
- return 'AssetViewerState(opacity: $backgroundOpacity, showingDetails: $showingDetails, controls: $showingControls, isZoomed: $isZoomed)';
+ return 'AssetViewerState(opacity: $backgroundOpacity, showingDetails: $showingDetails, controls: $showingControls, isZoomed: $isZoomed, showingOcr: $showingOcr)';
}
@override
@@ -56,6 +60,7 @@ class AssetViewerState {
other.showingDetails == showingDetails &&
other.showingControls == showingControls &&
other.isZoomed == isZoomed &&
+ other.showingOcr == showingOcr &&
other.currentAsset == currentAsset &&
other.stackIndex == stackIndex;
}
@@ -66,6 +71,7 @@ class AssetViewerState {
showingDetails.hashCode ^
showingControls.hashCode ^
isZoomed.hashCode ^
+ showingOcr.hashCode ^
currentAsset.hashCode ^
stackIndex.hashCode;
}
@@ -90,7 +96,7 @@ class AssetViewerStateNotifier extends Notifier<AssetViewerState> {
if (asset == state.currentAsset) {
return;
}
- state = state.copyWith(currentAsset: asset, stackIndex: 0);
+ state = state.copyWith(currentAsset: asset, stackIndex: 0, showingOcr: false);
}
void setOpacity(double opacity) {
@@ -137,6 +143,10 @@ class AssetViewerStateNotifier extends Notifier<AssetViewerState> {
}
state = state.copyWith(stackIndex: index);
}
+
+ void toggleOcr() {
+ state = state.copyWith(showingOcr: !state.showingOcr);
+ }
}
final assetViewerProvider = NotifierProvider<AssetViewerStateNotifier, AssetViewerState>(AssetViewerStateNotifier.new);
diff --git a/mobile/lib/providers/infrastructure/ocr.provider.dart b/mobile/lib/providers/infrastructure/ocr.provider.dart
new file mode 100644
index 0000000000..111f3952ce
--- /dev/null
+++ b/mobile/lib/providers/infrastructure/ocr.provider.dart
@@ -0,0 +1,14 @@
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:immich_mobile/domain/models/ocr.model.dart';
+import 'package:immich_mobile/domain/services/ocr.service.dart';
+import 'package:immich_mobile/infrastructure/repositories/ocr.repository.dart';
+import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
+
+final ocrRepositoryProvider = Provider<OcrRepository>((ref) => OcrRepository(ref.watch(driftProvider)));
+
+final ocrServiceProvider = Provider<OcrService>((ref) => OcrService(ref.watch(ocrRepositoryProvider)));
+
+final ocrAssetProvider = FutureProvider.autoDispose.family<List<Ocr>?, String>((ref, assetId) async {
+ final service = ref.watch(ocrServiceProvider);
+ return service.get(assetId);
+});
diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md
index 55db46740f..e7f8bacef9 100644
--- a/mobile/openapi/README.md
+++ b/mobile/openapi/README.md
@@ -586,6 +586,8 @@ Class | Method | HTTP request | Description
- [SyncAssetFaceV2](doc//SyncAssetFaceV2.md)
- [SyncAssetMetadataDeleteV1](doc//SyncAssetMetadataDeleteV1.md)
- [SyncAssetMetadataV1](doc//SyncAssetMetadataV1.md)
+ - [SyncAssetOcrDeleteV1](doc//SyncAssetOcrDeleteV1.md)
+ - [SyncAssetOcrV1](doc//SyncAssetOcrV1.md)
- [SyncAssetV1](doc//SyncAssetV1.md)
- [SyncAssetV2](doc//SyncAssetV2.md)
- [SyncAuthUserV1](doc//SyncAuthUserV1.md)
diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart
index 43c3fb320a..891c6a1495 100644
--- a/mobile/openapi/lib/api.dart
+++ b/mobile/openapi/lib/api.dart
@@ -326,6 +326,8 @@ part 'model/sync_asset_face_v1.dart';
part 'model/sync_asset_face_v2.dart';
part 'model/sync_asset_metadata_delete_v1.dart';
part 'model/sync_asset_metadata_v1.dart';
+part 'model/sync_asset_ocr_delete_v1.dart';
+part 'model/sync_asset_ocr_v1.dart';
part 'model/sync_asset_v1.dart';
part 'model/sync_asset_v2.dart';
part 'model/sync_auth_user_v1.dart';
diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dart
index 9240b30c0b..baa5293222 100644
--- a/mobile/openapi/lib/api_client.dart
+++ b/mobile/openapi/lib/api_client.dart
@@ -697,6 +697,10 @@ class ApiClient {
return SyncAssetMetadataDeleteV1.fromJson(value);
case 'SyncAssetMetadataV1':
return SyncAssetMetadataV1.fromJson(value);
+ case 'SyncAssetOcrDeleteV1':
+ return SyncAssetOcrDeleteV1.fromJson(value);
+ case 'SyncAssetOcrV1':
+ return SyncAssetOcrV1.fromJson(value);
case 'SyncAssetV1':
return SyncAssetV1.fromJson(value);
case 'SyncAssetV2':
diff --git a/mobile/openapi/lib/model/sync_asset_ocr_delete_v1.dart b/mobile/openapi/lib/model/sync_asset_ocr_delete_v1.dart
new file mode 100644
index 0000000000..e413ea5d9e
--- /dev/null
+++ b/mobile/openapi/lib/model/sync_asset_ocr_delete_v1.dart
@@ -0,0 +1,120 @@
+//
+// AUTO-GENERATED FILE, DO NOT MODIFY!
+//
+// @dart=2.18
+
+// ignore_for_file: unused_element, unused_import
+// ignore_for_file: always_put_required_named_parameters_first
+// ignore_for_file: constant_identifier_names
+// ignore_for_file: lines_longer_than_80_chars
+
+part of openapi.api;
+
+class SyncAssetOcrDeleteV1 {
+ /// Returns a new [SyncAssetOcrDeleteV1] instance.
+ SyncAssetOcrDeleteV1({
+ required this.assetId,
+ required this.deletedAt,
+ required this.id,
+ });
+
+ /// Original asset ID of the deleted OCR entry
+ String assetId;
+
+ /// Timestamp when the OCR entry was deleted
+ DateTime deletedAt;
+
+ /// Audit row ID of the deleted OCR entry
+ String id;
+
+ @override
+ bool operator ==(Object other) => identical(this, other) || other is SyncAssetOcrDeleteV1 &&
+ other.assetId == assetId &&
+ other.deletedAt == deletedAt &&
+ other.id == id;
+
+ @override
+ int get hashCode =>
+ // ignore: unnecessary_parenthesis
+ (assetId.hashCode) +
+ (deletedAt.hashCode) +
+ (id.hashCode);
+
+ @override
+ String toString() => 'SyncAssetOcrDeleteV1[assetId=$assetId, deletedAt=$deletedAt, id=$id]';
+
+ Map<String, dynamic> toJson() {
+ final json = <String, dynamic>{};
+ json[r'assetId'] = this.assetId;
+ json[r'deletedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')
+ ? this.deletedAt.millisecondsSinceEpoch
+ : this.deletedAt.toUtc().toIso8601String();
+ json[r'id'] = this.id;
+ return json;
+ }
+
+ /// Returns a new [SyncAssetOcrDeleteV1] instance and imports its values from
+ /// [value] if it's a [Map], null otherwise.
+ // ignore: prefer_constructors_over_static_methods
+ static SyncAssetOcrDeleteV1? fromJson(dynamic value) {
+ upgradeDto(value, "SyncAssetOcrDeleteV1");
+ if (value is Map) {
+ final json = value.cast<String, dynamic>();
+
+ return SyncAssetOcrDeleteV1(
+ assetId: mapValueOfType<String>(json, r'assetId')!,
+ deletedAt: mapDateTime(json, r'deletedAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!,
+ id: mapValueOfType<String>(json, r'id')!,
+ );
+ }
+ return null;
+ }
+
+ static List<SyncAssetOcrDeleteV1> listFromJson(dynamic json, {bool growable = false,}) {
+ final result = <SyncAssetOcrDeleteV1>[];
+ if (json is List && json.isNotEmpty) {
+ for (final row in json) {
+ final value = SyncAssetOcrDeleteV1.fromJson(row);
+ if (value != null) {
+ result.add(value);
+ }
+ }
+ }
+ return result.toList(growable: growable);
+ }
+
+ static Map<String, SyncAssetOcrDeleteV1> mapFromJson(dynamic json) {
+ final map = <String, SyncAssetOcrDeleteV1>{};
+ if (json is Map && json.isNotEmpty) {
+ json = json.cast<String, dynamic>(); // ignore: parameter_assignments
+ for (final entry in json.entries) {
+ final value = SyncAssetOcrDeleteV1.fromJson(entry.value);
+ if (value != null) {
+ map[entry.key] = value;
+ }
+ }
+ }
+ return map;
+ }
+
+ // maps a json object with a list of SyncAssetOcrDeleteV1-objects as value to a dart map
+ static Map<String, List<SyncAssetOcrDeleteV1>> mapListFromJson(dynamic json, {bool growable = false,}) {
+ final map = <String, List<SyncAssetOcrDeleteV1>>{};
+ if (json is Map && json.isNotEmpty) {
+ // ignore: parameter_assignments
+ json = json.cast<String, dynamic>();
+ for (final entry in json.entries) {
+ map[entry.key] = SyncAssetOcrDeleteV1.listFromJson(entry.value, growable: growable,);
+ }
+ }
+ return map;
+ }
+
+ /// The list of required keys that must be present in a JSON.
+ static const requiredKeys = <String>{
+ 'assetId',
+ 'deletedAt',
+ 'id',
+ };
+}
+
diff --git a/mobile/openapi/lib/model/sync_asset_ocr_v1.dart b/mobile/openapi/lib/model/sync_asset_ocr_v1.dart
new file mode 100644
index 0000000000..616583189a
--- /dev/null
+++ b/mobile/openapi/lib/model/sync_asset_ocr_v1.dart
@@ -0,0 +1,217 @@
+//
+// AUTO-GENERATED FILE, DO NOT MODIFY!
+//
+// @dart=2.18
+
+// ignore_for_file: unused_element, unused_import
+// ignore_for_file: always_put_required_named_parameters_first
+// ignore_for_file: constant_identifier_names
+// ignore_for_file: lines_longer_than_80_chars
+
+part of openapi.api;
+
+class SyncAssetOcrV1 {
+ /// Returns a new [SyncAssetOcrV1] instance.
+ SyncAssetOcrV1({
+ required this.assetId,
+ required this.boxScore,
+ required this.id,
+ required this.isVisible,
+ required this.text,
+ required this.textScore,
+ required this.x1,
+ required this.x2,
+ required this.x3,
+ required this.x4,
+ required this.y1,
+ required this.y2,
+ required this.y3,
+ required this.y4,
+ });
+
+ /// Asset ID
+ String assetId;
+
+ /// Confidence score of the bounding box
+ double boxScore;
+
+ /// OCR entry ID
+ String id;
+
+ /// Whether the OCR entry is visible
+ bool isVisible;
+
+ /// Recognized text content
+ String text;
+
+ /// Confidence score of the recognized text
+ double textScore;
+
+ /// Top-left X coordinate (normalized 0–1)
+ double x1;
+
+ /// Top-right X coordinate (normalized 0–1)
+ double x2;
+
+ /// Bottom-right X coordinate (normalized 0–1)
+ double x3;
+
+ /// Bottom-left X coordinate (normalized 0–1)
+ double x4;
+
+ /// Top-left Y coordinate (normalized 0–1)
+ double y1;
+
+ /// Top-right Y coordinate (normalized 0–1)
+ double y2;
+
+ /// Bottom-right Y coordinate (normalized 0–1)
+ double y3;
+
+ /// Bottom-left Y coordinate (normalized 0–1)
+ double y4;
+
+ @override
+ bool operator ==(Object other) => identical(this, other) || other is SyncAssetOcrV1 &&
+ other.assetId == assetId &&
+ other.boxScore == boxScore &&
+ other.id == id &&
+ other.isVisible == isVisible &&
+ other.text == text &&
+ other.textScore == textScore &&
+ other.x1 == x1 &&
+ other.x2 == x2 &&
+ other.x3 == x3 &&
+ other.x4 == x4 &&
+ other.y1 == y1 &&
+ other.y2 == y2 &&
+ other.y3 == y3 &&
+ other.y4 == y4;
+
+ @override
+ int get hashCode =>
+ // ignore: unnecessary_parenthesis
+ (assetId.hashCode) +
+ (boxScore.hashCode) +
+ (id.hashCode) +
+ (isVisible.hashCode) +
+ (text.hashCode) +
+ (textScore.hashCode) +
+ (x1.hashCode) +
+ (x2.hashCode) +
+ (x3.hashCode) +
+ (x4.hashCode) +
+ (y1.hashCode) +
+ (y2.hashCode) +
+ (y3.hashCode) +
+ (y4.hashCode);
+
+ @override
+ String toString() => 'SyncAssetOcrV1[assetId=$assetId, boxScore=$boxScore, id=$id, isVisible=$isVisible, text=$text, textScore=$textScore, x1=$x1, x2=$x2, x3=$x3, x4=$x4, y1=$y1, y2=$y2, y3=$y3, y4=$y4]';
+
+ Map<String, dynamic> toJson() {
+ final json = <String, dynamic>{};
+ json[r'assetId'] = this.assetId;
+ json[r'boxScore'] = this.boxScore;
+ json[r'id'] = this.id;
+ json[r'isVisible'] = this.isVisible;
+ json[r'text'] = this.text;
+ json[r'textScore'] = this.textScore;
+ json[r'x1'] = this.x1;
+ json[r'x2'] = this.x2;
+ json[r'x3'] = this.x3;
+ json[r'x4'] = this.x4;
+ json[r'y1'] = this.y1;
+ json[r'y2'] = this.y2;
+ json[r'y3'] = this.y3;
+ json[r'y4'] = this.y4;
+ return json;
+ }
+
+ /// Returns a new [SyncAssetOcrV1] instance and imports its values from
+ /// [value] if it's a [Map], null otherwise.
+ // ignore: prefer_constructors_over_static_methods
+ static SyncAssetOcrV1? fromJson(dynamic value) {
+ upgradeDto(value, "SyncAssetOcrV1");
+ if (value is Map) {
+ final json = value.cast<String, dynamic>();
+
+ return SyncAssetOcrV1(
+ assetId: mapValueOfType<String>(json, r'assetId')!,
+ boxScore: mapValueOfType<double>(json, r'boxScore')!,
+ id: mapValueOfType<String>(json, r'id')!,
+ isVisible: mapValueOfType<bool>(json, r'isVisible')!,
+ text: mapValueOfType<String>(json, r'text')!,
+ textScore: mapValueOfType<double>(json, r'textScore')!,
+ x1: mapValueOfType<double>(json, r'x1')!,
+ x2: mapValueOfType<double>(json, r'x2')!,
+ x3: mapValueOfType<double>(json, r'x3')!,
+ x4: mapValueOfType<double>(json, r'x4')!,
+ y1: mapValueOfType<double>(json, r'y1')!,
+ y2: mapValueOfType<double>(json, r'y2')!,
+ y3: mapValueOfType<double>(json, r'y3')!,
+ y4: mapValueOfType<double>(json, r'y4')!,
+ );
+ }
+ return null;
+ }
+
+ static List<SyncAssetOcrV1> listFromJson(dynamic json, {bool growable = false,}) {
+ final result = <SyncAssetOcrV1>[];
+ if (json is List && json.isNotEmpty) {
+ for (final row in json) {
+ final value = SyncAssetOcrV1.fromJson(row);
+ if (value != null) {
+ result.add(value);
+ }
+ }
+ }
+ return result.toList(growable: growable);
+ }
+
+ static Map<String, SyncAssetOcrV1> mapFromJson(dynamic json) {
+ final map = <String, SyncAssetOcrV1>{};
+ if (json is Map && json.isNotEmpty) {
+ json = json.cast<String, dynamic>(); // ignore: parameter_assignments
+ for (final entry in json.entries) {
+ final value = SyncAssetOcrV1.fromJson(entry.value);
+ if (value != null) {
+ map[entry.key] = value;
+ }
+ }
+ }
+ return map;
+ }
+
+ // maps a json object with a list of SyncAssetOcrV1-objects as value to a dart map
+ static Map<String, List<SyncAssetOcrV1>> mapListFromJson(dynamic json, {bool growable = false,}) {
+ final map = <String, List<SyncAssetOcrV1>>{};
+ if (json is Map && json.isNotEmpty) {
+ // ignore: parameter_assignments
+ json = json.cast<String, dynamic>();
+ for (final entry in json.entries) {
+ map[entry.key] = SyncAssetOcrV1.listFromJson(entry.value, growable: growable,);
+ }
+ }
+ return map;
+ }
+
+ /// The list of required keys that must be present in a JSON.
+ static const requiredKeys = <String>{
+ 'assetId',
+ 'boxScore',
+ 'id',
+ 'isVisible',
+ 'text',
+ 'textScore',
+ 'x1',
+ 'x2',
+ 'x3',
+ 'x4',
+ 'y1',
+ 'y2',
+ 'y3',
+ 'y4',
+ };
+}
+
diff --git a/mobile/openapi/lib/model/sync_entity_type.dart b/mobile/openapi/lib/model/sync_entity_type.dart
index 124cfdc8c4..543e72eb44 100644
--- a/mobile/openapi/lib/model/sync_entity_type.dart
+++ b/mobile/openapi/lib/model/sync_entity_type.dart
@@ -34,6 +34,8 @@ class SyncEntityType {
static const assetEditDeleteV1 = SyncEntityType._(r'AssetEditDeleteV1');
static const assetMetadataV1 = SyncEntityType._(r'AssetMetadataV1');
static const assetMetadataDeleteV1 = SyncEntityType._(r'AssetMetadataDeleteV1');
+ static const assetOcrV1 = SyncEntityType._(r'AssetOcrV1');
+ static const assetOcrDeleteV1 = SyncEntityType._(r'AssetOcrDeleteV1');
static const partnerV1 = SyncEntityType._(r'PartnerV1');
static const partnerDeleteV1 = SyncEntityType._(r'PartnerDeleteV1');
static const partnerAssetV1 = SyncEntityType._(r'PartnerAssetV1');
@@ -94,6 +96,8 @@ class SyncEntityType {
assetEditDeleteV1,
assetMetadataV1,
assetMetadataDeleteV1,
+ assetOcrV1,
+ assetOcrDeleteV1,
partnerV1,
partnerDeleteV1,
partnerAssetV1,
@@ -189,6 +193,8 @@ class SyncEntityTypeTypeTransformer {
case r'AssetEditDeleteV1': return SyncEntityType.assetEditDeleteV1;
case r'AssetMetadataV1': return SyncEntityType.assetMetadataV1;
case r'AssetMetadataDeleteV1': return SyncEntityType.assetMetadataDeleteV1;
+ case r'AssetOcrV1': return SyncEntityType.assetOcrV1;
+ case r'AssetOcrDeleteV1': return SyncEntityType.assetOcrDeleteV1;
case r'PartnerV1': return SyncEntityType.partnerV1;
case r'PartnerDeleteV1': return SyncEntityType.partnerDeleteV1;
case r'PartnerAssetV1': return SyncEntityType.partnerAssetV1;
diff --git a/mobile/openapi/lib/model/sync_request_type.dart b/mobile/openapi/lib/model/sync_request_type.dart
index 2c17cc6aef..da08c4c597 100644
--- a/mobile/openapi/lib/model/sync_request_type.dart
+++ b/mobile/openapi/lib/model/sync_request_type.dart
@@ -35,6 +35,7 @@ class SyncRequestType {
static const assetExifsV1 = SyncRequestType._(r'AssetExifsV1');
static const assetEditsV1 = SyncRequestType._(r'AssetEditsV1');
static const assetMetadataV1 = SyncRequestType._(r'AssetMetadataV1');
+ static const assetOcrV1 = SyncRequestType._(r'AssetOcrV1');
static const authUsersV1 = SyncRequestType._(r'AuthUsersV1');
static const memoriesV1 = SyncRequestType._(r'MemoriesV1');
static const memoryToAssetsV1 = SyncRequestType._(r'MemoryToAssetsV1');
@@ -64,6 +65,7 @@ class SyncRequestType {
assetExifsV1,
assetEditsV1,
assetMetadataV1,
+ assetOcrV1,
authUsersV1,
memoriesV1,
memoryToAssetsV1,
@@ -128,6 +130,7 @@ class SyncRequestTypeTypeTransformer {
case r'AssetExifsV1': return SyncRequestType.assetExifsV1;
case r'AssetEditsV1': return SyncRequestType.assetEditsV1;
case r'AssetMetadataV1': return SyncRequestType.assetMetadataV1;
+ case r'AssetOcrV1': return SyncRequestType.assetOcrV1;
case r'AuthUsersV1': return SyncRequestType.authUsersV1;
case r'MemoriesV1': return SyncRequestType.memoriesV1;
case r'MemoryToAssetsV1': return SyncRequestType.memoryToAssetsV1;
diff --git a/mobile/test/drift/main/generated/schema.dart b/mobile/test/drift/main/generated/schema.dart
index 8f7efce826..f03fa4a593 100644
--- a/mobile/test/drift/main/generated/schema.dart
+++ b/mobile/test/drift/main/generated/schema.dart
@@ -32,6 +32,7 @@ import 'schema_v25.dart' as v25;
import 'schema_v26.dart' as v26;
import 'schema_v27.dart' as v27;
import 'schema_v28.dart' as v28;
+import 'schema_v29.dart' as v29;
class GeneratedHelper implements SchemaInstantiationHelper {
@override
@@ -93,6 +94,8 @@ class GeneratedHelper implements SchemaInstantiationHelper {
return v27.DatabaseAtV27(db);
case 28:
return v28.DatabaseAtV28(db);
+ case 29:
+ return v29.DatabaseAtV29(db);
default:
throw MissingSchemaException(version, versions);
}
@@ -127,5 +130,6 @@ class GeneratedHelper implements SchemaInstantiationHelper {
26,
27,
28,
+ 29,
];
}
diff --git a/mobile/test/drift/main/generated/schema_v29.dart b/mobile/test/drift/main/generated/schema_v29.dart
new file mode 100644
index 0000000000..ed721e3fe8
--- /dev/null
+++ b/mobile/test/drift/main/generated/schema_v29.dart
@@ -0,0 +1,10027 @@
+// dart format width=80
+import 'dart:typed_data' as i2;
+// GENERATED BY drift_dev, DO NOT MODIFY.
+// ignore_for_file: type=lint,unused_import
+//
+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,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> name = GeneratedColumn<String>(
+ 'name',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> email = GeneratedColumn<String>(
+ 'email',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> hasProfileImage = GeneratedColumn<int>(
+ 'has_profile_image',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints:
+ 'NOT NULL DEFAULT 0 CHECK (has_profile_image IN (0, 1))',
+ defaultValue: const CustomExpression('0'),
+ );
+ late final GeneratedColumn<String> profileChangedAt = GeneratedColumn<String>(
+ 'profile_changed_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<int> avatarColor = GeneratedColumn<int>(
+ 'avatar_color',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 0',
+ 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.int,
+ data['${effectivePrefix}has_profile_image'],
+ )!,
+ profileChangedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ 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;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class UserEntityData extends DataClass implements Insertable<UserEntityData> {
+ final String id;
+ final String name;
+ final String email;
+ final int hasProfileImage;
+ final String 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<int>(hasProfileImage);
+ map['profile_changed_at'] = Variable<String>(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<int>(json['hasProfileImage']),
+ profileChangedAt: serializer.fromJson<String>(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<int>(hasProfileImage),
+ 'profileChangedAt': serializer.toJson<String>(profileChangedAt),
+ 'avatarColor': serializer.toJson<int>(avatarColor),
+ };
+ }
+
+ UserEntityData copyWith({
+ String? id,
+ String? name,
+ String? email,
+ int? hasProfileImage,
+ String? 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<int> hasProfileImage;
+ final Value<String> 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<int>? hasProfileImage,
+ Expression<String>? 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<int>? hasProfileImage,
+ Value<String>? 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<int>(hasProfileImage.value);
+ }
+ if (profileChangedAt.present) {
+ map['profile_changed_at'] = Variable<String>(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,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> type = GeneratedColumn<int>(
+ 'type',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> createdAt = GeneratedColumn<String>(
+ 'created_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
+ 'updated_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<int> width = GeneratedColumn<int>(
+ 'width',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> height = GeneratedColumn<int>(
+ 'height',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> durationMs = GeneratedColumn<int>(
+ 'duration_ms',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> id = GeneratedColumn<String>(
+ 'id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> checksum = GeneratedColumn<String>(
+ 'checksum',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> isFavorite = GeneratedColumn<int>(
+ 'is_favorite',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 0 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,
+ $customConstraints: 'NOT NULL REFERENCES user_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<String> localDateTime = GeneratedColumn<String>(
+ 'local_date_time',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> thumbHash = GeneratedColumn<String>(
+ 'thumb_hash',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> deletedAt = GeneratedColumn<String>(
+ 'deleted_at',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> uploadedAt = GeneratedColumn<String>(
+ 'uploaded_at',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> livePhotoVideoId = GeneratedColumn<String>(
+ 'live_photo_video_id',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> visibility = GeneratedColumn<int>(
+ 'visibility',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> stackId = GeneratedColumn<String>(
+ 'stack_id',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> libraryId = GeneratedColumn<String>(
+ 'library_id',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> isEdited = GeneratedColumn<int>(
+ 'is_edited',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 0 CHECK (is_edited IN (0, 1))',
+ defaultValue: const CustomExpression('0'),
+ );
+ @override
+ List<GeneratedColumn> get $columns => [
+ name,
+ type,
+ createdAt,
+ updatedAt,
+ width,
+ height,
+ durationMs,
+ id,
+ checksum,
+ isFavorite,
+ ownerId,
+ localDateTime,
+ thumbHash,
+ deletedAt,
+ uploadedAt,
+ livePhotoVideoId,
+ visibility,
+ stackId,
+ libraryId,
+ isEdited,
+ ];
+ @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.string,
+ data['${effectivePrefix}created_at'],
+ )!,
+ updatedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}updated_at'],
+ )!,
+ width: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}width'],
+ ),
+ height: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}height'],
+ ),
+ durationMs: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}duration_ms'],
+ ),
+ id: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}id'],
+ )!,
+ checksum: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}checksum'],
+ )!,
+ isFavorite: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}is_favorite'],
+ )!,
+ ownerId: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}owner_id'],
+ )!,
+ localDateTime: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}local_date_time'],
+ ),
+ thumbHash: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}thumb_hash'],
+ ),
+ deletedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}deleted_at'],
+ ),
+ uploadedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}uploaded_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'],
+ ),
+ isEdited: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}is_edited'],
+ )!,
+ );
+ }
+
+ @override
+ RemoteAssetEntity createAlias(String alias) {
+ return RemoteAssetEntity(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class RemoteAssetEntityData extends DataClass
+ implements Insertable<RemoteAssetEntityData> {
+ final String name;
+ final int type;
+ final String createdAt;
+ final String updatedAt;
+ final int? width;
+ final int? height;
+ final int? durationMs;
+ final String id;
+ final String checksum;
+ final int isFavorite;
+ final String ownerId;
+ final String? localDateTime;
+ final String? thumbHash;
+ final String? deletedAt;
+ final String? uploadedAt;
+ final String? livePhotoVideoId;
+ final int visibility;
+ final String? stackId;
+ final String? libraryId;
+ final int isEdited;
+ const RemoteAssetEntityData({
+ required this.name,
+ required this.type,
+ required this.createdAt,
+ required this.updatedAt,
+ this.width,
+ this.height,
+ this.durationMs,
+ required this.id,
+ required this.checksum,
+ required this.isFavorite,
+ required this.ownerId,
+ this.localDateTime,
+ this.thumbHash,
+ this.deletedAt,
+ this.uploadedAt,
+ this.livePhotoVideoId,
+ required this.visibility,
+ this.stackId,
+ this.libraryId,
+ required this.isEdited,
+ });
+ @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<String>(createdAt);
+ map['updated_at'] = Variable<String>(updatedAt);
+ if (!nullToAbsent || width != null) {
+ map['width'] = Variable<int>(width);
+ }
+ if (!nullToAbsent || height != null) {
+ map['height'] = Variable<int>(height);
+ }
+ if (!nullToAbsent || durationMs != null) {
+ map['duration_ms'] = Variable<int>(durationMs);
+ }
+ map['id'] = Variable<String>(id);
+ map['checksum'] = Variable<String>(checksum);
+ map['is_favorite'] = Variable<int>(isFavorite);
+ map['owner_id'] = Variable<String>(ownerId);
+ if (!nullToAbsent || localDateTime != null) {
+ map['local_date_time'] = Variable<String>(localDateTime);
+ }
+ if (!nullToAbsent || thumbHash != null) {
+ map['thumb_hash'] = Variable<String>(thumbHash);
+ }
+ if (!nullToAbsent || deletedAt != null) {
+ map['deleted_at'] = Variable<String>(deletedAt);
+ }
+ if (!nullToAbsent || uploadedAt != null) {
+ map['uploaded_at'] = Variable<String>(uploadedAt);
+ }
+ 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);
+ }
+ map['is_edited'] = Variable<int>(isEdited);
+ 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<String>(json['createdAt']),
+ updatedAt: serializer.fromJson<String>(json['updatedAt']),
+ width: serializer.fromJson<int?>(json['width']),
+ height: serializer.fromJson<int?>(json['height']),
+ durationMs: serializer.fromJson<int?>(json['durationMs']),
+ id: serializer.fromJson<String>(json['id']),
+ checksum: serializer.fromJson<String>(json['checksum']),
+ isFavorite: serializer.fromJson<int>(json['isFavorite']),
+ ownerId: serializer.fromJson<String>(json['ownerId']),
+ localDateTime: serializer.fromJson<String?>(json['localDateTime']),
+ thumbHash: serializer.fromJson<String?>(json['thumbHash']),
+ deletedAt: serializer.fromJson<String?>(json['deletedAt']),
+ uploadedAt: serializer.fromJson<String?>(json['uploadedAt']),
+ livePhotoVideoId: serializer.fromJson<String?>(json['livePhotoVideoId']),
+ visibility: serializer.fromJson<int>(json['visibility']),
+ stackId: serializer.fromJson<String?>(json['stackId']),
+ libraryId: serializer.fromJson<String?>(json['libraryId']),
+ isEdited: serializer.fromJson<int>(json['isEdited']),
+ );
+ }
+ @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<String>(createdAt),
+ 'updatedAt': serializer.toJson<String>(updatedAt),
+ 'width': serializer.toJson<int?>(width),
+ 'height': serializer.toJson<int?>(height),
+ 'durationMs': serializer.toJson<int?>(durationMs),
+ 'id': serializer.toJson<String>(id),
+ 'checksum': serializer.toJson<String>(checksum),
+ 'isFavorite': serializer.toJson<int>(isFavorite),
+ 'ownerId': serializer.toJson<String>(ownerId),
+ 'localDateTime': serializer.toJson<String?>(localDateTime),
+ 'thumbHash': serializer.toJson<String?>(thumbHash),
+ 'deletedAt': serializer.toJson<String?>(deletedAt),
+ 'uploadedAt': serializer.toJson<String?>(uploadedAt),
+ 'livePhotoVideoId': serializer.toJson<String?>(livePhotoVideoId),
+ 'visibility': serializer.toJson<int>(visibility),
+ 'stackId': serializer.toJson<String?>(stackId),
+ 'libraryId': serializer.toJson<String?>(libraryId),
+ 'isEdited': serializer.toJson<int>(isEdited),
+ };
+ }
+
+ RemoteAssetEntityData copyWith({
+ String? name,
+ int? type,
+ String? createdAt,
+ String? updatedAt,
+ Value<int?> width = const Value.absent(),
+ Value<int?> height = const Value.absent(),
+ Value<int?> durationMs = const Value.absent(),
+ String? id,
+ String? checksum,
+ int? isFavorite,
+ String? ownerId,
+ Value<String?> localDateTime = const Value.absent(),
+ Value<String?> thumbHash = const Value.absent(),
+ Value<String?> deletedAt = const Value.absent(),
+ Value<String?> uploadedAt = const Value.absent(),
+ Value<String?> livePhotoVideoId = const Value.absent(),
+ int? visibility,
+ Value<String?> stackId = const Value.absent(),
+ Value<String?> libraryId = const Value.absent(),
+ int? isEdited,
+ }) => 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,
+ durationMs: durationMs.present ? durationMs.value : this.durationMs,
+ 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,
+ uploadedAt: uploadedAt.present ? uploadedAt.value : this.uploadedAt,
+ 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,
+ isEdited: isEdited ?? this.isEdited,
+ );
+ 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,
+ durationMs: data.durationMs.present
+ ? data.durationMs.value
+ : this.durationMs,
+ 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,
+ uploadedAt: data.uploadedAt.present
+ ? data.uploadedAt.value
+ : this.uploadedAt,
+ 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,
+ isEdited: data.isEdited.present ? data.isEdited.value : this.isEdited,
+ );
+ }
+
+ @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('durationMs: $durationMs, ')
+ ..write('id: $id, ')
+ ..write('checksum: $checksum, ')
+ ..write('isFavorite: $isFavorite, ')
+ ..write('ownerId: $ownerId, ')
+ ..write('localDateTime: $localDateTime, ')
+ ..write('thumbHash: $thumbHash, ')
+ ..write('deletedAt: $deletedAt, ')
+ ..write('uploadedAt: $uploadedAt, ')
+ ..write('livePhotoVideoId: $livePhotoVideoId, ')
+ ..write('visibility: $visibility, ')
+ ..write('stackId: $stackId, ')
+ ..write('libraryId: $libraryId, ')
+ ..write('isEdited: $isEdited')
+ ..write(')'))
+ .toString();
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ name,
+ type,
+ createdAt,
+ updatedAt,
+ width,
+ height,
+ durationMs,
+ id,
+ checksum,
+ isFavorite,
+ ownerId,
+ localDateTime,
+ thumbHash,
+ deletedAt,
+ uploadedAt,
+ livePhotoVideoId,
+ visibility,
+ stackId,
+ libraryId,
+ isEdited,
+ );
+ @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.durationMs == this.durationMs &&
+ 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.uploadedAt == this.uploadedAt &&
+ other.livePhotoVideoId == this.livePhotoVideoId &&
+ other.visibility == this.visibility &&
+ other.stackId == this.stackId &&
+ other.libraryId == this.libraryId &&
+ other.isEdited == this.isEdited);
+}
+
+class RemoteAssetEntityCompanion
+ extends UpdateCompanion<RemoteAssetEntityData> {
+ final Value<String> name;
+ final Value<int> type;
+ final Value<String> createdAt;
+ final Value<String> updatedAt;
+ final Value<int?> width;
+ final Value<int?> height;
+ final Value<int?> durationMs;
+ final Value<String> id;
+ final Value<String> checksum;
+ final Value<int> isFavorite;
+ final Value<String> ownerId;
+ final Value<String?> localDateTime;
+ final Value<String?> thumbHash;
+ final Value<String?> deletedAt;
+ final Value<String?> uploadedAt;
+ final Value<String?> livePhotoVideoId;
+ final Value<int> visibility;
+ final Value<String?> stackId;
+ final Value<String?> libraryId;
+ final Value<int> isEdited;
+ 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.durationMs = 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.uploadedAt = const Value.absent(),
+ this.livePhotoVideoId = const Value.absent(),
+ this.visibility = const Value.absent(),
+ this.stackId = const Value.absent(),
+ this.libraryId = const Value.absent(),
+ this.isEdited = 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.durationMs = 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.uploadedAt = const Value.absent(),
+ this.livePhotoVideoId = const Value.absent(),
+ required int visibility,
+ this.stackId = const Value.absent(),
+ this.libraryId = const Value.absent(),
+ this.isEdited = 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<String>? createdAt,
+ Expression<String>? updatedAt,
+ Expression<int>? width,
+ Expression<int>? height,
+ Expression<int>? durationMs,
+ Expression<String>? id,
+ Expression<String>? checksum,
+ Expression<int>? isFavorite,
+ Expression<String>? ownerId,
+ Expression<String>? localDateTime,
+ Expression<String>? thumbHash,
+ Expression<String>? deletedAt,
+ Expression<String>? uploadedAt,
+ Expression<String>? livePhotoVideoId,
+ Expression<int>? visibility,
+ Expression<String>? stackId,
+ Expression<String>? libraryId,
+ Expression<int>? isEdited,
+ }) {
+ 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 (durationMs != null) 'duration_ms': durationMs,
+ 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 (uploadedAt != null) 'uploaded_at': uploadedAt,
+ 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,
+ if (isEdited != null) 'is_edited': isEdited,
+ });
+ }
+
+ RemoteAssetEntityCompanion copyWith({
+ Value<String>? name,
+ Value<int>? type,
+ Value<String>? createdAt,
+ Value<String>? updatedAt,
+ Value<int?>? width,
+ Value<int?>? height,
+ Value<int?>? durationMs,
+ Value<String>? id,
+ Value<String>? checksum,
+ Value<int>? isFavorite,
+ Value<String>? ownerId,
+ Value<String?>? localDateTime,
+ Value<String?>? thumbHash,
+ Value<String?>? deletedAt,
+ Value<String?>? uploadedAt,
+ Value<String?>? livePhotoVideoId,
+ Value<int>? visibility,
+ Value<String?>? stackId,
+ Value<String?>? libraryId,
+ Value<int>? isEdited,
+ }) {
+ 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,
+ durationMs: durationMs ?? this.durationMs,
+ 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,
+ uploadedAt: uploadedAt ?? this.uploadedAt,
+ livePhotoVideoId: livePhotoVideoId ?? this.livePhotoVideoId,
+ visibility: visibility ?? this.visibility,
+ stackId: stackId ?? this.stackId,
+ libraryId: libraryId ?? this.libraryId,
+ isEdited: isEdited ?? this.isEdited,
+ );
+ }
+
+ @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<String>(createdAt.value);
+ }
+ if (updatedAt.present) {
+ map['updated_at'] = Variable<String>(updatedAt.value);
+ }
+ if (width.present) {
+ map['width'] = Variable<int>(width.value);
+ }
+ if (height.present) {
+ map['height'] = Variable<int>(height.value);
+ }
+ if (durationMs.present) {
+ map['duration_ms'] = Variable<int>(durationMs.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<int>(isFavorite.value);
+ }
+ if (ownerId.present) {
+ map['owner_id'] = Variable<String>(ownerId.value);
+ }
+ if (localDateTime.present) {
+ map['local_date_time'] = Variable<String>(localDateTime.value);
+ }
+ if (thumbHash.present) {
+ map['thumb_hash'] = Variable<String>(thumbHash.value);
+ }
+ if (deletedAt.present) {
+ map['deleted_at'] = Variable<String>(deletedAt.value);
+ }
+ if (uploadedAt.present) {
+ map['uploaded_at'] = Variable<String>(uploadedAt.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);
+ }
+ if (isEdited.present) {
+ map['is_edited'] = Variable<int>(isEdited.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('durationMs: $durationMs, ')
+ ..write('id: $id, ')
+ ..write('checksum: $checksum, ')
+ ..write('isFavorite: $isFavorite, ')
+ ..write('ownerId: $ownerId, ')
+ ..write('localDateTime: $localDateTime, ')
+ ..write('thumbHash: $thumbHash, ')
+ ..write('deletedAt: $deletedAt, ')
+ ..write('uploadedAt: $uploadedAt, ')
+ ..write('livePhotoVideoId: $livePhotoVideoId, ')
+ ..write('visibility: $visibility, ')
+ ..write('stackId: $stackId, ')
+ ..write('libraryId: $libraryId, ')
+ ..write('isEdited: $isEdited')
+ ..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,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> createdAt = GeneratedColumn<String>(
+ 'created_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
+ 'updated_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<String> ownerId = GeneratedColumn<String>(
+ 'owner_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL REFERENCES user_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<String> primaryAssetId = GeneratedColumn<String>(
+ 'primary_asset_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ @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.string,
+ data['${effectivePrefix}created_at'],
+ )!,
+ updatedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ 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;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class StackEntityData extends DataClass implements Insertable<StackEntityData> {
+ final String id;
+ final String createdAt;
+ final String 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<String>(createdAt);
+ map['updated_at'] = Variable<String>(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<String>(json['createdAt']),
+ updatedAt: serializer.fromJson<String>(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<String>(createdAt),
+ 'updatedAt': serializer.toJson<String>(updatedAt),
+ 'ownerId': serializer.toJson<String>(ownerId),
+ 'primaryAssetId': serializer.toJson<String>(primaryAssetId),
+ };
+ }
+
+ StackEntityData copyWith({
+ String? id,
+ String? createdAt,
+ String? 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<String> createdAt;
+ final Value<String> 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<String>? createdAt,
+ Expression<String>? 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<String>? createdAt,
+ Value<String>? 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<String>(createdAt.value);
+ }
+ if (updatedAt.present) {
+ map['updated_at'] = Variable<String>(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,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> type = GeneratedColumn<int>(
+ 'type',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> createdAt = GeneratedColumn<String>(
+ 'created_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
+ 'updated_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<int> width = GeneratedColumn<int>(
+ 'width',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> height = GeneratedColumn<int>(
+ 'height',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> durationMs = GeneratedColumn<int>(
+ 'duration_ms',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> id = GeneratedColumn<String>(
+ 'id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> checksum = GeneratedColumn<String>(
+ 'checksum',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> isFavorite = GeneratedColumn<int>(
+ 'is_favorite',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 0 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,
+ $customConstraints: 'NOT NULL DEFAULT 0',
+ defaultValue: const CustomExpression('0'),
+ );
+ late final GeneratedColumn<String> iCloudId = GeneratedColumn<String>(
+ 'i_cloud_id',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> adjustmentTime = GeneratedColumn<String>(
+ 'adjustment_time',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<double> latitude = GeneratedColumn<double>(
+ 'latitude',
+ aliasedName,
+ true,
+ type: DriftSqlType.double,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<double> longitude = GeneratedColumn<double>(
+ 'longitude',
+ aliasedName,
+ true,
+ type: DriftSqlType.double,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> playbackStyle = GeneratedColumn<int>(
+ 'playback_style',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 0',
+ defaultValue: const CustomExpression('0'),
+ );
+ @override
+ List<GeneratedColumn> get $columns => [
+ name,
+ type,
+ createdAt,
+ updatedAt,
+ width,
+ height,
+ durationMs,
+ id,
+ checksum,
+ isFavorite,
+ orientation,
+ iCloudId,
+ adjustmentTime,
+ latitude,
+ longitude,
+ playbackStyle,
+ ];
+ @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.string,
+ data['${effectivePrefix}created_at'],
+ )!,
+ updatedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}updated_at'],
+ )!,
+ width: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}width'],
+ ),
+ height: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}height'],
+ ),
+ durationMs: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}duration_ms'],
+ ),
+ id: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}id'],
+ )!,
+ checksum: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}checksum'],
+ ),
+ isFavorite: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}is_favorite'],
+ )!,
+ orientation: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}orientation'],
+ )!,
+ iCloudId: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}i_cloud_id'],
+ ),
+ adjustmentTime: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}adjustment_time'],
+ ),
+ latitude: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}latitude'],
+ ),
+ longitude: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}longitude'],
+ ),
+ playbackStyle: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}playback_style'],
+ )!,
+ );
+ }
+
+ @override
+ LocalAssetEntity createAlias(String alias) {
+ return LocalAssetEntity(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class LocalAssetEntityData extends DataClass
+ implements Insertable<LocalAssetEntityData> {
+ final String name;
+ final int type;
+ final String createdAt;
+ final String updatedAt;
+ final int? width;
+ final int? height;
+ final int? durationMs;
+ final String id;
+ final String? checksum;
+ final int isFavorite;
+ final int orientation;
+ final String? iCloudId;
+ final String? adjustmentTime;
+ final double? latitude;
+ final double? longitude;
+ final int playbackStyle;
+ const LocalAssetEntityData({
+ required this.name,
+ required this.type,
+ required this.createdAt,
+ required this.updatedAt,
+ this.width,
+ this.height,
+ this.durationMs,
+ required this.id,
+ this.checksum,
+ required this.isFavorite,
+ required this.orientation,
+ this.iCloudId,
+ this.adjustmentTime,
+ this.latitude,
+ this.longitude,
+ required this.playbackStyle,
+ });
+ @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<String>(createdAt);
+ map['updated_at'] = Variable<String>(updatedAt);
+ if (!nullToAbsent || width != null) {
+ map['width'] = Variable<int>(width);
+ }
+ if (!nullToAbsent || height != null) {
+ map['height'] = Variable<int>(height);
+ }
+ if (!nullToAbsent || durationMs != null) {
+ map['duration_ms'] = Variable<int>(durationMs);
+ }
+ map['id'] = Variable<String>(id);
+ if (!nullToAbsent || checksum != null) {
+ map['checksum'] = Variable<String>(checksum);
+ }
+ map['is_favorite'] = Variable<int>(isFavorite);
+ map['orientation'] = Variable<int>(orientation);
+ if (!nullToAbsent || iCloudId != null) {
+ map['i_cloud_id'] = Variable<String>(iCloudId);
+ }
+ if (!nullToAbsent || adjustmentTime != null) {
+ map['adjustment_time'] = Variable<String>(adjustmentTime);
+ }
+ if (!nullToAbsent || latitude != null) {
+ map['latitude'] = Variable<double>(latitude);
+ }
+ if (!nullToAbsent || longitude != null) {
+ map['longitude'] = Variable<double>(longitude);
+ }
+ map['playback_style'] = Variable<int>(playbackStyle);
+ 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<String>(json['createdAt']),
+ updatedAt: serializer.fromJson<String>(json['updatedAt']),
+ width: serializer.fromJson<int?>(json['width']),
+ height: serializer.fromJson<int?>(json['height']),
+ durationMs: serializer.fromJson<int?>(json['durationMs']),
+ id: serializer.fromJson<String>(json['id']),
+ checksum: serializer.fromJson<String?>(json['checksum']),
+ isFavorite: serializer.fromJson<int>(json['isFavorite']),
+ orientation: serializer.fromJson<int>(json['orientation']),
+ iCloudId: serializer.fromJson<String?>(json['iCloudId']),
+ adjustmentTime: serializer.fromJson<String?>(json['adjustmentTime']),
+ latitude: serializer.fromJson<double?>(json['latitude']),
+ longitude: serializer.fromJson<double?>(json['longitude']),
+ playbackStyle: serializer.fromJson<int>(json['playbackStyle']),
+ );
+ }
+ @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<String>(createdAt),
+ 'updatedAt': serializer.toJson<String>(updatedAt),
+ 'width': serializer.toJson<int?>(width),
+ 'height': serializer.toJson<int?>(height),
+ 'durationMs': serializer.toJson<int?>(durationMs),
+ 'id': serializer.toJson<String>(id),
+ 'checksum': serializer.toJson<String?>(checksum),
+ 'isFavorite': serializer.toJson<int>(isFavorite),
+ 'orientation': serializer.toJson<int>(orientation),
+ 'iCloudId': serializer.toJson<String?>(iCloudId),
+ 'adjustmentTime': serializer.toJson<String?>(adjustmentTime),
+ 'latitude': serializer.toJson<double?>(latitude),
+ 'longitude': serializer.toJson<double?>(longitude),
+ 'playbackStyle': serializer.toJson<int>(playbackStyle),
+ };
+ }
+
+ LocalAssetEntityData copyWith({
+ String? name,
+ int? type,
+ String? createdAt,
+ String? updatedAt,
+ Value<int?> width = const Value.absent(),
+ Value<int?> height = const Value.absent(),
+ Value<int?> durationMs = const Value.absent(),
+ String? id,
+ Value<String?> checksum = const Value.absent(),
+ int? isFavorite,
+ int? orientation,
+ Value<String?> iCloudId = const Value.absent(),
+ Value<String?> adjustmentTime = const Value.absent(),
+ Value<double?> latitude = const Value.absent(),
+ Value<double?> longitude = const Value.absent(),
+ int? playbackStyle,
+ }) => 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,
+ durationMs: durationMs.present ? durationMs.value : this.durationMs,
+ id: id ?? this.id,
+ checksum: checksum.present ? checksum.value : this.checksum,
+ isFavorite: isFavorite ?? this.isFavorite,
+ orientation: orientation ?? this.orientation,
+ iCloudId: iCloudId.present ? iCloudId.value : this.iCloudId,
+ adjustmentTime: adjustmentTime.present
+ ? adjustmentTime.value
+ : this.adjustmentTime,
+ latitude: latitude.present ? latitude.value : this.latitude,
+ longitude: longitude.present ? longitude.value : this.longitude,
+ playbackStyle: playbackStyle ?? this.playbackStyle,
+ );
+ 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,
+ durationMs: data.durationMs.present
+ ? data.durationMs.value
+ : this.durationMs,
+ 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,
+ iCloudId: data.iCloudId.present ? data.iCloudId.value : this.iCloudId,
+ adjustmentTime: data.adjustmentTime.present
+ ? data.adjustmentTime.value
+ : this.adjustmentTime,
+ latitude: data.latitude.present ? data.latitude.value : this.latitude,
+ longitude: data.longitude.present ? data.longitude.value : this.longitude,
+ playbackStyle: data.playbackStyle.present
+ ? data.playbackStyle.value
+ : this.playbackStyle,
+ );
+ }
+
+ @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('durationMs: $durationMs, ')
+ ..write('id: $id, ')
+ ..write('checksum: $checksum, ')
+ ..write('isFavorite: $isFavorite, ')
+ ..write('orientation: $orientation, ')
+ ..write('iCloudId: $iCloudId, ')
+ ..write('adjustmentTime: $adjustmentTime, ')
+ ..write('latitude: $latitude, ')
+ ..write('longitude: $longitude, ')
+ ..write('playbackStyle: $playbackStyle')
+ ..write(')'))
+ .toString();
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ name,
+ type,
+ createdAt,
+ updatedAt,
+ width,
+ height,
+ durationMs,
+ id,
+ checksum,
+ isFavorite,
+ orientation,
+ iCloudId,
+ adjustmentTime,
+ latitude,
+ longitude,
+ playbackStyle,
+ );
+ @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.durationMs == this.durationMs &&
+ other.id == this.id &&
+ other.checksum == this.checksum &&
+ other.isFavorite == this.isFavorite &&
+ other.orientation == this.orientation &&
+ other.iCloudId == this.iCloudId &&
+ other.adjustmentTime == this.adjustmentTime &&
+ other.latitude == this.latitude &&
+ other.longitude == this.longitude &&
+ other.playbackStyle == this.playbackStyle);
+}
+
+class LocalAssetEntityCompanion extends UpdateCompanion<LocalAssetEntityData> {
+ final Value<String> name;
+ final Value<int> type;
+ final Value<String> createdAt;
+ final Value<String> updatedAt;
+ final Value<int?> width;
+ final Value<int?> height;
+ final Value<int?> durationMs;
+ final Value<String> id;
+ final Value<String?> checksum;
+ final Value<int> isFavorite;
+ final Value<int> orientation;
+ final Value<String?> iCloudId;
+ final Value<String?> adjustmentTime;
+ final Value<double?> latitude;
+ final Value<double?> longitude;
+ final Value<int> playbackStyle;
+ 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.durationMs = const Value.absent(),
+ this.id = const Value.absent(),
+ this.checksum = const Value.absent(),
+ this.isFavorite = const Value.absent(),
+ this.orientation = const Value.absent(),
+ this.iCloudId = const Value.absent(),
+ this.adjustmentTime = const Value.absent(),
+ this.latitude = const Value.absent(),
+ this.longitude = const Value.absent(),
+ this.playbackStyle = 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.durationMs = const Value.absent(),
+ required String id,
+ this.checksum = const Value.absent(),
+ this.isFavorite = const Value.absent(),
+ this.orientation = const Value.absent(),
+ this.iCloudId = const Value.absent(),
+ this.adjustmentTime = const Value.absent(),
+ this.latitude = const Value.absent(),
+ this.longitude = const Value.absent(),
+ this.playbackStyle = const Value.absent(),
+ }) : name = Value(name),
+ type = Value(type),
+ id = Value(id);
+ static Insertable<LocalAssetEntityData> custom({
+ Expression<String>? name,
+ Expression<int>? type,
+ Expression<String>? createdAt,
+ Expression<String>? updatedAt,
+ Expression<int>? width,
+ Expression<int>? height,
+ Expression<int>? durationMs,
+ Expression<String>? id,
+ Expression<String>? checksum,
+ Expression<int>? isFavorite,
+ Expression<int>? orientation,
+ Expression<String>? iCloudId,
+ Expression<String>? adjustmentTime,
+ Expression<double>? latitude,
+ Expression<double>? longitude,
+ Expression<int>? playbackStyle,
+ }) {
+ 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 (durationMs != null) 'duration_ms': durationMs,
+ if (id != null) 'id': id,
+ if (checksum != null) 'checksum': checksum,
+ if (isFavorite != null) 'is_favorite': isFavorite,
+ if (orientation != null) 'orientation': orientation,
+ if (iCloudId != null) 'i_cloud_id': iCloudId,
+ if (adjustmentTime != null) 'adjustment_time': adjustmentTime,
+ if (latitude != null) 'latitude': latitude,
+ if (longitude != null) 'longitude': longitude,
+ if (playbackStyle != null) 'playback_style': playbackStyle,
+ });
+ }
+
+ LocalAssetEntityCompanion copyWith({
+ Value<String>? name,
+ Value<int>? type,
+ Value<String>? createdAt,
+ Value<String>? updatedAt,
+ Value<int?>? width,
+ Value<int?>? height,
+ Value<int?>? durationMs,
+ Value<String>? id,
+ Value<String?>? checksum,
+ Value<int>? isFavorite,
+ Value<int>? orientation,
+ Value<String?>? iCloudId,
+ Value<String?>? adjustmentTime,
+ Value<double?>? latitude,
+ Value<double?>? longitude,
+ Value<int>? playbackStyle,
+ }) {
+ 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,
+ durationMs: durationMs ?? this.durationMs,
+ id: id ?? this.id,
+ checksum: checksum ?? this.checksum,
+ isFavorite: isFavorite ?? this.isFavorite,
+ orientation: orientation ?? this.orientation,
+ iCloudId: iCloudId ?? this.iCloudId,
+ adjustmentTime: adjustmentTime ?? this.adjustmentTime,
+ latitude: latitude ?? this.latitude,
+ longitude: longitude ?? this.longitude,
+ playbackStyle: playbackStyle ?? this.playbackStyle,
+ );
+ }
+
+ @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<String>(createdAt.value);
+ }
+ if (updatedAt.present) {
+ map['updated_at'] = Variable<String>(updatedAt.value);
+ }
+ if (width.present) {
+ map['width'] = Variable<int>(width.value);
+ }
+ if (height.present) {
+ map['height'] = Variable<int>(height.value);
+ }
+ if (durationMs.present) {
+ map['duration_ms'] = Variable<int>(durationMs.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<int>(isFavorite.value);
+ }
+ if (orientation.present) {
+ map['orientation'] = Variable<int>(orientation.value);
+ }
+ if (iCloudId.present) {
+ map['i_cloud_id'] = Variable<String>(iCloudId.value);
+ }
+ if (adjustmentTime.present) {
+ map['adjustment_time'] = Variable<String>(adjustmentTime.value);
+ }
+ if (latitude.present) {
+ map['latitude'] = Variable<double>(latitude.value);
+ }
+ if (longitude.present) {
+ map['longitude'] = Variable<double>(longitude.value);
+ }
+ if (playbackStyle.present) {
+ map['playback_style'] = Variable<int>(playbackStyle.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('durationMs: $durationMs, ')
+ ..write('id: $id, ')
+ ..write('checksum: $checksum, ')
+ ..write('isFavorite: $isFavorite, ')
+ ..write('orientation: $orientation, ')
+ ..write('iCloudId: $iCloudId, ')
+ ..write('adjustmentTime: $adjustmentTime, ')
+ ..write('latitude: $latitude, ')
+ ..write('longitude: $longitude, ')
+ ..write('playbackStyle: $playbackStyle')
+ ..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,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> name = GeneratedColumn<String>(
+ 'name',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> description = GeneratedColumn<String>(
+ 'description',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT \'\'',
+ defaultValue: const CustomExpression('\'\''),
+ );
+ late final GeneratedColumn<String> createdAt = GeneratedColumn<String>(
+ 'created_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
+ 'updated_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<String> thumbnailAssetId = GeneratedColumn<String>(
+ 'thumbnail_asset_id',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints:
+ 'NULL REFERENCES remote_asset_entity(id)ON DELETE SET NULL',
+ );
+ late final GeneratedColumn<int> isActivityEnabled = GeneratedColumn<int>(
+ 'is_activity_enabled',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints:
+ 'NOT NULL DEFAULT 1 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,
+ $customConstraints: 'NOT NULL',
+ );
+ @override
+ List<GeneratedColumn> get $columns => [
+ id,
+ name,
+ description,
+ createdAt,
+ updatedAt,
+ 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.string,
+ data['${effectivePrefix}created_at'],
+ )!,
+ updatedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}updated_at'],
+ )!,
+ thumbnailAssetId: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}thumbnail_asset_id'],
+ ),
+ isActivityEnabled: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ 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;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class RemoteAlbumEntityData extends DataClass
+ implements Insertable<RemoteAlbumEntityData> {
+ final String id;
+ final String name;
+ final String description;
+ final String createdAt;
+ final String updatedAt;
+ final String? thumbnailAssetId;
+ final int isActivityEnabled;
+ final int order;
+ const RemoteAlbumEntityData({
+ required this.id,
+ required this.name,
+ required this.description,
+ required this.createdAt,
+ required this.updatedAt,
+ 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<String>(createdAt);
+ map['updated_at'] = Variable<String>(updatedAt);
+ if (!nullToAbsent || thumbnailAssetId != null) {
+ map['thumbnail_asset_id'] = Variable<String>(thumbnailAssetId);
+ }
+ map['is_activity_enabled'] = Variable<int>(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<String>(json['createdAt']),
+ updatedAt: serializer.fromJson<String>(json['updatedAt']),
+ thumbnailAssetId: serializer.fromJson<String?>(json['thumbnailAssetId']),
+ isActivityEnabled: serializer.fromJson<int>(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<String>(createdAt),
+ 'updatedAt': serializer.toJson<String>(updatedAt),
+ 'thumbnailAssetId': serializer.toJson<String?>(thumbnailAssetId),
+ 'isActivityEnabled': serializer.toJson<int>(isActivityEnabled),
+ 'order': serializer.toJson<int>(order),
+ };
+ }
+
+ RemoteAlbumEntityData copyWith({
+ String? id,
+ String? name,
+ String? description,
+ String? createdAt,
+ String? updatedAt,
+ Value<String?> thumbnailAssetId = const Value.absent(),
+ int? isActivityEnabled,
+ int? order,
+ }) => RemoteAlbumEntityData(
+ id: id ?? this.id,
+ name: name ?? this.name,
+ description: description ?? this.description,
+ createdAt: createdAt ?? this.createdAt,
+ updatedAt: updatedAt ?? this.updatedAt,
+ 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,
+ 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('thumbnailAssetId: $thumbnailAssetId, ')
+ ..write('isActivityEnabled: $isActivityEnabled, ')
+ ..write('order: $order')
+ ..write(')'))
+ .toString();
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ id,
+ name,
+ description,
+ createdAt,
+ updatedAt,
+ 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.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<String> createdAt;
+ final Value<String> updatedAt;
+ final Value<String?> thumbnailAssetId;
+ final Value<int> 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.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(),
+ this.thumbnailAssetId = const Value.absent(),
+ this.isActivityEnabled = const Value.absent(),
+ required int order,
+ }) : id = Value(id),
+ name = Value(name),
+ order = Value(order);
+ static Insertable<RemoteAlbumEntityData> custom({
+ Expression<String>? id,
+ Expression<String>? name,
+ Expression<String>? description,
+ Expression<String>? createdAt,
+ Expression<String>? updatedAt,
+ Expression<String>? thumbnailAssetId,
+ Expression<int>? 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 (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<String>? createdAt,
+ Value<String>? updatedAt,
+ Value<String?>? thumbnailAssetId,
+ Value<int>? 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,
+ 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<String>(createdAt.value);
+ }
+ if (updatedAt.present) {
+ map['updated_at'] = Variable<String>(updatedAt.value);
+ }
+ if (thumbnailAssetId.present) {
+ map['thumbnail_asset_id'] = Variable<String>(thumbnailAssetId.value);
+ }
+ if (isActivityEnabled.present) {
+ map['is_activity_enabled'] = Variable<int>(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('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,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> name = GeneratedColumn<String>(
+ 'name',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
+ 'updated_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<int> backupSelection = GeneratedColumn<int>(
+ 'backup_selection',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> isIosSharedAlbum = GeneratedColumn<int>(
+ 'is_ios_shared_album',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints:
+ 'NOT NULL DEFAULT 0 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,
+ $customConstraints:
+ 'NULL REFERENCES remote_album_entity(id)ON DELETE SET NULL',
+ );
+ late final GeneratedColumn<int> marker = GeneratedColumn<int>(
+ 'marker',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL 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.string,
+ data['${effectivePrefix}updated_at'],
+ )!,
+ backupSelection: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}backup_selection'],
+ )!,
+ isIosSharedAlbum: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}is_ios_shared_album'],
+ )!,
+ linkedRemoteAlbumId: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}linked_remote_album_id'],
+ ),
+ marker: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}marker'],
+ ),
+ );
+ }
+
+ @override
+ LocalAlbumEntity createAlias(String alias) {
+ return LocalAlbumEntity(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class LocalAlbumEntityData extends DataClass
+ implements Insertable<LocalAlbumEntityData> {
+ final String id;
+ final String name;
+ final String updatedAt;
+ final int backupSelection;
+ final int isIosSharedAlbum;
+ final String? linkedRemoteAlbumId;
+ final int? 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<String>(updatedAt);
+ map['backup_selection'] = Variable<int>(backupSelection);
+ map['is_ios_shared_album'] = Variable<int>(isIosSharedAlbum);
+ if (!nullToAbsent || linkedRemoteAlbumId != null) {
+ map['linked_remote_album_id'] = Variable<String>(linkedRemoteAlbumId);
+ }
+ if (!nullToAbsent || marker != null) {
+ map['marker'] = Variable<int>(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<String>(json['updatedAt']),
+ backupSelection: serializer.fromJson<int>(json['backupSelection']),
+ isIosSharedAlbum: serializer.fromJson<int>(json['isIosSharedAlbum']),
+ linkedRemoteAlbumId: serializer.fromJson<String?>(
+ json['linkedRemoteAlbumId'],
+ ),
+ marker: serializer.fromJson<int?>(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<String>(updatedAt),
+ 'backupSelection': serializer.toJson<int>(backupSelection),
+ 'isIosSharedAlbum': serializer.toJson<int>(isIosSharedAlbum),
+ 'linkedRemoteAlbumId': serializer.toJson<String?>(linkedRemoteAlbumId),
+ 'marker': serializer.toJson<int?>(marker),
+ };
+ }
+
+ LocalAlbumEntityData copyWith({
+ String? id,
+ String? name,
+ String? updatedAt,
+ int? backupSelection,
+ int? isIosSharedAlbum,
+ Value<String?> linkedRemoteAlbumId = const Value.absent(),
+ Value<int?> 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<String> updatedAt;
+ final Value<int> backupSelection;
+ final Value<int> isIosSharedAlbum;
+ final Value<String?> linkedRemoteAlbumId;
+ final Value<int?> 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<String>? updatedAt,
+ Expression<int>? backupSelection,
+ Expression<int>? isIosSharedAlbum,
+ Expression<String>? linkedRemoteAlbumId,
+ Expression<int>? 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<String>? updatedAt,
+ Value<int>? backupSelection,
+ Value<int>? isIosSharedAlbum,
+ Value<String?>? linkedRemoteAlbumId,
+ Value<int?>? 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<String>(updatedAt.value);
+ }
+ if (backupSelection.present) {
+ map['backup_selection'] = Variable<int>(backupSelection.value);
+ }
+ if (isIosSharedAlbum.present) {
+ map['is_ios_shared_album'] = Variable<int>(isIosSharedAlbum.value);
+ }
+ if (linkedRemoteAlbumId.present) {
+ map['linked_remote_album_id'] = Variable<String>(
+ linkedRemoteAlbumId.value,
+ );
+ }
+ if (marker.present) {
+ map['marker'] = Variable<int>(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,
+ $customConstraints:
+ 'NOT NULL REFERENCES local_asset_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<String> albumId = GeneratedColumn<String>(
+ 'album_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints:
+ 'NOT NULL REFERENCES local_album_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<int> marker = GeneratedColumn<int>(
+ 'marker',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL 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.int,
+ data['${effectivePrefix}marker'],
+ ),
+ );
+ }
+
+ @override
+ LocalAlbumAssetEntity createAlias(String alias) {
+ return LocalAlbumAssetEntity(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+ @override
+ List<String> get customConstraints => const [
+ 'PRIMARY KEY(asset_id, album_id)',
+ ];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class LocalAlbumAssetEntityData extends DataClass
+ implements Insertable<LocalAlbumAssetEntityData> {
+ final String assetId;
+ final String albumId;
+ final int? 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<int>(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<int?>(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<int?>(marker),
+ };
+ }
+
+ LocalAlbumAssetEntityData copyWith({
+ String? assetId,
+ String? albumId,
+ Value<int?> 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<int?> 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<int>? 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<int?>? 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<int>(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,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> name = GeneratedColumn<String>(
+ 'name',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> email = GeneratedColumn<String>(
+ 'email',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> isAdmin = GeneratedColumn<int>(
+ 'is_admin',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 0 CHECK (is_admin IN (0, 1))',
+ defaultValue: const CustomExpression('0'),
+ );
+ late final GeneratedColumn<int> hasProfileImage = GeneratedColumn<int>(
+ 'has_profile_image',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints:
+ 'NOT NULL DEFAULT 0 CHECK (has_profile_image IN (0, 1))',
+ defaultValue: const CustomExpression('0'),
+ );
+ late final GeneratedColumn<String> profileChangedAt = GeneratedColumn<String>(
+ 'profile_changed_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<int> avatarColor = GeneratedColumn<int>(
+ 'avatar_color',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> quotaSizeInBytes = GeneratedColumn<int>(
+ 'quota_size_in_bytes',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 0',
+ defaultValue: const CustomExpression('0'),
+ );
+ late final GeneratedColumn<int> quotaUsageInBytes = GeneratedColumn<int>(
+ 'quota_usage_in_bytes',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 0',
+ defaultValue: const CustomExpression('0'),
+ );
+ late final GeneratedColumn<String> pinCode = GeneratedColumn<String>(
+ 'pin_code',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ @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.int,
+ data['${effectivePrefix}is_admin'],
+ )!,
+ hasProfileImage: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}has_profile_image'],
+ )!,
+ profileChangedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ 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;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class AuthUserEntityData extends DataClass
+ implements Insertable<AuthUserEntityData> {
+ final String id;
+ final String name;
+ final String email;
+ final int isAdmin;
+ final int hasProfileImage;
+ final String 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<int>(isAdmin);
+ map['has_profile_image'] = Variable<int>(hasProfileImage);
+ map['profile_changed_at'] = Variable<String>(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<int>(json['isAdmin']),
+ hasProfileImage: serializer.fromJson<int>(json['hasProfileImage']),
+ profileChangedAt: serializer.fromJson<String>(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<int>(isAdmin),
+ 'hasProfileImage': serializer.toJson<int>(hasProfileImage),
+ 'profileChangedAt': serializer.toJson<String>(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,
+ int? isAdmin,
+ int? hasProfileImage,
+ String? 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<int> isAdmin;
+ final Value<int> hasProfileImage;
+ final Value<String> 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<int>? isAdmin,
+ Expression<int>? hasProfileImage,
+ Expression<String>? 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<int>? isAdmin,
+ Value<int>? hasProfileImage,
+ Value<String>? 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<int>(isAdmin.value);
+ }
+ if (hasProfileImage.present) {
+ map['has_profile_image'] = Variable<int>(hasProfileImage.value);
+ }
+ if (profileChangedAt.present) {
+ map['profile_changed_at'] = Variable<String>(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,
+ $customConstraints: 'NOT NULL REFERENCES user_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<int> key = GeneratedColumn<int>(
+ 'key',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<i2.Uint8List> value =
+ GeneratedColumn<i2.Uint8List>(
+ 'value',
+ aliasedName,
+ false,
+ type: DriftSqlType.blob,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ @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;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(user_id, "key")'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class UserMetadataEntityData extends DataClass
+ implements Insertable<UserMetadataEntityData> {
+ final String userId;
+ final int key;
+ final i2.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<i2.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<i2.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<i2.Uint8List>(value),
+ };
+ }
+
+ UserMetadataEntityData copyWith({
+ String? userId,
+ int? key,
+ i2.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<i2.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 i2.Uint8List value,
+ }) : userId = Value(userId),
+ key = Value(key),
+ value = Value(value);
+ static Insertable<UserMetadataEntityData> custom({
+ Expression<String>? userId,
+ Expression<int>? key,
+ Expression<i2.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<i2.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<i2.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,
+ $customConstraints: 'NOT NULL REFERENCES user_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<String> sharedWithId = GeneratedColumn<String>(
+ 'shared_with_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL REFERENCES user_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<int> inTimeline = GeneratedColumn<int>(
+ 'in_timeline',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 0 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.int,
+ data['${effectivePrefix}in_timeline'],
+ )!,
+ );
+ }
+
+ @override
+ PartnerEntity createAlias(String alias) {
+ return PartnerEntity(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+ @override
+ List<String> get customConstraints => const [
+ 'PRIMARY KEY(shared_by_id, shared_with_id)',
+ ];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class PartnerEntityData extends DataClass
+ implements Insertable<PartnerEntityData> {
+ final String sharedById;
+ final String sharedWithId;
+ final int 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<int>(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<int>(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<int>(inTimeline),
+ };
+ }
+
+ PartnerEntityData copyWith({
+ String? sharedById,
+ String? sharedWithId,
+ int? 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<int> 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<int>? 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<int>? 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<int>(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,
+ $customConstraints:
+ 'NOT NULL REFERENCES remote_asset_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<String> city = GeneratedColumn<String>(
+ 'city',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> state = GeneratedColumn<String>(
+ 'state',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> country = GeneratedColumn<String>(
+ 'country',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> dateTimeOriginal = GeneratedColumn<String>(
+ 'date_time_original',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> description = GeneratedColumn<String>(
+ 'description',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> height = GeneratedColumn<int>(
+ 'height',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> width = GeneratedColumn<int>(
+ 'width',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> exposureTime = GeneratedColumn<String>(
+ 'exposure_time',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<double> fNumber = GeneratedColumn<double>(
+ 'f_number',
+ aliasedName,
+ true,
+ type: DriftSqlType.double,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> fileSize = GeneratedColumn<int>(
+ 'file_size',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<double> focalLength = GeneratedColumn<double>(
+ 'focal_length',
+ aliasedName,
+ true,
+ type: DriftSqlType.double,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<double> latitude = GeneratedColumn<double>(
+ 'latitude',
+ aliasedName,
+ true,
+ type: DriftSqlType.double,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<double> longitude = GeneratedColumn<double>(
+ 'longitude',
+ aliasedName,
+ true,
+ type: DriftSqlType.double,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> iso = GeneratedColumn<int>(
+ 'iso',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> make = GeneratedColumn<String>(
+ 'make',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> model = GeneratedColumn<String>(
+ 'model',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> lens = GeneratedColumn<String>(
+ 'lens',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> orientation = GeneratedColumn<String>(
+ 'orientation',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> timeZone = GeneratedColumn<String>(
+ 'time_zone',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> rating = GeneratedColumn<int>(
+ 'rating',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> projectionType = GeneratedColumn<String>(
+ 'projection_type',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ @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.string,
+ 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;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(asset_id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class RemoteExifEntityData extends DataClass
+ implements Insertable<RemoteExifEntityData> {
+ final String assetId;
+ final String? city;
+ final String? state;
+ final String? country;
+ final String? 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<String>(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<String?>(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<String?>(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<String?> 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<String?> 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<String>? 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<String?>? 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<String>(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,
+ $customConstraints:
+ 'NOT NULL REFERENCES remote_asset_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<String> albumId = GeneratedColumn<String>(
+ 'album_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints:
+ 'NOT NULL 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;
+ @override
+ List<String> get customConstraints => const [
+ 'PRIMARY KEY(asset_id, album_id)',
+ ];
+ @override
+ bool get dontWriteConstraints => 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,
+ $customConstraints:
+ 'NOT NULL REFERENCES remote_album_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<String> userId = GeneratedColumn<String>(
+ 'user_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL REFERENCES user_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<int> role = GeneratedColumn<int>(
+ 'role',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ @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;
+ @override
+ List<String> get customConstraints => const [
+ 'PRIMARY KEY(album_id, user_id)',
+ ];
+ @override
+ bool get dontWriteConstraints => 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 RemoteAssetCloudIdEntity extends Table
+ with TableInfo<RemoteAssetCloudIdEntity, RemoteAssetCloudIdEntityData> {
+ @override
+ final GeneratedDatabase attachedDatabase;
+ final String? _alias;
+ RemoteAssetCloudIdEntity(this.attachedDatabase, [this._alias]);
+ late final GeneratedColumn<String> assetId = GeneratedColumn<String>(
+ 'asset_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints:
+ 'NOT NULL REFERENCES remote_asset_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<String> cloudId = GeneratedColumn<String>(
+ 'cloud_id',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> createdAt = GeneratedColumn<String>(
+ 'created_at',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> adjustmentTime = GeneratedColumn<String>(
+ 'adjustment_time',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<double> latitude = GeneratedColumn<double>(
+ 'latitude',
+ aliasedName,
+ true,
+ type: DriftSqlType.double,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<double> longitude = GeneratedColumn<double>(
+ 'longitude',
+ aliasedName,
+ true,
+ type: DriftSqlType.double,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ @override
+ List<GeneratedColumn> get $columns => [
+ assetId,
+ cloudId,
+ createdAt,
+ adjustmentTime,
+ latitude,
+ longitude,
+ ];
+ @override
+ String get aliasedName => _alias ?? actualTableName;
+ @override
+ String get actualTableName => $name;
+ static const String $name = 'remote_asset_cloud_id_entity';
+ @override
+ Set<GeneratedColumn> get $primaryKey => {assetId};
+ @override
+ RemoteAssetCloudIdEntityData map(
+ Map<String, dynamic> data, {
+ String? tablePrefix,
+ }) {
+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
+ return RemoteAssetCloudIdEntityData(
+ assetId: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}asset_id'],
+ )!,
+ cloudId: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}cloud_id'],
+ ),
+ createdAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}created_at'],
+ ),
+ adjustmentTime: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}adjustment_time'],
+ ),
+ latitude: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}latitude'],
+ ),
+ longitude: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}longitude'],
+ ),
+ );
+ }
+
+ @override
+ RemoteAssetCloudIdEntity createAlias(String alias) {
+ return RemoteAssetCloudIdEntity(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(asset_id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class RemoteAssetCloudIdEntityData extends DataClass
+ implements Insertable<RemoteAssetCloudIdEntityData> {
+ final String assetId;
+ final String? cloudId;
+ final String? createdAt;
+ final String? adjustmentTime;
+ final double? latitude;
+ final double? longitude;
+ const RemoteAssetCloudIdEntityData({
+ required this.assetId,
+ this.cloudId,
+ this.createdAt,
+ this.adjustmentTime,
+ this.latitude,
+ this.longitude,
+ });
+ @override
+ Map<String, Expression> toColumns(bool nullToAbsent) {
+ final map = <String, Expression>{};
+ map['asset_id'] = Variable<String>(assetId);
+ if (!nullToAbsent || cloudId != null) {
+ map['cloud_id'] = Variable<String>(cloudId);
+ }
+ if (!nullToAbsent || createdAt != null) {
+ map['created_at'] = Variable<String>(createdAt);
+ }
+ if (!nullToAbsent || adjustmentTime != null) {
+ map['adjustment_time'] = Variable<String>(adjustmentTime);
+ }
+ if (!nullToAbsent || latitude != null) {
+ map['latitude'] = Variable<double>(latitude);
+ }
+ if (!nullToAbsent || longitude != null) {
+ map['longitude'] = Variable<double>(longitude);
+ }
+ return map;
+ }
+
+ factory RemoteAssetCloudIdEntityData.fromJson(
+ Map<String, dynamic> json, {
+ ValueSerializer? serializer,
+ }) {
+ serializer ??= driftRuntimeOptions.defaultSerializer;
+ return RemoteAssetCloudIdEntityData(
+ assetId: serializer.fromJson<String>(json['assetId']),
+ cloudId: serializer.fromJson<String?>(json['cloudId']),
+ createdAt: serializer.fromJson<String?>(json['createdAt']),
+ adjustmentTime: serializer.fromJson<String?>(json['adjustmentTime']),
+ latitude: serializer.fromJson<double?>(json['latitude']),
+ longitude: serializer.fromJson<double?>(json['longitude']),
+ );
+ }
+ @override
+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {
+ serializer ??= driftRuntimeOptions.defaultSerializer;
+ return <String, dynamic>{
+ 'assetId': serializer.toJson<String>(assetId),
+ 'cloudId': serializer.toJson<String?>(cloudId),
+ 'createdAt': serializer.toJson<String?>(createdAt),
+ 'adjustmentTime': serializer.toJson<String?>(adjustmentTime),
+ 'latitude': serializer.toJson<double?>(latitude),
+ 'longitude': serializer.toJson<double?>(longitude),
+ };
+ }
+
+ RemoteAssetCloudIdEntityData copyWith({
+ String? assetId,
+ Value<String?> cloudId = const Value.absent(),
+ Value<String?> createdAt = const Value.absent(),
+ Value<String?> adjustmentTime = const Value.absent(),
+ Value<double?> latitude = const Value.absent(),
+ Value<double?> longitude = const Value.absent(),
+ }) => RemoteAssetCloudIdEntityData(
+ assetId: assetId ?? this.assetId,
+ cloudId: cloudId.present ? cloudId.value : this.cloudId,
+ createdAt: createdAt.present ? createdAt.value : this.createdAt,
+ adjustmentTime: adjustmentTime.present
+ ? adjustmentTime.value
+ : this.adjustmentTime,
+ latitude: latitude.present ? latitude.value : this.latitude,
+ longitude: longitude.present ? longitude.value : this.longitude,
+ );
+ RemoteAssetCloudIdEntityData copyWithCompanion(
+ RemoteAssetCloudIdEntityCompanion data,
+ ) {
+ return RemoteAssetCloudIdEntityData(
+ assetId: data.assetId.present ? data.assetId.value : this.assetId,
+ cloudId: data.cloudId.present ? data.cloudId.value : this.cloudId,
+ createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
+ adjustmentTime: data.adjustmentTime.present
+ ? data.adjustmentTime.value
+ : this.adjustmentTime,
+ latitude: data.latitude.present ? data.latitude.value : this.latitude,
+ longitude: data.longitude.present ? data.longitude.value : this.longitude,
+ );
+ }
+
+ @override
+ String toString() {
+ return (StringBuffer('RemoteAssetCloudIdEntityData(')
+ ..write('assetId: $assetId, ')
+ ..write('cloudId: $cloudId, ')
+ ..write('createdAt: $createdAt, ')
+ ..write('adjustmentTime: $adjustmentTime, ')
+ ..write('latitude: $latitude, ')
+ ..write('longitude: $longitude')
+ ..write(')'))
+ .toString();
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ assetId,
+ cloudId,
+ createdAt,
+ adjustmentTime,
+ latitude,
+ longitude,
+ );
+ @override
+ bool operator ==(Object other) =>
+ identical(this, other) ||
+ (other is RemoteAssetCloudIdEntityData &&
+ other.assetId == this.assetId &&
+ other.cloudId == this.cloudId &&
+ other.createdAt == this.createdAt &&
+ other.adjustmentTime == this.adjustmentTime &&
+ other.latitude == this.latitude &&
+ other.longitude == this.longitude);
+}
+
+class RemoteAssetCloudIdEntityCompanion
+ extends UpdateCompanion<RemoteAssetCloudIdEntityData> {
+ final Value<String> assetId;
+ final Value<String?> cloudId;
+ final Value<String?> createdAt;
+ final Value<String?> adjustmentTime;
+ final Value<double?> latitude;
+ final Value<double?> longitude;
+ const RemoteAssetCloudIdEntityCompanion({
+ this.assetId = const Value.absent(),
+ this.cloudId = const Value.absent(),
+ this.createdAt = const Value.absent(),
+ this.adjustmentTime = const Value.absent(),
+ this.latitude = const Value.absent(),
+ this.longitude = const Value.absent(),
+ });
+ RemoteAssetCloudIdEntityCompanion.insert({
+ required String assetId,
+ this.cloudId = const Value.absent(),
+ this.createdAt = const Value.absent(),
+ this.adjustmentTime = const Value.absent(),
+ this.latitude = const Value.absent(),
+ this.longitude = const Value.absent(),
+ }) : assetId = Value(assetId);
+ static Insertable<RemoteAssetCloudIdEntityData> custom({
+ Expression<String>? assetId,
+ Expression<String>? cloudId,
+ Expression<String>? createdAt,
+ Expression<String>? adjustmentTime,
+ Expression<double>? latitude,
+ Expression<double>? longitude,
+ }) {
+ return RawValuesInsertable({
+ if (assetId != null) 'asset_id': assetId,
+ if (cloudId != null) 'cloud_id': cloudId,
+ if (createdAt != null) 'created_at': createdAt,
+ if (adjustmentTime != null) 'adjustment_time': adjustmentTime,
+ if (latitude != null) 'latitude': latitude,
+ if (longitude != null) 'longitude': longitude,
+ });
+ }
+
+ RemoteAssetCloudIdEntityCompanion copyWith({
+ Value<String>? assetId,
+ Value<String?>? cloudId,
+ Value<String?>? createdAt,
+ Value<String?>? adjustmentTime,
+ Value<double?>? latitude,
+ Value<double?>? longitude,
+ }) {
+ return RemoteAssetCloudIdEntityCompanion(
+ assetId: assetId ?? this.assetId,
+ cloudId: cloudId ?? this.cloudId,
+ createdAt: createdAt ?? this.createdAt,
+ adjustmentTime: adjustmentTime ?? this.adjustmentTime,
+ latitude: latitude ?? this.latitude,
+ longitude: longitude ?? this.longitude,
+ );
+ }
+
+ @override
+ Map<String, Expression> toColumns(bool nullToAbsent) {
+ final map = <String, Expression>{};
+ if (assetId.present) {
+ map['asset_id'] = Variable<String>(assetId.value);
+ }
+ if (cloudId.present) {
+ map['cloud_id'] = Variable<String>(cloudId.value);
+ }
+ if (createdAt.present) {
+ map['created_at'] = Variable<String>(createdAt.value);
+ }
+ if (adjustmentTime.present) {
+ map['adjustment_time'] = Variable<String>(adjustmentTime.value);
+ }
+ if (latitude.present) {
+ map['latitude'] = Variable<double>(latitude.value);
+ }
+ if (longitude.present) {
+ map['longitude'] = Variable<double>(longitude.value);
+ }
+ return map;
+ }
+
+ @override
+ String toString() {
+ return (StringBuffer('RemoteAssetCloudIdEntityCompanion(')
+ ..write('assetId: $assetId, ')
+ ..write('cloudId: $cloudId, ')
+ ..write('createdAt: $createdAt, ')
+ ..write('adjustmentTime: $adjustmentTime, ')
+ ..write('latitude: $latitude, ')
+ ..write('longitude: $longitude')
+ ..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,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> createdAt = GeneratedColumn<String>(
+ 'created_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
+ 'updated_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<String> deletedAt = GeneratedColumn<String>(
+ 'deleted_at',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> ownerId = GeneratedColumn<String>(
+ 'owner_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL REFERENCES user_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<int> type = GeneratedColumn<int>(
+ 'type',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> data = GeneratedColumn<String>(
+ 'data',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> isSaved = GeneratedColumn<int>(
+ 'is_saved',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 0 CHECK (is_saved IN (0, 1))',
+ defaultValue: const CustomExpression('0'),
+ );
+ late final GeneratedColumn<String> memoryAt = GeneratedColumn<String>(
+ 'memory_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> seenAt = GeneratedColumn<String>(
+ 'seen_at',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> showAt = GeneratedColumn<String>(
+ 'show_at',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> hideAt = GeneratedColumn<String>(
+ 'hide_at',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ @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.string,
+ data['${effectivePrefix}created_at'],
+ )!,
+ updatedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}updated_at'],
+ )!,
+ deletedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ 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.int,
+ data['${effectivePrefix}is_saved'],
+ )!,
+ memoryAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}memory_at'],
+ )!,
+ seenAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}seen_at'],
+ ),
+ showAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}show_at'],
+ ),
+ hideAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}hide_at'],
+ ),
+ );
+ }
+
+ @override
+ MemoryEntity createAlias(String alias) {
+ return MemoryEntity(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class MemoryEntityData extends DataClass
+ implements Insertable<MemoryEntityData> {
+ final String id;
+ final String createdAt;
+ final String updatedAt;
+ final String? deletedAt;
+ final String ownerId;
+ final int type;
+ final String data;
+ final int isSaved;
+ final String memoryAt;
+ final String? seenAt;
+ final String? showAt;
+ final String? 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<String>(createdAt);
+ map['updated_at'] = Variable<String>(updatedAt);
+ if (!nullToAbsent || deletedAt != null) {
+ map['deleted_at'] = Variable<String>(deletedAt);
+ }
+ map['owner_id'] = Variable<String>(ownerId);
+ map['type'] = Variable<int>(type);
+ map['data'] = Variable<String>(data);
+ map['is_saved'] = Variable<int>(isSaved);
+ map['memory_at'] = Variable<String>(memoryAt);
+ if (!nullToAbsent || seenAt != null) {
+ map['seen_at'] = Variable<String>(seenAt);
+ }
+ if (!nullToAbsent || showAt != null) {
+ map['show_at'] = Variable<String>(showAt);
+ }
+ if (!nullToAbsent || hideAt != null) {
+ map['hide_at'] = Variable<String>(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<String>(json['createdAt']),
+ updatedAt: serializer.fromJson<String>(json['updatedAt']),
+ deletedAt: serializer.fromJson<String?>(json['deletedAt']),
+ ownerId: serializer.fromJson<String>(json['ownerId']),
+ type: serializer.fromJson<int>(json['type']),
+ data: serializer.fromJson<String>(json['data']),
+ isSaved: serializer.fromJson<int>(json['isSaved']),
+ memoryAt: serializer.fromJson<String>(json['memoryAt']),
+ seenAt: serializer.fromJson<String?>(json['seenAt']),
+ showAt: serializer.fromJson<String?>(json['showAt']),
+ hideAt: serializer.fromJson<String?>(json['hideAt']),
+ );
+ }
+ @override
+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {
+ serializer ??= driftRuntimeOptions.defaultSerializer;
+ return <String, dynamic>{
+ 'id': serializer.toJson<String>(id),
+ 'createdAt': serializer.toJson<String>(createdAt),
+ 'updatedAt': serializer.toJson<String>(updatedAt),
+ 'deletedAt': serializer.toJson<String?>(deletedAt),
+ 'ownerId': serializer.toJson<String>(ownerId),
+ 'type': serializer.toJson<int>(type),
+ 'data': serializer.toJson<String>(data),
+ 'isSaved': serializer.toJson<int>(isSaved),
+ 'memoryAt': serializer.toJson<String>(memoryAt),
+ 'seenAt': serializer.toJson<String?>(seenAt),
+ 'showAt': serializer.toJson<String?>(showAt),
+ 'hideAt': serializer.toJson<String?>(hideAt),
+ };
+ }
+
+ MemoryEntityData copyWith({
+ String? id,
+ String? createdAt,
+ String? updatedAt,
+ Value<String?> deletedAt = const Value.absent(),
+ String? ownerId,
+ int? type,
+ String? data,
+ int? isSaved,
+ String? memoryAt,
+ Value<String?> seenAt = const Value.absent(),
+ Value<String?> showAt = const Value.absent(),
+ Value<String?> 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<String> createdAt;
+ final Value<String> updatedAt;
+ final Value<String?> deletedAt;
+ final Value<String> ownerId;
+ final Value<int> type;
+ final Value<String> data;
+ final Value<int> isSaved;
+ final Value<String> memoryAt;
+ final Value<String?> seenAt;
+ final Value<String?> showAt;
+ final Value<String?> 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 String 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<String>? createdAt,
+ Expression<String>? updatedAt,
+ Expression<String>? deletedAt,
+ Expression<String>? ownerId,
+ Expression<int>? type,
+ Expression<String>? data,
+ Expression<int>? isSaved,
+ Expression<String>? memoryAt,
+ Expression<String>? seenAt,
+ Expression<String>? showAt,
+ Expression<String>? 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<String>? createdAt,
+ Value<String>? updatedAt,
+ Value<String?>? deletedAt,
+ Value<String>? ownerId,
+ Value<int>? type,
+ Value<String>? data,
+ Value<int>? isSaved,
+ Value<String>? memoryAt,
+ Value<String?>? seenAt,
+ Value<String?>? showAt,
+ Value<String?>? 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<String>(createdAt.value);
+ }
+ if (updatedAt.present) {
+ map['updated_at'] = Variable<String>(updatedAt.value);
+ }
+ if (deletedAt.present) {
+ map['deleted_at'] = Variable<String>(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<int>(isSaved.value);
+ }
+ if (memoryAt.present) {
+ map['memory_at'] = Variable<String>(memoryAt.value);
+ }
+ if (seenAt.present) {
+ map['seen_at'] = Variable<String>(seenAt.value);
+ }
+ if (showAt.present) {
+ map['show_at'] = Variable<String>(showAt.value);
+ }
+ if (hideAt.present) {
+ map['hide_at'] = Variable<String>(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,
+ $customConstraints:
+ 'NOT NULL REFERENCES remote_asset_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<String> memoryId = GeneratedColumn<String>(
+ 'memory_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints:
+ 'NOT NULL 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;
+ @override
+ List<String> get customConstraints => const [
+ 'PRIMARY KEY(asset_id, memory_id)',
+ ];
+ @override
+ bool get dontWriteConstraints => 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,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> createdAt = GeneratedColumn<String>(
+ 'created_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
+ 'updated_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<String> ownerId = GeneratedColumn<String>(
+ 'owner_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL REFERENCES user_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<String> name = GeneratedColumn<String>(
+ 'name',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> faceAssetId = GeneratedColumn<String>(
+ 'face_asset_id',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> isFavorite = GeneratedColumn<int>(
+ 'is_favorite',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL CHECK (is_favorite IN (0, 1))',
+ );
+ late final GeneratedColumn<int> isHidden = GeneratedColumn<int>(
+ 'is_hidden',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL CHECK (is_hidden IN (0, 1))',
+ );
+ late final GeneratedColumn<String> color = GeneratedColumn<String>(
+ 'color',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> birthDate = GeneratedColumn<String>(
+ 'birth_date',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ @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.string,
+ data['${effectivePrefix}created_at'],
+ )!,
+ updatedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ 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.int,
+ data['${effectivePrefix}is_favorite'],
+ )!,
+ isHidden: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}is_hidden'],
+ )!,
+ color: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}color'],
+ ),
+ birthDate: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}birth_date'],
+ ),
+ );
+ }
+
+ @override
+ PersonEntity createAlias(String alias) {
+ return PersonEntity(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class PersonEntityData extends DataClass
+ implements Insertable<PersonEntityData> {
+ final String id;
+ final String createdAt;
+ final String updatedAt;
+ final String ownerId;
+ final String name;
+ final String? faceAssetId;
+ final int isFavorite;
+ final int isHidden;
+ final String? color;
+ final String? 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<String>(createdAt);
+ map['updated_at'] = Variable<String>(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<int>(isFavorite);
+ map['is_hidden'] = Variable<int>(isHidden);
+ if (!nullToAbsent || color != null) {
+ map['color'] = Variable<String>(color);
+ }
+ if (!nullToAbsent || birthDate != null) {
+ map['birth_date'] = Variable<String>(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<String>(json['createdAt']),
+ updatedAt: serializer.fromJson<String>(json['updatedAt']),
+ ownerId: serializer.fromJson<String>(json['ownerId']),
+ name: serializer.fromJson<String>(json['name']),
+ faceAssetId: serializer.fromJson<String?>(json['faceAssetId']),
+ isFavorite: serializer.fromJson<int>(json['isFavorite']),
+ isHidden: serializer.fromJson<int>(json['isHidden']),
+ color: serializer.fromJson<String?>(json['color']),
+ birthDate: serializer.fromJson<String?>(json['birthDate']),
+ );
+ }
+ @override
+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {
+ serializer ??= driftRuntimeOptions.defaultSerializer;
+ return <String, dynamic>{
+ 'id': serializer.toJson<String>(id),
+ 'createdAt': serializer.toJson<String>(createdAt),
+ 'updatedAt': serializer.toJson<String>(updatedAt),
+ 'ownerId': serializer.toJson<String>(ownerId),
+ 'name': serializer.toJson<String>(name),
+ 'faceAssetId': serializer.toJson<String?>(faceAssetId),
+ 'isFavorite': serializer.toJson<int>(isFavorite),
+ 'isHidden': serializer.toJson<int>(isHidden),
+ 'color': serializer.toJson<String?>(color),
+ 'birthDate': serializer.toJson<String?>(birthDate),
+ };
+ }
+
+ PersonEntityData copyWith({
+ String? id,
+ String? createdAt,
+ String? updatedAt,
+ String? ownerId,
+ String? name,
+ Value<String?> faceAssetId = const Value.absent(),
+ int? isFavorite,
+ int? isHidden,
+ Value<String?> color = const Value.absent(),
+ Value<String?> 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<String> createdAt;
+ final Value<String> updatedAt;
+ final Value<String> ownerId;
+ final Value<String> name;
+ final Value<String?> faceAssetId;
+ final Value<int> isFavorite;
+ final Value<int> isHidden;
+ final Value<String?> color;
+ final Value<String?> 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 int isFavorite,
+ required int 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<String>? createdAt,
+ Expression<String>? updatedAt,
+ Expression<String>? ownerId,
+ Expression<String>? name,
+ Expression<String>? faceAssetId,
+ Expression<int>? isFavorite,
+ Expression<int>? isHidden,
+ Expression<String>? color,
+ Expression<String>? 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<String>? createdAt,
+ Value<String>? updatedAt,
+ Value<String>? ownerId,
+ Value<String>? name,
+ Value<String?>? faceAssetId,
+ Value<int>? isFavorite,
+ Value<int>? isHidden,
+ Value<String?>? color,
+ Value<String?>? 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<String>(createdAt.value);
+ }
+ if (updatedAt.present) {
+ map['updated_at'] = Variable<String>(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<int>(isFavorite.value);
+ }
+ if (isHidden.present) {
+ map['is_hidden'] = Variable<int>(isHidden.value);
+ }
+ if (color.present) {
+ map['color'] = Variable<String>(color.value);
+ }
+ if (birthDate.present) {
+ map['birth_date'] = Variable<String>(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,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> assetId = GeneratedColumn<String>(
+ 'asset_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints:
+ 'NOT NULL REFERENCES remote_asset_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<String> personId = GeneratedColumn<String>(
+ 'person_id',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL REFERENCES person_entity(id)ON DELETE SET NULL',
+ );
+ late final GeneratedColumn<int> imageWidth = GeneratedColumn<int>(
+ 'image_width',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> imageHeight = GeneratedColumn<int>(
+ 'image_height',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> boundingBoxX1 = GeneratedColumn<int>(
+ 'bounding_box_x1',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> boundingBoxY1 = GeneratedColumn<int>(
+ 'bounding_box_y1',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> boundingBoxX2 = GeneratedColumn<int>(
+ 'bounding_box_x2',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> boundingBoxY2 = GeneratedColumn<int>(
+ 'bounding_box_y2',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> sourceType = GeneratedColumn<String>(
+ 'source_type',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> isVisible = GeneratedColumn<int>(
+ 'is_visible',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 1 CHECK (is_visible IN (0, 1))',
+ defaultValue: const CustomExpression('1'),
+ );
+ late final GeneratedColumn<String> deletedAt = GeneratedColumn<String>(
+ 'deleted_at',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ @override
+ List<GeneratedColumn> get $columns => [
+ id,
+ assetId,
+ personId,
+ imageWidth,
+ imageHeight,
+ boundingBoxX1,
+ boundingBoxY1,
+ boundingBoxX2,
+ boundingBoxY2,
+ sourceType,
+ isVisible,
+ deletedAt,
+ ];
+ @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'],
+ )!,
+ isVisible: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}is_visible'],
+ )!,
+ deletedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}deleted_at'],
+ ),
+ );
+ }
+
+ @override
+ AssetFaceEntity createAlias(String alias) {
+ return AssetFaceEntity(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id)'];
+ @override
+ bool get dontWriteConstraints => 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;
+ final int isVisible;
+ final String? deletedAt;
+ 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,
+ required this.isVisible,
+ this.deletedAt,
+ });
+ @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);
+ map['is_visible'] = Variable<int>(isVisible);
+ if (!nullToAbsent || deletedAt != null) {
+ map['deleted_at'] = Variable<String>(deletedAt);
+ }
+ 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']),
+ isVisible: serializer.fromJson<int>(json['isVisible']),
+ deletedAt: serializer.fromJson<String?>(json['deletedAt']),
+ );
+ }
+ @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),
+ 'isVisible': serializer.toJson<int>(isVisible),
+ 'deletedAt': serializer.toJson<String?>(deletedAt),
+ };
+ }
+
+ 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,
+ int? isVisible,
+ Value<String?> deletedAt = const Value.absent(),
+ }) => 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,
+ isVisible: isVisible ?? this.isVisible,
+ deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
+ );
+ 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,
+ isVisible: data.isVisible.present ? data.isVisible.value : this.isVisible,
+ deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
+ );
+ }
+
+ @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('isVisible: $isVisible, ')
+ ..write('deletedAt: $deletedAt')
+ ..write(')'))
+ .toString();
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ id,
+ assetId,
+ personId,
+ imageWidth,
+ imageHeight,
+ boundingBoxX1,
+ boundingBoxY1,
+ boundingBoxX2,
+ boundingBoxY2,
+ sourceType,
+ isVisible,
+ deletedAt,
+ );
+ @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 &&
+ other.isVisible == this.isVisible &&
+ other.deletedAt == this.deletedAt);
+}
+
+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;
+ final Value<int> isVisible;
+ final Value<String?> deletedAt;
+ 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(),
+ this.isVisible = const Value.absent(),
+ this.deletedAt = 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,
+ this.isVisible = const Value.absent(),
+ this.deletedAt = const Value.absent(),
+ }) : 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,
+ Expression<int>? isVisible,
+ Expression<String>? deletedAt,
+ }) {
+ 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,
+ if (isVisible != null) 'is_visible': isVisible,
+ if (deletedAt != null) 'deleted_at': deletedAt,
+ });
+ }
+
+ 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,
+ Value<int>? isVisible,
+ Value<String?>? deletedAt,
+ }) {
+ 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,
+ isVisible: isVisible ?? this.isVisible,
+ deletedAt: deletedAt ?? this.deletedAt,
+ );
+ }
+
+ @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);
+ }
+ if (isVisible.present) {
+ map['is_visible'] = Variable<int>(isVisible.value);
+ }
+ if (deletedAt.present) {
+ map['deleted_at'] = Variable<String>(deletedAt.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('isVisible: $isVisible, ')
+ ..write('deletedAt: $deletedAt')
+ ..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,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> stringValue = GeneratedColumn<String>(
+ 'string_value',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> intValue = GeneratedColumn<int>(
+ 'int_value',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ @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;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id)'];
+ @override
+ bool get dontWriteConstraints => 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,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> type = GeneratedColumn<int>(
+ 'type',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> createdAt = GeneratedColumn<String>(
+ 'created_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
+ 'updated_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ late final GeneratedColumn<int> width = GeneratedColumn<int>(
+ 'width',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> height = GeneratedColumn<int>(
+ 'height',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> durationMs = GeneratedColumn<int>(
+ 'duration_ms',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<String> id = GeneratedColumn<String>(
+ 'id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> albumId = GeneratedColumn<String>(
+ 'album_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> checksum = GeneratedColumn<String>(
+ 'checksum',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NULL',
+ );
+ late final GeneratedColumn<int> isFavorite = GeneratedColumn<int>(
+ 'is_favorite',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 0 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,
+ $customConstraints: 'NOT NULL DEFAULT 0',
+ defaultValue: const CustomExpression('0'),
+ );
+ late final GeneratedColumn<int> source = GeneratedColumn<int>(
+ 'source',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> playbackStyle = GeneratedColumn<int>(
+ 'playback_style',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 0',
+ defaultValue: const CustomExpression('0'),
+ );
+ @override
+ List<GeneratedColumn> get $columns => [
+ name,
+ type,
+ createdAt,
+ updatedAt,
+ width,
+ height,
+ durationMs,
+ id,
+ albumId,
+ checksum,
+ isFavorite,
+ orientation,
+ source,
+ playbackStyle,
+ ];
+ @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.string,
+ data['${effectivePrefix}created_at'],
+ )!,
+ updatedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}updated_at'],
+ )!,
+ width: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}width'],
+ ),
+ height: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}height'],
+ ),
+ durationMs: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}duration_ms'],
+ ),
+ 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.int,
+ data['${effectivePrefix}is_favorite'],
+ )!,
+ orientation: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}orientation'],
+ )!,
+ source: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}source'],
+ )!,
+ playbackStyle: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}playback_style'],
+ )!,
+ );
+ }
+
+ @override
+ TrashedLocalAssetEntity createAlias(String alias) {
+ return TrashedLocalAssetEntity(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id, album_id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class TrashedLocalAssetEntityData extends DataClass
+ implements Insertable<TrashedLocalAssetEntityData> {
+ final String name;
+ final int type;
+ final String createdAt;
+ final String updatedAt;
+ final int? width;
+ final int? height;
+ final int? durationMs;
+ final String id;
+ final String albumId;
+ final String? checksum;
+ final int isFavorite;
+ final int orientation;
+ final int source;
+ final int playbackStyle;
+ const TrashedLocalAssetEntityData({
+ required this.name,
+ required this.type,
+ required this.createdAt,
+ required this.updatedAt,
+ this.width,
+ this.height,
+ this.durationMs,
+ required this.id,
+ required this.albumId,
+ this.checksum,
+ required this.isFavorite,
+ required this.orientation,
+ required this.source,
+ required this.playbackStyle,
+ });
+ @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<String>(createdAt);
+ map['updated_at'] = Variable<String>(updatedAt);
+ if (!nullToAbsent || width != null) {
+ map['width'] = Variable<int>(width);
+ }
+ if (!nullToAbsent || height != null) {
+ map['height'] = Variable<int>(height);
+ }
+ if (!nullToAbsent || durationMs != null) {
+ map['duration_ms'] = Variable<int>(durationMs);
+ }
+ map['id'] = Variable<String>(id);
+ map['album_id'] = Variable<String>(albumId);
+ if (!nullToAbsent || checksum != null) {
+ map['checksum'] = Variable<String>(checksum);
+ }
+ map['is_favorite'] = Variable<int>(isFavorite);
+ map['orientation'] = Variable<int>(orientation);
+ map['source'] = Variable<int>(source);
+ map['playback_style'] = Variable<int>(playbackStyle);
+ 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<String>(json['createdAt']),
+ updatedAt: serializer.fromJson<String>(json['updatedAt']),
+ width: serializer.fromJson<int?>(json['width']),
+ height: serializer.fromJson<int?>(json['height']),
+ durationMs: serializer.fromJson<int?>(json['durationMs']),
+ id: serializer.fromJson<String>(json['id']),
+ albumId: serializer.fromJson<String>(json['albumId']),
+ checksum: serializer.fromJson<String?>(json['checksum']),
+ isFavorite: serializer.fromJson<int>(json['isFavorite']),
+ orientation: serializer.fromJson<int>(json['orientation']),
+ source: serializer.fromJson<int>(json['source']),
+ playbackStyle: serializer.fromJson<int>(json['playbackStyle']),
+ );
+ }
+ @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<String>(createdAt),
+ 'updatedAt': serializer.toJson<String>(updatedAt),
+ 'width': serializer.toJson<int?>(width),
+ 'height': serializer.toJson<int?>(height),
+ 'durationMs': serializer.toJson<int?>(durationMs),
+ 'id': serializer.toJson<String>(id),
+ 'albumId': serializer.toJson<String>(albumId),
+ 'checksum': serializer.toJson<String?>(checksum),
+ 'isFavorite': serializer.toJson<int>(isFavorite),
+ 'orientation': serializer.toJson<int>(orientation),
+ 'source': serializer.toJson<int>(source),
+ 'playbackStyle': serializer.toJson<int>(playbackStyle),
+ };
+ }
+
+ TrashedLocalAssetEntityData copyWith({
+ String? name,
+ int? type,
+ String? createdAt,
+ String? updatedAt,
+ Value<int?> width = const Value.absent(),
+ Value<int?> height = const Value.absent(),
+ Value<int?> durationMs = const Value.absent(),
+ String? id,
+ String? albumId,
+ Value<String?> checksum = const Value.absent(),
+ int? isFavorite,
+ int? orientation,
+ int? source,
+ int? playbackStyle,
+ }) => 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,
+ durationMs: durationMs.present ? durationMs.value : this.durationMs,
+ id: id ?? this.id,
+ albumId: albumId ?? this.albumId,
+ checksum: checksum.present ? checksum.value : this.checksum,
+ isFavorite: isFavorite ?? this.isFavorite,
+ orientation: orientation ?? this.orientation,
+ source: source ?? this.source,
+ playbackStyle: playbackStyle ?? this.playbackStyle,
+ );
+ 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,
+ durationMs: data.durationMs.present
+ ? data.durationMs.value
+ : this.durationMs,
+ 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,
+ source: data.source.present ? data.source.value : this.source,
+ playbackStyle: data.playbackStyle.present
+ ? data.playbackStyle.value
+ : this.playbackStyle,
+ );
+ }
+
+ @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('durationMs: $durationMs, ')
+ ..write('id: $id, ')
+ ..write('albumId: $albumId, ')
+ ..write('checksum: $checksum, ')
+ ..write('isFavorite: $isFavorite, ')
+ ..write('orientation: $orientation, ')
+ ..write('source: $source, ')
+ ..write('playbackStyle: $playbackStyle')
+ ..write(')'))
+ .toString();
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ name,
+ type,
+ createdAt,
+ updatedAt,
+ width,
+ height,
+ durationMs,
+ id,
+ albumId,
+ checksum,
+ isFavorite,
+ orientation,
+ source,
+ playbackStyle,
+ );
+ @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.durationMs == this.durationMs &&
+ other.id == this.id &&
+ other.albumId == this.albumId &&
+ other.checksum == this.checksum &&
+ other.isFavorite == this.isFavorite &&
+ other.orientation == this.orientation &&
+ other.source == this.source &&
+ other.playbackStyle == this.playbackStyle);
+}
+
+class TrashedLocalAssetEntityCompanion
+ extends UpdateCompanion<TrashedLocalAssetEntityData> {
+ final Value<String> name;
+ final Value<int> type;
+ final Value<String> createdAt;
+ final Value<String> updatedAt;
+ final Value<int?> width;
+ final Value<int?> height;
+ final Value<int?> durationMs;
+ final Value<String> id;
+ final Value<String> albumId;
+ final Value<String?> checksum;
+ final Value<int> isFavorite;
+ final Value<int> orientation;
+ final Value<int> source;
+ final Value<int> playbackStyle;
+ 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.durationMs = 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(),
+ this.source = const Value.absent(),
+ this.playbackStyle = 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.durationMs = const Value.absent(),
+ required String id,
+ required String albumId,
+ this.checksum = const Value.absent(),
+ this.isFavorite = const Value.absent(),
+ this.orientation = const Value.absent(),
+ required int source,
+ this.playbackStyle = const Value.absent(),
+ }) : name = Value(name),
+ type = Value(type),
+ id = Value(id),
+ albumId = Value(albumId),
+ source = Value(source);
+ static Insertable<TrashedLocalAssetEntityData> custom({
+ Expression<String>? name,
+ Expression<int>? type,
+ Expression<String>? createdAt,
+ Expression<String>? updatedAt,
+ Expression<int>? width,
+ Expression<int>? height,
+ Expression<int>? durationMs,
+ Expression<String>? id,
+ Expression<String>? albumId,
+ Expression<String>? checksum,
+ Expression<int>? isFavorite,
+ Expression<int>? orientation,
+ Expression<int>? source,
+ Expression<int>? playbackStyle,
+ }) {
+ 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 (durationMs != null) 'duration_ms': durationMs,
+ 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,
+ if (source != null) 'source': source,
+ if (playbackStyle != null) 'playback_style': playbackStyle,
+ });
+ }
+
+ TrashedLocalAssetEntityCompanion copyWith({
+ Value<String>? name,
+ Value<int>? type,
+ Value<String>? createdAt,
+ Value<String>? updatedAt,
+ Value<int?>? width,
+ Value<int?>? height,
+ Value<int?>? durationMs,
+ Value<String>? id,
+ Value<String>? albumId,
+ Value<String?>? checksum,
+ Value<int>? isFavorite,
+ Value<int>? orientation,
+ Value<int>? source,
+ Value<int>? playbackStyle,
+ }) {
+ 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,
+ durationMs: durationMs ?? this.durationMs,
+ id: id ?? this.id,
+ albumId: albumId ?? this.albumId,
+ checksum: checksum ?? this.checksum,
+ isFavorite: isFavorite ?? this.isFavorite,
+ orientation: orientation ?? this.orientation,
+ source: source ?? this.source,
+ playbackStyle: playbackStyle ?? this.playbackStyle,
+ );
+ }
+
+ @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<String>(createdAt.value);
+ }
+ if (updatedAt.present) {
+ map['updated_at'] = Variable<String>(updatedAt.value);
+ }
+ if (width.present) {
+ map['width'] = Variable<int>(width.value);
+ }
+ if (height.present) {
+ map['height'] = Variable<int>(height.value);
+ }
+ if (durationMs.present) {
+ map['duration_ms'] = Variable<int>(durationMs.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<int>(isFavorite.value);
+ }
+ if (orientation.present) {
+ map['orientation'] = Variable<int>(orientation.value);
+ }
+ if (source.present) {
+ map['source'] = Variable<int>(source.value);
+ }
+ if (playbackStyle.present) {
+ map['playback_style'] = Variable<int>(playbackStyle.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('durationMs: $durationMs, ')
+ ..write('id: $id, ')
+ ..write('albumId: $albumId, ')
+ ..write('checksum: $checksum, ')
+ ..write('isFavorite: $isFavorite, ')
+ ..write('orientation: $orientation, ')
+ ..write('source: $source, ')
+ ..write('playbackStyle: $playbackStyle')
+ ..write(')'))
+ .toString();
+ }
+}
+
+class AssetEditEntity extends Table
+ with TableInfo<AssetEditEntity, AssetEditEntityData> {
+ @override
+ final GeneratedDatabase attachedDatabase;
+ final String? _alias;
+ AssetEditEntity(this.attachedDatabase, [this._alias]);
+ late final GeneratedColumn<String> id = GeneratedColumn<String>(
+ 'id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> assetId = GeneratedColumn<String>(
+ 'asset_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints:
+ 'NOT NULL REFERENCES remote_asset_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<int> action = GeneratedColumn<int>(
+ 'action',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<i2.Uint8List> parameters =
+ GeneratedColumn<i2.Uint8List>(
+ 'parameters',
+ aliasedName,
+ false,
+ type: DriftSqlType.blob,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> sequence = GeneratedColumn<int>(
+ 'sequence',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ @override
+ List<GeneratedColumn> get $columns => [
+ id,
+ assetId,
+ action,
+ parameters,
+ sequence,
+ ];
+ @override
+ String get aliasedName => _alias ?? actualTableName;
+ @override
+ String get actualTableName => $name;
+ static const String $name = 'asset_edit_entity';
+ @override
+ Set<GeneratedColumn> get $primaryKey => {id};
+ @override
+ AssetEditEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {
+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
+ return AssetEditEntityData(
+ id: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}id'],
+ )!,
+ assetId: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}asset_id'],
+ )!,
+ action: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}action'],
+ )!,
+ parameters: attachedDatabase.typeMapping.read(
+ DriftSqlType.blob,
+ data['${effectivePrefix}parameters'],
+ )!,
+ sequence: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}sequence'],
+ )!,
+ );
+ }
+
+ @override
+ AssetEditEntity createAlias(String alias) {
+ return AssetEditEntity(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class AssetEditEntityData extends DataClass
+ implements Insertable<AssetEditEntityData> {
+ final String id;
+ final String assetId;
+ final int action;
+ final i2.Uint8List parameters;
+ final int sequence;
+ const AssetEditEntityData({
+ required this.id,
+ required this.assetId,
+ required this.action,
+ required this.parameters,
+ required this.sequence,
+ });
+ @override
+ Map<String, Expression> toColumns(bool nullToAbsent) {
+ final map = <String, Expression>{};
+ map['id'] = Variable<String>(id);
+ map['asset_id'] = Variable<String>(assetId);
+ map['action'] = Variable<int>(action);
+ map['parameters'] = Variable<i2.Uint8List>(parameters);
+ map['sequence'] = Variable<int>(sequence);
+ return map;
+ }
+
+ factory AssetEditEntityData.fromJson(
+ Map<String, dynamic> json, {
+ ValueSerializer? serializer,
+ }) {
+ serializer ??= driftRuntimeOptions.defaultSerializer;
+ return AssetEditEntityData(
+ id: serializer.fromJson<String>(json['id']),
+ assetId: serializer.fromJson<String>(json['assetId']),
+ action: serializer.fromJson<int>(json['action']),
+ parameters: serializer.fromJson<i2.Uint8List>(json['parameters']),
+ sequence: serializer.fromJson<int>(json['sequence']),
+ );
+ }
+ @override
+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {
+ serializer ??= driftRuntimeOptions.defaultSerializer;
+ return <String, dynamic>{
+ 'id': serializer.toJson<String>(id),
+ 'assetId': serializer.toJson<String>(assetId),
+ 'action': serializer.toJson<int>(action),
+ 'parameters': serializer.toJson<i2.Uint8List>(parameters),
+ 'sequence': serializer.toJson<int>(sequence),
+ };
+ }
+
+ AssetEditEntityData copyWith({
+ String? id,
+ String? assetId,
+ int? action,
+ i2.Uint8List? parameters,
+ int? sequence,
+ }) => AssetEditEntityData(
+ id: id ?? this.id,
+ assetId: assetId ?? this.assetId,
+ action: action ?? this.action,
+ parameters: parameters ?? this.parameters,
+ sequence: sequence ?? this.sequence,
+ );
+ AssetEditEntityData copyWithCompanion(AssetEditEntityCompanion data) {
+ return AssetEditEntityData(
+ id: data.id.present ? data.id.value : this.id,
+ assetId: data.assetId.present ? data.assetId.value : this.assetId,
+ action: data.action.present ? data.action.value : this.action,
+ parameters: data.parameters.present
+ ? data.parameters.value
+ : this.parameters,
+ sequence: data.sequence.present ? data.sequence.value : this.sequence,
+ );
+ }
+
+ @override
+ String toString() {
+ return (StringBuffer('AssetEditEntityData(')
+ ..write('id: $id, ')
+ ..write('assetId: $assetId, ')
+ ..write('action: $action, ')
+ ..write('parameters: $parameters, ')
+ ..write('sequence: $sequence')
+ ..write(')'))
+ .toString();
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ id,
+ assetId,
+ action,
+ $driftBlobEquality.hash(parameters),
+ sequence,
+ );
+ @override
+ bool operator ==(Object other) =>
+ identical(this, other) ||
+ (other is AssetEditEntityData &&
+ other.id == this.id &&
+ other.assetId == this.assetId &&
+ other.action == this.action &&
+ $driftBlobEquality.equals(other.parameters, this.parameters) &&
+ other.sequence == this.sequence);
+}
+
+class AssetEditEntityCompanion extends UpdateCompanion<AssetEditEntityData> {
+ final Value<String> id;
+ final Value<String> assetId;
+ final Value<int> action;
+ final Value<i2.Uint8List> parameters;
+ final Value<int> sequence;
+ const AssetEditEntityCompanion({
+ this.id = const Value.absent(),
+ this.assetId = const Value.absent(),
+ this.action = const Value.absent(),
+ this.parameters = const Value.absent(),
+ this.sequence = const Value.absent(),
+ });
+ AssetEditEntityCompanion.insert({
+ required String id,
+ required String assetId,
+ required int action,
+ required i2.Uint8List parameters,
+ required int sequence,
+ }) : id = Value(id),
+ assetId = Value(assetId),
+ action = Value(action),
+ parameters = Value(parameters),
+ sequence = Value(sequence);
+ static Insertable<AssetEditEntityData> custom({
+ Expression<String>? id,
+ Expression<String>? assetId,
+ Expression<int>? action,
+ Expression<i2.Uint8List>? parameters,
+ Expression<int>? sequence,
+ }) {
+ return RawValuesInsertable({
+ if (id != null) 'id': id,
+ if (assetId != null) 'asset_id': assetId,
+ if (action != null) 'action': action,
+ if (parameters != null) 'parameters': parameters,
+ if (sequence != null) 'sequence': sequence,
+ });
+ }
+
+ AssetEditEntityCompanion copyWith({
+ Value<String>? id,
+ Value<String>? assetId,
+ Value<int>? action,
+ Value<i2.Uint8List>? parameters,
+ Value<int>? sequence,
+ }) {
+ return AssetEditEntityCompanion(
+ id: id ?? this.id,
+ assetId: assetId ?? this.assetId,
+ action: action ?? this.action,
+ parameters: parameters ?? this.parameters,
+ sequence: sequence ?? this.sequence,
+ );
+ }
+
+ @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 (action.present) {
+ map['action'] = Variable<int>(action.value);
+ }
+ if (parameters.present) {
+ map['parameters'] = Variable<i2.Uint8List>(parameters.value);
+ }
+ if (sequence.present) {
+ map['sequence'] = Variable<int>(sequence.value);
+ }
+ return map;
+ }
+
+ @override
+ String toString() {
+ return (StringBuffer('AssetEditEntityCompanion(')
+ ..write('id: $id, ')
+ ..write('assetId: $assetId, ')
+ ..write('action: $action, ')
+ ..write('parameters: $parameters, ')
+ ..write('sequence: $sequence')
+ ..write(')'))
+ .toString();
+ }
+}
+
+class Settings extends Table with TableInfo<Settings, SettingsData> {
+ @override
+ final GeneratedDatabase attachedDatabase;
+ final String? _alias;
+ Settings(this.attachedDatabase, [this._alias]);
+ late final GeneratedColumn<String> key = GeneratedColumn<String>(
+ 'key',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> value = GeneratedColumn<String>(
+ 'value',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
+ 'updated_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ defaultValue: const CustomExpression('CURRENT_TIMESTAMP'),
+ );
+ @override
+ List<GeneratedColumn> get $columns => [key, value, updatedAt];
+ @override
+ String get aliasedName => _alias ?? actualTableName;
+ @override
+ String get actualTableName => $name;
+ static const String $name = 'settings';
+ @override
+ Set<GeneratedColumn> get $primaryKey => {key};
+ @override
+ SettingsData map(Map<String, dynamic> data, {String? tablePrefix}) {
+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
+ return SettingsData(
+ key: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}key'],
+ )!,
+ value: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}value'],
+ )!,
+ updatedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}updated_at'],
+ )!,
+ );
+ }
+
+ @override
+ Settings createAlias(String alias) {
+ return Settings(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY("key")'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class SettingsData extends DataClass implements Insertable<SettingsData> {
+ final String key;
+ final String value;
+ final String updatedAt;
+ const SettingsData({
+ required this.key,
+ required this.value,
+ required this.updatedAt,
+ });
+ @override
+ Map<String, Expression> toColumns(bool nullToAbsent) {
+ final map = <String, Expression>{};
+ map['key'] = Variable<String>(key);
+ map['value'] = Variable<String>(value);
+ map['updated_at'] = Variable<String>(updatedAt);
+ return map;
+ }
+
+ factory SettingsData.fromJson(
+ Map<String, dynamic> json, {
+ ValueSerializer? serializer,
+ }) {
+ serializer ??= driftRuntimeOptions.defaultSerializer;
+ return SettingsData(
+ key: serializer.fromJson<String>(json['key']),
+ value: serializer.fromJson<String>(json['value']),
+ updatedAt: serializer.fromJson<String>(json['updatedAt']),
+ );
+ }
+ @override
+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {
+ serializer ??= driftRuntimeOptions.defaultSerializer;
+ return <String, dynamic>{
+ 'key': serializer.toJson<String>(key),
+ 'value': serializer.toJson<String>(value),
+ 'updatedAt': serializer.toJson<String>(updatedAt),
+ };
+ }
+
+ SettingsData copyWith({String? key, String? value, String? updatedAt}) =>
+ SettingsData(
+ key: key ?? this.key,
+ value: value ?? this.value,
+ updatedAt: updatedAt ?? this.updatedAt,
+ );
+ SettingsData copyWithCompanion(SettingsCompanion data) {
+ return SettingsData(
+ key: data.key.present ? data.key.value : this.key,
+ value: data.value.present ? data.value.value : this.value,
+ updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
+ );
+ }
+
+ @override
+ String toString() {
+ return (StringBuffer('SettingsData(')
+ ..write('key: $key, ')
+ ..write('value: $value, ')
+ ..write('updatedAt: $updatedAt')
+ ..write(')'))
+ .toString();
+ }
+
+ @override
+ int get hashCode => Object.hash(key, value, updatedAt);
+ @override
+ bool operator ==(Object other) =>
+ identical(this, other) ||
+ (other is SettingsData &&
+ other.key == this.key &&
+ other.value == this.value &&
+ other.updatedAt == this.updatedAt);
+}
+
+class SettingsCompanion extends UpdateCompanion<SettingsData> {
+ final Value<String> key;
+ final Value<String> value;
+ final Value<String> updatedAt;
+ const SettingsCompanion({
+ this.key = const Value.absent(),
+ this.value = const Value.absent(),
+ this.updatedAt = const Value.absent(),
+ });
+ SettingsCompanion.insert({
+ required String key,
+ required String value,
+ this.updatedAt = const Value.absent(),
+ }) : key = Value(key),
+ value = Value(value);
+ static Insertable<SettingsData> custom({
+ Expression<String>? key,
+ Expression<String>? value,
+ Expression<String>? updatedAt,
+ }) {
+ return RawValuesInsertable({
+ if (key != null) 'key': key,
+ if (value != null) 'value': value,
+ if (updatedAt != null) 'updated_at': updatedAt,
+ });
+ }
+
+ SettingsCompanion copyWith({
+ Value<String>? key,
+ Value<String>? value,
+ Value<String>? updatedAt,
+ }) {
+ return SettingsCompanion(
+ key: key ?? this.key,
+ value: value ?? this.value,
+ updatedAt: updatedAt ?? this.updatedAt,
+ );
+ }
+
+ @override
+ Map<String, Expression> toColumns(bool nullToAbsent) {
+ final map = <String, Expression>{};
+ if (key.present) {
+ map['key'] = Variable<String>(key.value);
+ }
+ if (value.present) {
+ map['value'] = Variable<String>(value.value);
+ }
+ if (updatedAt.present) {
+ map['updated_at'] = Variable<String>(updatedAt.value);
+ }
+ return map;
+ }
+
+ @override
+ String toString() {
+ return (StringBuffer('SettingsCompanion(')
+ ..write('key: $key, ')
+ ..write('value: $value, ')
+ ..write('updatedAt: $updatedAt')
+ ..write(')'))
+ .toString();
+ }
+}
+
+class AssetOcrEntity extends Table
+ with TableInfo<AssetOcrEntity, AssetOcrEntityData> {
+ @override
+ final GeneratedDatabase attachedDatabase;
+ final String? _alias;
+ AssetOcrEntity(this.attachedDatabase, [this._alias]);
+ late final GeneratedColumn<String> id = GeneratedColumn<String>(
+ 'id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> assetId = GeneratedColumn<String>(
+ 'asset_id',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints:
+ 'NOT NULL REFERENCES remote_asset_entity(id)ON DELETE CASCADE',
+ );
+ late final GeneratedColumn<double> x1 = GeneratedColumn<double>(
+ 'x1',
+ aliasedName,
+ false,
+ type: DriftSqlType.double,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<double> y1 = GeneratedColumn<double>(
+ 'y1',
+ aliasedName,
+ false,
+ type: DriftSqlType.double,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<double> x2 = GeneratedColumn<double>(
+ 'x2',
+ aliasedName,
+ false,
+ type: DriftSqlType.double,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<double> y2 = GeneratedColumn<double>(
+ 'y2',
+ aliasedName,
+ false,
+ type: DriftSqlType.double,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<double> x3 = GeneratedColumn<double>(
+ 'x3',
+ aliasedName,
+ false,
+ type: DriftSqlType.double,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<double> y3 = GeneratedColumn<double>(
+ 'y3',
+ aliasedName,
+ false,
+ type: DriftSqlType.double,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<double> x4 = GeneratedColumn<double>(
+ 'x4',
+ aliasedName,
+ false,
+ type: DriftSqlType.double,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<double> y4 = GeneratedColumn<double>(
+ 'y4',
+ aliasedName,
+ false,
+ type: DriftSqlType.double,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<double> boxScore = GeneratedColumn<double>(
+ 'box_score',
+ aliasedName,
+ false,
+ type: DriftSqlType.double,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<double> textScore = GeneratedColumn<double>(
+ 'text_score',
+ aliasedName,
+ false,
+ type: DriftSqlType.double,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<String> recognizedText = GeneratedColumn<String>(
+ 'recognized_text',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ $customConstraints: 'NOT NULL',
+ );
+ late final GeneratedColumn<int> isVisible = GeneratedColumn<int>(
+ 'is_visible',
+ aliasedName,
+ false,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ $customConstraints: 'NOT NULL DEFAULT 1 CHECK (is_visible IN (0, 1))',
+ defaultValue: const CustomExpression('1'),
+ );
+ @override
+ List<GeneratedColumn> get $columns => [
+ id,
+ assetId,
+ x1,
+ y1,
+ x2,
+ y2,
+ x3,
+ y3,
+ x4,
+ y4,
+ boxScore,
+ textScore,
+ recognizedText,
+ isVisible,
+ ];
+ @override
+ String get aliasedName => _alias ?? actualTableName;
+ @override
+ String get actualTableName => $name;
+ static const String $name = 'asset_ocr_entity';
+ @override
+ Set<GeneratedColumn> get $primaryKey => {id};
+ @override
+ AssetOcrEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {
+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
+ return AssetOcrEntityData(
+ id: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}id'],
+ )!,
+ assetId: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}asset_id'],
+ )!,
+ x1: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}x1'],
+ )!,
+ y1: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}y1'],
+ )!,
+ x2: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}x2'],
+ )!,
+ y2: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}y2'],
+ )!,
+ x3: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}x3'],
+ )!,
+ y3: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}y3'],
+ )!,
+ x4: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}x4'],
+ )!,
+ y4: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}y4'],
+ )!,
+ boxScore: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}box_score'],
+ )!,
+ textScore: attachedDatabase.typeMapping.read(
+ DriftSqlType.double,
+ data['${effectivePrefix}text_score'],
+ )!,
+ recognizedText: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}recognized_text'],
+ )!,
+ isVisible: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}is_visible'],
+ )!,
+ );
+ }
+
+ @override
+ AssetOcrEntity createAlias(String alias) {
+ return AssetOcrEntity(attachedDatabase, alias);
+ }
+
+ @override
+ bool get withoutRowId => true;
+ @override
+ bool get isStrict => true;
+ @override
+ List<String> get customConstraints => const ['PRIMARY KEY(id)'];
+ @override
+ bool get dontWriteConstraints => true;
+}
+
+class AssetOcrEntityData extends DataClass
+ implements Insertable<AssetOcrEntityData> {
+ final String id;
+ final String assetId;
+ final double x1;
+ final double y1;
+ final double x2;
+ final double y2;
+ final double x3;
+ final double y3;
+ final double x4;
+ final double y4;
+ final double boxScore;
+ final double textScore;
+ final String recognizedText;
+ final int isVisible;
+ const AssetOcrEntityData({
+ required this.id,
+ required this.assetId,
+ required this.x1,
+ required this.y1,
+ required this.x2,
+ required this.y2,
+ required this.x3,
+ required this.y3,
+ required this.x4,
+ required this.y4,
+ required this.boxScore,
+ required this.textScore,
+ required this.recognizedText,
+ required this.isVisible,
+ });
+ @override
+ Map<String, Expression> toColumns(bool nullToAbsent) {
+ final map = <String, Expression>{};
+ map['id'] = Variable<String>(id);
+ map['asset_id'] = Variable<String>(assetId);
+ map['x1'] = Variable<double>(x1);
+ map['y1'] = Variable<double>(y1);
+ map['x2'] = Variable<double>(x2);
+ map['y2'] = Variable<double>(y2);
+ map['x3'] = Variable<double>(x3);
+ map['y3'] = Variable<double>(y3);
+ map['x4'] = Variable<double>(x4);
+ map['y4'] = Variable<double>(y4);
+ map['box_score'] = Variable<double>(boxScore);
+ map['text_score'] = Variable<double>(textScore);
+ map['recognized_text'] = Variable<String>(recognizedText);
+ map['is_visible'] = Variable<int>(isVisible);
+ return map;
+ }
+
+ factory AssetOcrEntityData.fromJson(
+ Map<String, dynamic> json, {
+ ValueSerializer? serializer,
+ }) {
+ serializer ??= driftRuntimeOptions.defaultSerializer;
+ return AssetOcrEntityData(
+ id: serializer.fromJson<String>(json['id']),
+ assetId: serializer.fromJson<String>(json['assetId']),
+ x1: serializer.fromJson<double>(json['x1']),
+ y1: serializer.fromJson<double>(json['y1']),
+ x2: serializer.fromJson<double>(json['x2']),
+ y2: serializer.fromJson<double>(json['y2']),
+ x3: serializer.fromJson<double>(json['x3']),
+ y3: serializer.fromJson<double>(json['y3']),
+ x4: serializer.fromJson<double>(json['x4']),
+ y4: serializer.fromJson<double>(json['y4']),
+ boxScore: serializer.fromJson<double>(json['boxScore']),
+ textScore: serializer.fromJson<double>(json['textScore']),
+ recognizedText: serializer.fromJson<String>(json['recognizedText']),
+ isVisible: serializer.fromJson<int>(json['isVisible']),
+ );
+ }
+ @override
+ Map<String, dynamic> toJson({ValueSerializer? serializer}) {
+ serializer ??= driftRuntimeOptions.defaultSerializer;
+ return <String, dynamic>{
+ 'id': serializer.toJson<String>(id),
+ 'assetId': serializer.toJson<String>(assetId),
+ 'x1': serializer.toJson<double>(x1),
+ 'y1': serializer.toJson<double>(y1),
+ 'x2': serializer.toJson<double>(x2),
+ 'y2': serializer.toJson<double>(y2),
+ 'x3': serializer.toJson<double>(x3),
+ 'y3': serializer.toJson<double>(y3),
+ 'x4': serializer.toJson<double>(x4),
+ 'y4': serializer.toJson<double>(y4),
+ 'boxScore': serializer.toJson<double>(boxScore),
+ 'textScore': serializer.toJson<double>(textScore),
+ 'recognizedText': serializer.toJson<String>(recognizedText),
+ 'isVisible': serializer.toJson<int>(isVisible),
+ };
+ }
+
+ AssetOcrEntityData copyWith({
+ String? id,
+ String? assetId,
+ double? x1,
+ double? y1,
+ double? x2,
+ double? y2,
+ double? x3,
+ double? y3,
+ double? x4,
+ double? y4,
+ double? boxScore,
+ double? textScore,
+ String? recognizedText,
+ int? isVisible,
+ }) => AssetOcrEntityData(
+ id: id ?? this.id,
+ assetId: assetId ?? this.assetId,
+ x1: x1 ?? this.x1,
+ y1: y1 ?? this.y1,
+ x2: x2 ?? this.x2,
+ y2: y2 ?? this.y2,
+ x3: x3 ?? this.x3,
+ y3: y3 ?? this.y3,
+ x4: x4 ?? this.x4,
+ y4: y4 ?? this.y4,
+ boxScore: boxScore ?? this.boxScore,
+ textScore: textScore ?? this.textScore,
+ recognizedText: recognizedText ?? this.recognizedText,
+ isVisible: isVisible ?? this.isVisible,
+ );
+ AssetOcrEntityData copyWithCompanion(AssetOcrEntityCompanion data) {
+ return AssetOcrEntityData(
+ id: data.id.present ? data.id.value : this.id,
+ assetId: data.assetId.present ? data.assetId.value : this.assetId,
+ x1: data.x1.present ? data.x1.value : this.x1,
+ y1: data.y1.present ? data.y1.value : this.y1,
+ x2: data.x2.present ? data.x2.value : this.x2,
+ y2: data.y2.present ? data.y2.value : this.y2,
+ x3: data.x3.present ? data.x3.value : this.x3,
+ y3: data.y3.present ? data.y3.value : this.y3,
+ x4: data.x4.present ? data.x4.value : this.x4,
+ y4: data.y4.present ? data.y4.value : this.y4,
+ boxScore: data.boxScore.present ? data.boxScore.value : this.boxScore,
+ textScore: data.textScore.present ? data.textScore.value : this.textScore,
+ recognizedText: data.recognizedText.present
+ ? data.recognizedText.value
+ : this.recognizedText,
+ isVisible: data.isVisible.present ? data.isVisible.value : this.isVisible,
+ );
+ }
+
+ @override
+ String toString() {
+ return (StringBuffer('AssetOcrEntityData(')
+ ..write('id: $id, ')
+ ..write('assetId: $assetId, ')
+ ..write('x1: $x1, ')
+ ..write('y1: $y1, ')
+ ..write('x2: $x2, ')
+ ..write('y2: $y2, ')
+ ..write('x3: $x3, ')
+ ..write('y3: $y3, ')
+ ..write('x4: $x4, ')
+ ..write('y4: $y4, ')
+ ..write('boxScore: $boxScore, ')
+ ..write('textScore: $textScore, ')
+ ..write('recognizedText: $recognizedText, ')
+ ..write('isVisible: $isVisible')
+ ..write(')'))
+ .toString();
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ id,
+ assetId,
+ x1,
+ y1,
+ x2,
+ y2,
+ x3,
+ y3,
+ x4,
+ y4,
+ boxScore,
+ textScore,
+ recognizedText,
+ isVisible,
+ );
+ @override
+ bool operator ==(Object other) =>
+ identical(this, other) ||
+ (other is AssetOcrEntityData &&
+ other.id == this.id &&
+ other.assetId == this.assetId &&
+ other.x1 == this.x1 &&
+ other.y1 == this.y1 &&
+ other.x2 == this.x2 &&
+ other.y2 == this.y2 &&
+ other.x3 == this.x3 &&
+ other.y3 == this.y3 &&
+ other.x4 == this.x4 &&
+ other.y4 == this.y4 &&
+ other.boxScore == this.boxScore &&
+ other.textScore == this.textScore &&
+ other.recognizedText == this.recognizedText &&
+ other.isVisible == this.isVisible);
+}
+
+class AssetOcrEntityCompanion extends UpdateCompanion<AssetOcrEntityData> {
+ final Value<String> id;
+ final Value<String> assetId;
+ final Value<double> x1;
+ final Value<double> y1;
+ final Value<double> x2;
+ final Value<double> y2;
+ final Value<double> x3;
+ final Value<double> y3;
+ final Value<double> x4;
+ final Value<double> y4;
+ final Value<double> boxScore;
+ final Value<double> textScore;
+ final Value<String> recognizedText;
+ final Value<int> isVisible;
+ const AssetOcrEntityCompanion({
+ this.id = const Value.absent(),
+ this.assetId = const Value.absent(),
+ this.x1 = const Value.absent(),
+ this.y1 = const Value.absent(),
+ this.x2 = const Value.absent(),
+ this.y2 = const Value.absent(),
+ this.x3 = const Value.absent(),
+ this.y3 = const Value.absent(),
+ this.x4 = const Value.absent(),
+ this.y4 = const Value.absent(),
+ this.boxScore = const Value.absent(),
+ this.textScore = const Value.absent(),
+ this.recognizedText = const Value.absent(),
+ this.isVisible = const Value.absent(),
+ });
+ AssetOcrEntityCompanion.insert({
+ required String id,
+ required String assetId,
+ required double x1,
+ required double y1,
+ required double x2,
+ required double y2,
+ required double x3,
+ required double y3,
+ required double x4,
+ required double y4,
+ required double boxScore,
+ required double textScore,
+ required String recognizedText,
+ this.isVisible = const Value.absent(),
+ }) : id = Value(id),
+ assetId = Value(assetId),
+ x1 = Value(x1),
+ y1 = Value(y1),
+ x2 = Value(x2),
+ y2 = Value(y2),
+ x3 = Value(x3),
+ y3 = Value(y3),
+ x4 = Value(x4),
+ y4 = Value(y4),
+ boxScore = Value(boxScore),
+ textScore = Value(textScore),
+ recognizedText = Value(recognizedText);
+ static Insertable<AssetOcrEntityData> custom({
+ Expression<String>? id,
+ Expression<String>? assetId,
+ Expression<double>? x1,
+ Expression<double>? y1,
+ Expression<double>? x2,
+ Expression<double>? y2,
+ Expression<double>? x3,
+ Expression<double>? y3,
+ Expression<double>? x4,
+ Expression<double>? y4,
+ Expression<double>? boxScore,
+ Expression<double>? textScore,
+ Expression<String>? recognizedText,
+ Expression<int>? isVisible,
+ }) {
+ return RawValuesInsertable({
+ if (id != null) 'id': id,
+ if (assetId != null) 'asset_id': assetId,
+ if (x1 != null) 'x1': x1,
+ if (y1 != null) 'y1': y1,
+ if (x2 != null) 'x2': x2,
+ if (y2 != null) 'y2': y2,
+ if (x3 != null) 'x3': x3,
+ if (y3 != null) 'y3': y3,
+ if (x4 != null) 'x4': x4,
+ if (y4 != null) 'y4': y4,
+ if (boxScore != null) 'box_score': boxScore,
+ if (textScore != null) 'text_score': textScore,
+ if (recognizedText != null) 'recognized_text': recognizedText,
+ if (isVisible != null) 'is_visible': isVisible,
+ });
+ }
+
+ AssetOcrEntityCompanion copyWith({
+ Value<String>? id,
+ Value<String>? assetId,
+ Value<double>? x1,
+ Value<double>? y1,
+ Value<double>? x2,
+ Value<double>? y2,
+ Value<double>? x3,
+ Value<double>? y3,
+ Value<double>? x4,
+ Value<double>? y4,
+ Value<double>? boxScore,
+ Value<double>? textScore,
+ Value<String>? recognizedText,
+ Value<int>? isVisible,
+ }) {
+ return AssetOcrEntityCompanion(
+ id: id ?? this.id,
+ assetId: assetId ?? this.assetId,
+ x1: x1 ?? this.x1,
+ y1: y1 ?? this.y1,
+ x2: x2 ?? this.x2,
+ y2: y2 ?? this.y2,
+ x3: x3 ?? this.x3,
+ y3: y3 ?? this.y3,
+ x4: x4 ?? this.x4,
+ y4: y4 ?? this.y4,
+ boxScore: boxScore ?? this.boxScore,
+ textScore: textScore ?? this.textScore,
+ recognizedText: recognizedText ?? this.recognizedText,
+ isVisible: isVisible ?? this.isVisible,
+ );
+ }
+
+ @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 (x1.present) {
+ map['x1'] = Variable<double>(x1.value);
+ }
+ if (y1.present) {
+ map['y1'] = Variable<double>(y1.value);
+ }
+ if (x2.present) {
+ map['x2'] = Variable<double>(x2.value);
+ }
+ if (y2.present) {
+ map['y2'] = Variable<double>(y2.value);
+ }
+ if (x3.present) {
+ map['x3'] = Variable<double>(x3.value);
+ }
+ if (y3.present) {
+ map['y3'] = Variable<double>(y3.value);
+ }
+ if (x4.present) {
+ map['x4'] = Variable<double>(x4.value);
+ }
+ if (y4.present) {
+ map['y4'] = Variable<double>(y4.value);
+ }
+ if (boxScore.present) {
+ map['box_score'] = Variable<double>(boxScore.value);
+ }
+ if (textScore.present) {
+ map['text_score'] = Variable<double>(textScore.value);
+ }
+ if (recognizedText.present) {
+ map['recognized_text'] = Variable<String>(recognizedText.value);
+ }
+ if (isVisible.present) {
+ map['is_visible'] = Variable<int>(isVisible.value);
+ }
+ return map;
+ }
+
+ @override
+ String toString() {
+ return (StringBuffer('AssetOcrEntityCompanion(')
+ ..write('id: $id, ')
+ ..write('assetId: $assetId, ')
+ ..write('x1: $x1, ')
+ ..write('y1: $y1, ')
+ ..write('x2: $x2, ')
+ ..write('y2: $y2, ')
+ ..write('x3: $x3, ')
+ ..write('y3: $y3, ')
+ ..write('x4: $x4, ')
+ ..write('y4: $y4, ')
+ ..write('boxScore: $boxScore, ')
+ ..write('textScore: $textScore, ')
+ ..write('recognizedText: $recognizedText, ')
+ ..write('isVisible: $isVisible')
+ ..write(')'))
+ .toString();
+ }
+}
+
+class DatabaseAtV29 extends GeneratedDatabase {
+ DatabaseAtV29(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 idxLocalAlbumAssetAlbumAsset = Index(
+ 'idx_local_album_asset_album_asset',
+ 'CREATE INDEX IF NOT EXISTS idx_local_album_asset_album_asset ON local_album_asset_entity (album_id, asset_id)',
+ );
+ 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 idxLocalAssetCloudId = Index(
+ 'idx_local_asset_cloud_id',
+ 'CREATE INDEX IF NOT EXISTS idx_local_asset_cloud_id ON local_asset_entity (i_cloud_id)',
+ );
+ late final Index idxLocalAssetCreatedAt = Index(
+ 'idx_local_asset_created_at',
+ 'CREATE INDEX IF NOT EXISTS idx_local_asset_created_at ON local_asset_entity (created_at)',
+ );
+ late final Index idxStackPrimaryAssetId = Index(
+ 'idx_stack_primary_asset_id',
+ 'CREATE INDEX IF NOT EXISTS idx_stack_primary_asset_id ON stack_entity (primary_asset_id)',
+ );
+ 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 Index idxRemoteAssetStackId = Index(
+ 'idx_remote_asset_stack_id',
+ 'CREATE INDEX IF NOT EXISTS idx_remote_asset_stack_id ON remote_asset_entity (stack_id)',
+ );
+ late final Index idxRemoteAssetOwnerVisibilityDeletedCreated = Index(
+ 'idx_remote_asset_owner_visibility_deleted_created',
+ 'CREATE INDEX IF NOT EXISTS idx_remote_asset_owner_visibility_deleted_created ON remote_asset_entity (owner_id, visibility, deleted_at, created_at DESC)',
+ );
+ 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 RemoteAssetCloudIdEntity remoteAssetCloudIdEntity =
+ RemoteAssetCloudIdEntity(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 AssetEditEntity assetEditEntity = AssetEditEntity(this);
+ late final Settings settings = Settings(this);
+ late final AssetOcrEntity assetOcrEntity = AssetOcrEntity(this);
+ late final Index idxPartnerSharedWithId = Index(
+ 'idx_partner_shared_with_id',
+ 'CREATE INDEX IF NOT EXISTS idx_partner_shared_with_id ON partner_entity (shared_with_id)',
+ );
+ 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 idxRemoteExifCity = Index(
+ 'idx_remote_exif_city',
+ 'CREATE INDEX IF NOT EXISTS idx_remote_exif_city ON remote_exif_entity (city) WHERE city IS NOT NULL',
+ );
+ late final Index idxRemoteAlbumAssetAlbumAsset = Index(
+ 'idx_remote_album_asset_album_asset',
+ 'CREATE INDEX IF NOT EXISTS idx_remote_album_asset_album_asset ON remote_album_asset_entity (album_id, asset_id)',
+ );
+ late final Index idxRemoteAssetCloudId = Index(
+ 'idx_remote_asset_cloud_id',
+ 'CREATE INDEX IF NOT EXISTS idx_remote_asset_cloud_id ON remote_asset_cloud_id_entity (cloud_id)',
+ );
+ late final Index idxPersonOwnerId = Index(
+ 'idx_person_owner_id',
+ 'CREATE INDEX IF NOT EXISTS idx_person_owner_id ON person_entity (owner_id)',
+ );
+ late final Index idxAssetFacePersonId = Index(
+ 'idx_asset_face_person_id',
+ 'CREATE INDEX IF NOT EXISTS idx_asset_face_person_id ON asset_face_entity (person_id)',
+ );
+ late final Index idxAssetFaceAssetId = Index(
+ 'idx_asset_face_asset_id',
+ 'CREATE INDEX IF NOT EXISTS idx_asset_face_asset_id ON asset_face_entity (asset_id)',
+ );
+ late final Index idxAssetFaceVisiblePerson = Index(
+ 'idx_asset_face_visible_person',
+ 'CREATE INDEX IF NOT EXISTS idx_asset_face_visible_person ON asset_face_entity (person_id, asset_id) WHERE is_visible = 1 AND deleted_at IS NULL',
+ );
+ 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)',
+ );
+ late final Index idxAssetEditAssetId = Index(
+ 'idx_asset_edit_asset_id',
+ 'CREATE INDEX IF NOT EXISTS idx_asset_edit_asset_id ON asset_edit_entity (asset_id)',
+ );
+ late final Index idxAssetOcrAssetId = Index(
+ 'idx_asset_ocr_asset_id',
+ 'CREATE INDEX IF NOT EXISTS idx_asset_ocr_asset_id ON asset_ocr_entity (asset_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,
+ idxLocalAlbumAssetAlbumAsset,
+ idxLocalAssetChecksum,
+ idxLocalAssetCloudId,
+ idxLocalAssetCreatedAt,
+ idxStackPrimaryAssetId,
+ uQRemoteAssetsOwnerChecksum,
+ uQRemoteAssetsOwnerLibraryChecksum,
+ idxRemoteAssetChecksum,
+ idxRemoteAssetStackId,
+ idxRemoteAssetOwnerVisibilityDeletedCreated,
+ authUserEntity,
+ userMetadataEntity,
+ partnerEntity,
+ remoteExifEntity,
+ remoteAlbumAssetEntity,
+ remoteAlbumUserEntity,
+ remoteAssetCloudIdEntity,
+ memoryEntity,
+ memoryAssetEntity,
+ personEntity,
+ assetFaceEntity,
+ storeEntity,
+ trashedLocalAssetEntity,
+ assetEditEntity,
+ settings,
+ assetOcrEntity,
+ idxPartnerSharedWithId,
+ idxLatLng,
+ idxRemoteExifCity,
+ idxRemoteAlbumAssetAlbumAsset,
+ idxRemoteAssetCloudId,
+ idxPersonOwnerId,
+ idxAssetFacePersonId,
+ idxAssetFaceAssetId,
+ idxAssetFaceVisiblePerson,
+ idxTrashedLocalAssetChecksum,
+ idxTrashedLocalAssetAlbum,
+ idxAssetEditAssetId,
+ idxAssetOcrAssetId,
+ ];
+ @override
+ StreamQueryUpdateRules get streamUpdateRules => const StreamQueryUpdateRules([
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'user_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('remote_asset_entity', kind: UpdateKind.delete)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'user_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('stack_entity', kind: UpdateKind.delete)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'remote_asset_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('remote_album_entity', kind: UpdateKind.update)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'remote_album_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('local_album_entity', kind: UpdateKind.update)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'local_asset_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [
+ TableUpdate('local_album_asset_entity', kind: UpdateKind.delete),
+ ],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'local_album_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [
+ TableUpdate('local_album_asset_entity', kind: UpdateKind.delete),
+ ],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'user_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('user_metadata_entity', kind: UpdateKind.delete)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'user_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('partner_entity', kind: UpdateKind.delete)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'user_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('partner_entity', kind: UpdateKind.delete)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'remote_asset_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('remote_exif_entity', kind: UpdateKind.delete)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'remote_asset_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [
+ TableUpdate('remote_album_asset_entity', kind: UpdateKind.delete),
+ ],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'remote_album_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [
+ TableUpdate('remote_album_asset_entity', kind: UpdateKind.delete),
+ ],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'remote_album_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [
+ TableUpdate('remote_album_user_entity', kind: UpdateKind.delete),
+ ],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'user_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [
+ TableUpdate('remote_album_user_entity', kind: UpdateKind.delete),
+ ],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'remote_asset_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [
+ TableUpdate('remote_asset_cloud_id_entity', kind: UpdateKind.delete),
+ ],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'user_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('memory_entity', kind: UpdateKind.delete)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'remote_asset_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('memory_asset_entity', kind: UpdateKind.delete)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'memory_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('memory_asset_entity', kind: UpdateKind.delete)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'user_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('person_entity', kind: UpdateKind.delete)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'remote_asset_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('asset_face_entity', kind: UpdateKind.delete)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'person_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('asset_face_entity', kind: UpdateKind.update)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'remote_asset_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('asset_edit_entity', kind: UpdateKind.delete)],
+ ),
+ WritePropagation(
+ on: TableUpdateQuery.onTableName(
+ 'remote_asset_entity',
+ limitUpdateKind: UpdateKind.delete,
+ ),
+ result: [TableUpdate('asset_ocr_entity', kind: UpdateKind.delete)],
+ ),
+ ]);
+ @override
+ int get schemaVersion => 29;
+ @override
+ DriftDatabaseOptions get options =>
+ const DriftDatabaseOptions(storeDateTimeAsText: true);
+}
diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json
index 5cfc6ead0a..82f45fcfe7 100644
--- a/open-api/immich-openapi-specs.json
+++ b/open-api/immich-openapi-specs.json
@@ -23805,6 +23805,118 @@
],
"type": "object"
},
+ "SyncAssetOcrDeleteV1": {
+ "properties": {
+ "assetId": {
+ "description": "Original asset ID of the deleted OCR entry",
+ "type": "string"
+ },
+ "deletedAt": {
+ "description": "Timestamp when the OCR entry was deleted",
+ "example": "2024-01-01T00:00:00.000Z",
+ "format": "date-time",
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
+ "type": "string"
+ },
+ "id": {
+ "description": "Audit row ID of the deleted OCR entry",
+ "type": "string"
+ }
+ },
+ "required": [
+ "assetId",
+ "deletedAt",
+ "id"
+ ],
+ "type": "object"
+ },
+ "SyncAssetOcrV1": {
+ "properties": {
+ "assetId": {
+ "description": "Asset ID",
+ "type": "string"
+ },
+ "boxScore": {
+ "description": "Confidence score of the bounding box",
+ "format": "double",
+ "type": "number"
+ },
+ "id": {
+ "description": "OCR entry ID",
+ "type": "string"
+ },
+ "isVisible": {
+ "description": "Whether the OCR entry is visible",
+ "type": "boolean"
+ },
+ "text": {
+ "description": "Recognized text content",
+ "type": "string"
+ },
+ "textScore": {
+ "description": "Confidence score of the recognized text",
+ "format": "double",
+ "type": "number"
+ },
+ "x1": {
+ "description": "Top-left X coordinate (normalized 0–1)",
+ "format": "double",
+ "type": "number"
+ },
+ "x2": {
+ "description": "Top-right X coordinate (normalized 0–1)",
+ "format": "double",
+ "type": "number"
+ },
+ "x3": {
+ "description": "Bottom-right X coordinate (normalized 0–1)",
+ "format": "double",
+ "type": "number"
+ },
+ "x4": {
+ "description": "Bottom-left X coordinate (normalized 0–1)",
+ "format": "double",
+ "type": "number"
+ },
+ "y1": {
+ "description": "Top-left Y coordinate (normalized 0–1)",
+ "format": "double",
+ "type": "number"
+ },
+ "y2": {
+ "description": "Top-right Y coordinate (normalized 0–1)",
+ "format": "double",
+ "type": "number"
+ },
+ "y3": {
+ "description": "Bottom-right Y coordinate (normalized 0–1)",
+ "format": "double",
+ "type": "number"
+ },
+ "y4": {
+ "description": "Bottom-left Y coordinate (normalized 0–1)",
+ "format": "double",
+ "type": "number"
+ }
+ },
+ "required": [
+ "assetId",
+ "boxScore",
+ "id",
+ "isVisible",
+ "text",
+ "textScore",
+ "x1",
+ "x2",
+ "x3",
+ "x4",
+ "y1",
+ "y2",
+ "y3",
+ "y4"
+ ],
+ "type": "object"
+ },
"SyncAssetV1": {
"properties": {
"checksum": {
@@ -24186,6 +24298,8 @@
"AssetEditDeleteV1",
"AssetMetadataV1",
"AssetMetadataDeleteV1",
+ "AssetOcrV1",
+ "AssetOcrDeleteV1",
"PartnerV1",
"PartnerDeleteV1",
"PartnerAssetV1",
@@ -24508,6 +24622,7 @@
"AssetExifsV1",
"AssetEditsV1",
"AssetMetadataV1",
+ "AssetOcrV1",
"AuthUsersV1",
"MemoriesV1",
"MemoryToAssetsV1",
diff --git a/packages/sdk/src/fetch-client.ts b/packages/sdk/src/fetch-client.ts
index 0791c15d44..7503208d27 100644
--- a/packages/sdk/src/fetch-client.ts
+++ b/packages/sdk/src/fetch-client.ts
@@ -3013,6 +3013,44 @@ export type SyncAssetMetadataV1 = {
[key: string]: any;
};
};
+export type SyncAssetOcrDeleteV1 = {
+ /** Original asset ID of the deleted OCR entry */
+ assetId: string;
+ /** Timestamp when the OCR entry was deleted */
+ deletedAt: string;
+ /** Audit row ID of the deleted OCR entry */
+ id: string;
+};
+export type SyncAssetOcrV1 = {
+ /** Asset ID */
+ assetId: string;
+ /** Confidence score of the bounding box */
+ boxScore: number;
+ /** OCR entry ID */
+ id: string;
+ /** Whether the OCR entry is visible */
+ isVisible: boolean;
+ /** Recognized text content */
+ text: string;
+ /** Confidence score of the recognized text */
+ textScore: number;
+ /** Top-left X coordinate (normalized 0–1) */
+ x1: number;
+ /** Top-right X coordinate (normalized 0–1) */
+ x2: number;
+ /** Bottom-right X coordinate (normalized 0–1) */
+ x3: number;
+ /** Bottom-left X coordinate (normalized 0–1) */
+ x4: number;
+ /** Top-left Y coordinate (normalized 0–1) */
+ y1: number;
+ /** Top-right Y coordinate (normalized 0–1) */
+ y2: number;
+ /** Bottom-right Y coordinate (normalized 0–1) */
+ y3: number;
+ /** Bottom-left Y coordinate (normalized 0–1) */
+ y4: number;
+};
export type SyncAssetV1 = {
/** Checksum */
checksum: string;
@@ -7336,6 +7374,8 @@ export enum SyncEntityType {
AssetEditDeleteV1 = "AssetEditDeleteV1",
AssetMetadataV1 = "AssetMetadataV1",
AssetMetadataDeleteV1 = "AssetMetadataDeleteV1",
+ AssetOcrV1 = "AssetOcrV1",
+ AssetOcrDeleteV1 = "AssetOcrDeleteV1",
PartnerV1 = "PartnerV1",
PartnerDeleteV1 = "PartnerDeleteV1",
PartnerAssetV1 = "PartnerAssetV1",
@@ -7396,6 +7436,7 @@ export enum SyncRequestType {
AssetExifsV1 = "AssetExifsV1",
AssetEditsV1 = "AssetEditsV1",
AssetMetadataV1 = "AssetMetadataV1",
+ AssetOcrV1 = "AssetOcrV1",
AuthUsersV1 = "AuthUsersV1",
MemoriesV1 = "MemoriesV1",
MemoryToAssetsV1 = "MemoryToAssetsV1",
diff --git a/server/src/database.ts b/server/src/database.ts
index 08f080e0ae..e9ca494b27 100644
--- a/server/src/database.ts
+++ b/server/src/database.ts
@@ -444,6 +444,23 @@ export const columns = {
'asset_exif.rating',
'asset_exif.fps',
],
+ syncAssetOcr: [
+ 'asset_ocr.id',
+ 'asset_ocr.assetId',
+ 'asset_ocr.x1',
+ 'asset_ocr.y1',
+ 'asset_ocr.x2',
+ 'asset_ocr.y2',
+ 'asset_ocr.x3',
+ 'asset_ocr.y3',
+ 'asset_ocr.x4',
+ 'asset_ocr.y4',
+ 'asset_ocr.text',
+ 'asset_ocr.boxScore',
+ 'asset_ocr.textScore',
+ 'asset_ocr.updateId',
+ 'asset_ocr.isVisible',
+ ],
syncAssetEdit: [
'asset_edit.id',
'asset_edit.assetId',
diff --git a/server/src/dtos/sync.dto.ts b/server/src/dtos/sync.dto.ts
index 698939e627..531ac6277c 100644
--- a/server/src/dtos/sync.dto.ts
+++ b/server/src/dtos/sync.dto.ts
@@ -401,6 +401,41 @@ class SyncMemoryDeleteV1 extends createZodDto(SyncMemoryDeleteV1Schema) {}
class SyncMemoryAssetV1 extends createZodDto(SyncMemoryAssetV1Schema) {}
@ExtraModel()
class SyncMemoryAssetDeleteV1 extends createZodDto(SyncMemoryAssetDeleteV1Schema) {}
+
+const SyncAssetOcrV1Schema = z
+ .object({
+ id: z.string().describe('OCR entry ID'),
+ assetId: z.string().describe('Asset ID'),
+
+ x1: z.number().meta({ format: 'double' }).describe('Top-left X coordinate (normalized 0–1)'),
+ y1: z.number().meta({ format: 'double' }).describe('Top-left Y coordinate (normalized 0–1)'),
+ x2: z.number().meta({ format: 'double' }).describe('Top-right X coordinate (normalized 0–1)'),
+ y2: z.number().meta({ format: 'double' }).describe('Top-right Y coordinate (normalized 0–1)'),
+ x3: z.number().meta({ format: 'double' }).describe('Bottom-right X coordinate (normalized 0–1)'),
+ y3: z.number().meta({ format: 'double' }).describe('Bottom-right Y coordinate (normalized 0–1)'),
+ x4: z.number().meta({ format: 'double' }).describe('Bottom-left X coordinate (normalized 0–1)'),
+ y4: z.number().meta({ format: 'double' }).describe('Bottom-left Y coordinate (normalized 0–1)'),
+
+ boxScore: z.number().meta({ format: 'double' }).describe('Confidence score of the bounding box'),
+ textScore: z.number().meta({ format: 'double' }).describe('Confidence score of the recognized text'),
+ text: z.string().describe('Recognized text content'),
+ isVisible: z.boolean().describe('Whether the OCR entry is visible'),
+ })
+ .meta({ id: 'SyncAssetOcrV1' });
+
+const SyncAssetOcrDeleteV1Schema = z
+ .object({
+ id: z.string().describe('Audit row ID of the deleted OCR entry'),
+ assetId: z.string().describe('Original asset ID of the deleted OCR entry'),
+ deletedAt: isoDatetimeToDate.describe('Timestamp when the OCR entry was deleted'),
+ })
+ .meta({ id: 'SyncAssetOcrDeleteV1' });
+
+@ExtraModel()
+class SyncAssetOcrV1 extends createZodDto(SyncAssetOcrV1Schema) {}
+
+@ExtraModel()
+class SyncAssetOcrDeleteV1 extends createZodDto(SyncAssetOcrDeleteV1Schema) {}
@ExtraModel()
class SyncStackV1 extends createZodDto(SyncStackV1Schema) {}
@ExtraModel()
@@ -437,6 +472,8 @@ export type SyncItem = {
[SyncEntityType.AssetMetadataV1]: SyncAssetMetadataV1;
[SyncEntityType.AssetMetadataDeleteV1]: SyncAssetMetadataDeleteV1;
[SyncEntityType.AssetExifV1]: SyncAssetExifV1;
+ [SyncEntityType.AssetOcrV1]: SyncAssetOcrV1;
+ [SyncEntityType.AssetOcrDeleteV1]: SyncAssetOcrDeleteV1;
[SyncEntityType.AssetEditV1]: SyncAssetEditV1;
[SyncEntityType.AssetEditDeleteV1]: SyncAssetEditDeleteV1;
[SyncEntityType.PartnerAssetV2]: SyncAssetV2;
diff --git a/server/src/enum.ts b/server/src/enum.ts
index 04c4898779..39238a5759 100644
--- a/server/src/enum.ts
+++ b/server/src/enum.ts
@@ -952,6 +952,7 @@ export enum SyncRequestType {
AssetExifsV1 = 'AssetExifsV1',
AssetEditsV1 = 'AssetEditsV1',
AssetMetadataV1 = 'AssetMetadataV1',
+ AssetOcrV1 = 'AssetOcrV1',
AuthUsersV1 = 'AuthUsersV1',
MemoriesV1 = 'MemoriesV1',
MemoryToAssetsV1 = 'MemoryToAssetsV1',
@@ -990,6 +991,8 @@ export enum SyncEntityType {
AssetEditDeleteV1 = 'AssetEditDeleteV1',
AssetMetadataV1 = 'AssetMetadataV1',
AssetMetadataDeleteV1 = 'AssetMetadataDeleteV1',
+ AssetOcrV1 = 'AssetOcrV1',
+ AssetOcrDeleteV1 = 'AssetOcrDeleteV1',
PartnerV1 = 'PartnerV1',
PartnerDeleteV1 = 'PartnerDeleteV1',
diff --git a/server/src/queries/sync.repository.sql b/server/src/queries/sync.repository.sql
index 1404a24ba7..36265e8d63 100644
--- a/server/src/queries/sync.repository.sql
+++ b/server/src/queries/sync.repository.sql
@@ -579,6 +579,48 @@ where
order by
"asset_metadata"."updateId" asc
+-- SyncRepository.assetOcr.getDeletes
+select
+ "asset_ocr_audit"."id",
+ "asset_ocr_audit"."assetId",
+ "asset_ocr_audit"."deletedAt"
+from
+ "asset_ocr_audit" as "asset_ocr_audit"
+ left join "asset" on "asset"."id" = "asset_ocr_audit"."assetId"
+where
+ "asset_ocr_audit"."id" < $1
+ and "asset_ocr_audit"."id" > $2
+ and "asset"."ownerId" = $3
+order by
+ "asset_ocr_audit"."id" asc
+
+-- SyncRepository.assetOcr.getUpserts
+select
+ "asset_ocr"."id",
+ "asset_ocr"."assetId",
+ "asset_ocr"."x1",
+ "asset_ocr"."y1",
+ "asset_ocr"."x2",
+ "asset_ocr"."y2",
+ "asset_ocr"."x3",
+ "asset_ocr"."y3",
+ "asset_ocr"."x4",
+ "asset_ocr"."y4",
+ "asset_ocr"."text",
+ "asset_ocr"."boxScore",
+ "asset_ocr"."textScore",
+ "asset_ocr"."updateId",
+ "asset_ocr"."isVisible"
+from
+ "asset_ocr" as "asset_ocr"
+ inner join "asset" on "asset"."id" = "asset_ocr"."assetId"
+where
+ "asset_ocr"."updateId" < $1
+ and "asset_ocr"."updateId" > $2
+ and "asset"."ownerId" = $3
+order by
+ "asset_ocr"."updateId" asc
+
-- SyncRepository.authUser.getUpserts
select
"id",
diff --git a/server/src/repositories/sync.repository.ts b/server/src/repositories/sync.repository.ts
index 5ca1d541d6..e5832df8ee 100644
--- a/server/src/repositories/sync.repository.ts
+++ b/server/src/repositories/sync.repository.ts
@@ -56,6 +56,7 @@ export class SyncRepository {
assetEdit: AssetEditSync;
assetFace: AssetFaceSync;
assetMetadata: AssetMetadataSync;
+ assetOcr: AssetOcrSync;
authUser: AuthUserSync;
memory: MemorySync;
memoryToAsset: MemoryToAssetSync;
@@ -79,6 +80,7 @@ export class SyncRepository {
this.assetEdit = new AssetEditSync(this.db);
this.assetFace = new AssetFaceSync(this.db);
this.assetMetadata = new AssetMetadataSync(this.db);
+ this.assetOcr = new AssetOcrSync(this.db);
this.authUser = new AuthUserSync(this.db);
this.memory = new MemorySync(this.db);
this.memoryToAsset = new MemoryToAssetSync(this.db);
@@ -769,3 +771,27 @@ class AssetMetadataSync extends BaseSync {
.stream();
}
}
+
+class AssetOcrSync extends BaseSync {
+ @GenerateSql({ params: [dummyQueryOptions, DummyValue.UUID], stream: true })
+ getDeletes(options: SyncQueryOptions, userId: string) {
+ return this.auditQuery('asset_ocr_audit', options)
+ .select(['asset_ocr_audit.id', 'asset_ocr_audit.assetId', 'asset_ocr_audit.deletedAt'])
+ .leftJoin('asset', 'asset.id', 'asset_ocr_audit.assetId')
+ .where('asset.ownerId', '=', userId)
+ .stream();
+ }
+
+ cleanupAuditTable(daysAgo: number) {
+ return this.auditCleanup('asset_ocr_audit', daysAgo);
+ }
+
+ @GenerateSql({ params: [dummyQueryOptions, DummyValue.UUID], stream: true })
+ getUpserts(options: SyncQueryOptions, userId: string) {
+ return this.upsertQuery('asset_ocr', options)
+ .select(columns.syncAssetOcr)
+ .innerJoin('asset', 'asset.id', 'asset_ocr.assetId')
+ .where('asset.ownerId', '=', userId)
+ .stream();
+ }
+}
diff --git a/server/src/schema/functions.ts b/server/src/schema/functions.ts
index 23080ae0a8..230f22478d 100644
--- a/server/src/schema/functions.ts
+++ b/server/src/schema/functions.ts
@@ -287,3 +287,16 @@ export const asset_edit_audit = registerFunction({
RETURN NULL;
END`,
});
+
+export const asset_ocr_delete_audit = registerFunction({
+ name: 'asset_ocr_delete_audit',
+ returnType: 'TRIGGER',
+ language: 'PLPGSQL',
+ body: `
+ BEGIN
+ INSERT INTO asset_ocr_audit ("assetId")
+ SELECT "assetId"
+ FROM OLD;
+ RETURN NULL;
+ END`,
+});
diff --git a/server/src/schema/index.ts b/server/src/schema/index.ts
index 033f0acd11..5bbe7cf4f4 100644
--- a/server/src/schema/index.ts
+++ b/server/src/schema/index.ts
@@ -11,6 +11,7 @@ import {
asset_delete_audit,
asset_face_audit,
asset_metadata_audit,
+ asset_ocr_delete_audit,
f_concat_ws,
f_unaccent,
immich_uuid_v7,
@@ -43,6 +44,7 @@ import { AssetFileTable } from 'src/schema/tables/asset-file.table';
import { AssetJobStatusTable } from 'src/schema/tables/asset-job-status.table';
import { AssetMetadataAuditTable } from 'src/schema/tables/asset-metadata-audit.table';
import { AssetMetadataTable } from 'src/schema/tables/asset-metadata.table';
+import { AssetOcrAuditTable } from 'src/schema/tables/asset-ocr-audit.table';
import { AssetOcrTable } from 'src/schema/tables/asset-ocr.table';
import { AssetTable } from 'src/schema/tables/asset.table';
import { FaceSearchTable } from 'src/schema/tables/face-search.table';
@@ -107,6 +109,7 @@ export class ImmichDatabase {
AssetMetadataAuditTable,
AssetJobStatusTable,
AssetOcrTable,
+ AssetOcrAuditTable,
AssetTable,
AssetFileTable,
AssetExifTable,
@@ -168,6 +171,7 @@ export class ImmichDatabase {
user_metadata_audit,
asset_metadata_audit,
asset_face_audit,
+ asset_ocr_delete_audit,
];
enum = [album_user_role_enum, assets_status_enum, asset_face_source_type, asset_visibility_enum];
@@ -205,6 +209,7 @@ export interface DB {
asset_metadata_audit: AssetMetadataAuditTable;
asset_job_status: AssetJobStatusTable;
asset_ocr: AssetOcrTable;
+ asset_ocr_audit: AssetOcrAuditTable;
asset_audio: AssetAudioTable;
asset_video: AssetVideoTable;
asset_keyframe: AssetKeyframeTable;
diff --git a/server/src/schema/migrations/1780592071031-AssetOcrSync.ts b/server/src/schema/migrations/1780592071031-AssetOcrSync.ts
new file mode 100644
index 0000000000..f65654f001
--- /dev/null
+++ b/server/src/schema/migrations/1780592071031-AssetOcrSync.ts
@@ -0,0 +1,58 @@
+import { Kysely, sql } from 'kysely';
+
+export async function up(db: Kysely<any>): Promise<void> {
+ await sql`CREATE OR REPLACE FUNCTION asset_edit_delete()
+ RETURNS TRIGGER
+ LANGUAGE PLPGSQL
+ AS $$
+ BEGIN
+ UPDATE asset
+ SET "isEdited" = false
+ FROM deleted_edit
+ WHERE asset.id = deleted_edit."assetId" AND asset."isEdited"
+ AND NOT EXISTS (SELECT FROM asset_edit edit WHERE edit."assetId" = asset.id);
+ RETURN NULL;
+ END
+ $$;`.execute(db);
+ await sql`CREATE OR REPLACE FUNCTION asset_ocr_delete_audit()
+ RETURNS TRIGGER
+ LANGUAGE PLPGSQL
+ AS $$
+ BEGIN
+ INSERT INTO asset_ocr_audit ("assetId")
+ SELECT "assetId"
+ FROM OLD;
+ RETURN NULL;
+ END
+ $$;`.execute(db);
+ await sql`CREATE TABLE "asset_ocr_audit" (
+ "id" uuid NOT NULL DEFAULT immich_uuid_v7(),
+ "assetId" uuid NOT NULL,
+ "deletedAt" timestamp with time zone NOT NULL DEFAULT clock_timestamp(),
+ CONSTRAINT "asset_ocr_audit_pkey" PRIMARY KEY ("id")
+);`.execute(db);
+ await sql`CREATE INDEX "asset_ocr_audit_assetId_idx" ON "asset_ocr_audit" ("assetId");`.execute(db);
+ await sql`CREATE INDEX "asset_ocr_audit_deletedAt_idx" ON "asset_ocr_audit" ("deletedAt");`.execute(db);
+ await sql`ALTER TABLE "asset_ocr" ADD "updateId" uuid NOT NULL DEFAULT immich_uuid_v7();`.execute(db);
+ await sql`CREATE INDEX "asset_ocr_updateId_idx" ON "asset_ocr" ("updateId");`.execute(db);
+ await sql`CREATE OR REPLACE TRIGGER "asset_ocr_delete_audit"
+ AFTER DELETE ON "asset_ocr"
+ REFERENCING OLD TABLE AS "old"
+ FOR EACH STATEMENT
+ WHEN (pg_trigger_depth() = 0)
+ EXECUTE FUNCTION asset_ocr_delete_audit();`.execute(db);
+ await sql`INSERT INTO "migration_overrides" ("name", "value") VALUES ('function_asset_ocr_delete_audit', '{"type":"function","name":"asset_ocr_delete_audit","sql":"CREATE OR REPLACE FUNCTION asset_ocr_delete_audit()\\n RETURNS TRIGGER\\n LANGUAGE PLPGSQL\\n AS $$\\n BEGIN\\n INSERT INTO asset_ocr_audit (\\"assetId\\")\\n SELECT \\"assetId\\"\\n FROM OLD;\\n RETURN NULL;\\n END\\n $$;"}'::jsonb);`.execute(db);
+ await sql`INSERT INTO "migration_overrides" ("name", "value") VALUES ('trigger_asset_ocr_delete_audit', '{"type":"trigger","name":"asset_ocr_delete_audit","sql":"CREATE OR REPLACE TRIGGER \\"asset_ocr_delete_audit\\"\\n AFTER DELETE ON \\"asset_ocr\\"\\n REFERENCING OLD TABLE AS \\"old\\"\\n FOR EACH STATEMENT\\n WHEN (pg_trigger_depth() = 0)\\n EXECUTE FUNCTION asset_ocr_delete_audit();"}'::jsonb);`.execute(db);
+ await sql`UPDATE "migration_overrides" SET "value" = '{"type":"function","name":"asset_edit_delete","sql":"CREATE OR REPLACE FUNCTION asset_edit_delete()\\n RETURNS TRIGGER\\n LANGUAGE PLPGSQL\\n AS $$\\n BEGIN\\n UPDATE asset\\n SET \\"isEdited\\" = false\\n FROM deleted_edit\\n WHERE asset.id = deleted_edit.\\"assetId\\" AND asset.\\"isEdited\\"\\n AND NOT EXISTS (SELECT FROM asset_edit edit WHERE edit.\\"assetId\\" = asset.id);\\n RETURN NULL;\\n END\\n $$;"}'::jsonb WHERE "name" = 'function_asset_edit_delete';`.execute(db);
+}
+
+export async function down(db: Kysely<any>): Promise<void> {
+ await sql`DROP TRIGGER "asset_ocr_delete_audit" ON "asset_ocr";`.execute(db);
+ await sql`DROP INDEX "asset_ocr_updateId_idx";`.execute(db);
+ await sql`ALTER TABLE "asset_ocr" DROP COLUMN "updateId";`.execute(db);
+ await sql`DROP TABLE "asset_ocr_audit";`.execute(db);
+ await sql`DROP FUNCTION asset_ocr_delete_audit;`.execute(db);
+ await sql`UPDATE "migration_overrides" SET "value" = '{"sql":"CREATE OR REPLACE FUNCTION asset_edit_delete()\\n RETURNS TRIGGER\\n LANGUAGE PLPGSQL\\n AS $$\\n BEGIN\\n UPDATE asset\\n SET \\"isEdited\\" = false\\n FROM deleted_edit\\n WHERE asset.id = deleted_edit.\\"assetId\\" AND asset.\\"isEdited\\" \\n AND NOT EXISTS (SELECT FROM asset_edit edit WHERE edit.\\"assetId\\" = asset.id);\\n RETURN NULL;\\n END\\n $$;","name":"asset_edit_delete","type":"function"}'::jsonb WHERE "name" = 'function_asset_edit_delete';`.execute(db);
+ await sql`DELETE FROM "migration_overrides" WHERE "name" = 'function_asset_ocr_delete_audit';`.execute(db);
+ await sql`DELETE FROM "migration_overrides" WHERE "name" = 'trigger_asset_ocr_delete_audit';`.execute(db);
+}
diff --git a/server/src/schema/tables/asset-ocr-audit.table.ts b/server/src/schema/tables/asset-ocr-audit.table.ts
new file mode 100644
index 0000000000..8c7efe1d66
--- /dev/null
+++ b/server/src/schema/tables/asset-ocr-audit.table.ts
@@ -0,0 +1,14 @@
+import { Column, CreateDateColumn, Generated, Table } from '@immich/sql-tools';
+import { PrimaryGeneratedUuidV7Column } from 'src/decorators';
+
+@Table('asset_ocr_audit')
+export class AssetOcrAuditTable {
+ @PrimaryGeneratedUuidV7Column()
+ id!: Generated<string>;
+
+ @Column({ type: 'uuid', index: true })
+ assetId!: string;
+
+ @CreateDateColumn({ default: () => 'clock_timestamp()', index: true })
+ deletedAt!: Date;
+}
diff --git a/server/src/schema/tables/asset-ocr.table.ts b/server/src/schema/tables/asset-ocr.table.ts
index b58224a247..f2c4e40032 100644
--- a/server/src/schema/tables/asset-ocr.table.ts
+++ b/server/src/schema/tables/asset-ocr.table.ts
@@ -1,7 +1,22 @@
-import { Column, ForeignKeyColumn, Generated, PrimaryGeneratedColumn, Table } from '@immich/sql-tools';
+import {
+ AfterDeleteTrigger,
+ Column,
+ ForeignKeyColumn,
+ Generated,
+ PrimaryGeneratedColumn,
+ Table,
+} from '@immich/sql-tools';
+import { UpdateIdColumn } from 'src/decorators';
+import { asset_ocr_delete_audit } from 'src/schema/functions';
import { AssetTable } from 'src/schema/tables/asset.table';
@Table('asset_ocr')
+@AfterDeleteTrigger({
+ scope: 'statement',
+ function: asset_ocr_delete_audit,
+ referencingOldTableAs: 'old',
+ when: 'pg_trigger_depth() = 0',
+})
export class AssetOcrTable {
@PrimaryGeneratedColumn()
id!: Generated<string>;
@@ -45,4 +60,7 @@ export class AssetOcrTable {
@Column({ type: 'boolean', default: true })
isVisible!: Generated<boolean>;
+
+ @UpdateIdColumn({ index: true })
+ updateId!: Generated<string>;
}
diff --git a/server/src/services/sync.service.ts b/server/src/services/sync.service.ts
index 68c127eb56..2feb5a0b76 100644
--- a/server/src/services/sync.service.ts
+++ b/server/src/services/sync.service.ts
@@ -68,6 +68,7 @@ export const SYNC_TYPES_ORDER = [
SyncRequestType.AlbumToAssetsV1,
SyncRequestType.AssetExifsV1,
SyncRequestType.AlbumAssetExifsV1,
+ SyncRequestType.AssetOcrV1,
SyncRequestType.PartnerAssetExifsV1,
SyncRequestType.MemoriesV1,
SyncRequestType.MemoryToAssetsV1,
@@ -188,6 +189,7 @@ export class SyncService extends BaseService {
[SyncRequestType.PeopleV1]: () => this.syncPeopleV1(options, response, checkpointMap),
[SyncRequestType.AssetFacesV2]: () => this.syncAssetFacesV2(options, response, checkpointMap),
[SyncRequestType.UserMetadataV1]: () => this.syncUserMetadataV1(options, response, checkpointMap),
+ [SyncRequestType.AssetOcrV1]: () => this.syncAssetOcrV1(options, response, checkpointMap, auth),
} as const;
for (const type of SYNC_TYPES_ORDER.filter((type) => dto.types.includes(type))) {
@@ -218,6 +220,7 @@ export class SyncService extends BaseService {
await this.syncRepository.stack.cleanupAuditTable(pruneThreshold);
await this.syncRepository.user.cleanupAuditTable(pruneThreshold);
await this.syncRepository.userMetadata.cleanupAuditTable(pruneThreshold);
+ await this.syncRepository.assetOcr.cleanupAuditTable(pruneThreshold);
}
private needsFullSync(checkpointMap: CheckpointMap) {
@@ -888,6 +891,33 @@ export class SyncService extends BaseService {
}
}
+ private async syncAssetOcrV1(
+ options: SyncQueryOptions,
+ response: Writable,
+ checkpointMap: CheckpointMap,
+ auth: AuthDto,
+ ) {
+ const deleteType = SyncEntityType.AssetOcrDeleteV1;
+ const deletes = this.syncRepository.assetOcr.getDeletes(
+ { ...options, ack: checkpointMap[deleteType] },
+ auth.user.id,
+ );
+
+ for await (const row of deletes) {
+ send(response, { type: deleteType, ids: [row.id], data: row });
+ }
+
+ const upsertType = SyncEntityType.AssetOcrV1;
+ const upserts = this.syncRepository.assetOcr.getUpserts(
+ { ...options, ack: checkpointMap[upsertType] },
+ auth.user.id,
+ );
+
+ for await (const { updateId, ...data } of upserts) {
+ send(response, { type: upsertType, ids: [updateId], data });
+ }
+ }
+
private async upsertBackfillCheckpoint(item: { type: SyncEntityType; sessionId: string; createId: string }) {
const { type, sessionId, createId } = item;
await this.syncCheckpointRepository.upsertAll([
diff --git a/server/test/medium/specs/services/ocr.service.spec.ts b/server/test/medium/specs/services/ocr.service.spec.ts
index d9d3a9f9b9..5f69aea850 100644
--- a/server/test/medium/specs/services/ocr.service.spec.ts
+++ b/server/test/medium/specs/services/ocr.service.spec.ts
@@ -55,6 +55,7 @@ describe(OcrService.name, () => {
assetId: asset.id,
boxScore: 0.99,
id: expect.any(String),
+ updateId: expect.any(String),
text: 'Test OCR',
textScore: 0.95,
isVisible: true,
@@ -105,6 +106,7 @@ describe(OcrService.name, () => {
assetId: asset.id,
boxScore: 0.7,
id: expect.any(String),
+ updateId: expect.any(String),
text: 'One',
textScore: 0.9,
isVisible: true,
@@ -121,6 +123,7 @@ describe(OcrService.name, () => {
assetId: asset.id,
boxScore: 0.67,
id: expect.any(String),
+ updateId: expect.any(String),
text: 'Two',
textScore: 0.89,
isVisible: true,
@@ -137,6 +140,7 @@ describe(OcrService.name, () => {
assetId: asset.id,
boxScore: 0.65,
id: expect.any(String),
+ updateId: expect.any(String),
text: 'Three',
textScore: 0.88,
isVisible: true,
@@ -153,6 +157,7 @@ describe(OcrService.name, () => {
assetId: asset.id,
boxScore: 0.62,
id: expect.any(String),
+ updateId: expect.any(String),
text: 'Four',
textScore: 0.87,
isVisible: true,
@@ -169,6 +174,7 @@ describe(OcrService.name, () => {
assetId: asset.id,
boxScore: 0.6,
id: expect.any(String),
+ updateId: expect.any(String),
text: 'Five',
textScore: 0.86,
isVisible: true,
diff --git a/server/test/medium/specs/sync/sync-asset-ocr.spec.ts b/server/test/medium/specs/sync/sync-asset-ocr.spec.ts
new file mode 100644
index 0000000000..02d6808ecf
--- /dev/null
+++ b/server/test/medium/specs/sync/sync-asset-ocr.spec.ts
@@ -0,0 +1,379 @@
+import { Kysely } from 'kysely';
+import { SyncEntityType, SyncRequestType } from 'src/enum';
+import { OcrRepository } from 'src/repositories/ocr.repository';
+import { DB } from 'src/schema';
+import { SyncTestContext } from 'test/medium.factory';
+import { getKyselyDB } from 'test/utils';
+
+let defaultDatabase: Kysely<DB>;
+
+const setup = async (db?: Kysely<DB>) => {
+ const ctx = new SyncTestContext(db || defaultDatabase);
+ const { auth, user, session } = await ctx.newSyncAuthUser();
+ return { auth, user, session, ctx };
+};
+
+beforeAll(async () => {
+ defaultDatabase = await getKyselyDB();
+});
+
+describe(SyncEntityType.AssetOcrV1, () => {
+ it('should detect and sync new asset OCR', async () => {
+ const { auth, user, ctx } = await setup();
+
+ const ocrRepo = ctx.get(OcrRepository);
+ const { asset } = await ctx.newAsset({ ownerId: user.id });
+ await ocrRepo.upsert(
+ asset.id,
+ [
+ {
+ assetId: asset.id,
+ x1: 0.1,
+ y1: 0.2,
+ x2: 0.9,
+ y2: 0.2,
+ x3: 0.9,
+ y3: 0.8,
+ x4: 0.1,
+ y4: 0.8,
+ boxScore: 0.95,
+ textScore: 0.92,
+ text: 'Hello World',
+ isVisible: true,
+ },
+ ],
+ 'Hello World',
+ );
+
+ const response = await ctx.syncStream(auth, [SyncRequestType.AssetOcrV1]);
+ expect(response).toEqual([
+ {
+ ack: expect.any(String),
+ data: {
+ id: expect.any(String),
+ assetId: asset.id,
+ x1: 0.1,
+ y1: 0.2,
+ x2: 0.9,
+ y2: 0.2,
+ x3: 0.9,
+ y3: 0.8,
+ x4: 0.1,
+ y4: 0.8,
+ boxScore: 0.95,
+ textScore: 0.92,
+ text: 'Hello World',
+ isVisible: true,
+ },
+ type: 'AssetOcrV1',
+ },
+ expect.objectContaining({ type: SyncEntityType.SyncCompleteV1 }),
+ ]);
+
+ await ctx.syncAckAll(auth, response);
+ await ctx.assertSyncIsComplete(auth, [SyncRequestType.AssetOcrV1]);
+ });
+
+ it('should update asset OCR', async () => {
+ const { auth, user, ctx } = await setup();
+
+ const ocrRepo = ctx.get(OcrRepository);
+ const { asset } = await ctx.newAsset({ ownerId: user.id });
+ await ocrRepo.upsert(
+ asset.id,
+ [
+ {
+ assetId: asset.id,
+ x1: 0.1,
+ y1: 0.2,
+ x2: 0.9,
+ y2: 0.2,
+ x3: 0.9,
+ y3: 0.8,
+ x4: 0.1,
+ y4: 0.8,
+ boxScore: 0.95,
+ textScore: 0.92,
+ text: 'Hello World',
+ isVisible: true,
+ },
+ ],
+ 'Hello World',
+ );
+
+ const response = await ctx.syncStream(auth, [SyncRequestType.AssetOcrV1]);
+ expect(response).toEqual([
+ {
+ ack: expect.any(String),
+ data: {
+ id: expect.any(String),
+ assetId: asset.id,
+ x1: 0.1,
+ y1: 0.2,
+ x2: 0.9,
+ y2: 0.2,
+ x3: 0.9,
+ y3: 0.8,
+ x4: 0.1,
+ y4: 0.8,
+ boxScore: 0.95,
+ textScore: 0.92,
+ text: 'Hello World',
+ isVisible: true,
+ },
+ type: 'AssetOcrV1',
+ },
+ expect.objectContaining({ type: SyncEntityType.SyncCompleteV1 }),
+ ]);
+
+ await ctx.syncAckAll(auth, response);
+
+ // Update OCR data (upsert deletes old entries first, then inserts new ones)
+ await ocrRepo.upsert(
+ asset.id,
+ [
+ {
+ assetId: asset.id,
+ x1: 0.15,
+ y1: 0.25,
+ x2: 0.85,
+ y2: 0.25,
+ x3: 0.85,
+ y3: 0.75,
+ x4: 0.15,
+ y4: 0.75,
+ boxScore: 0.98,
+ textScore: 0.96,
+ text: 'Updated Text',
+ isVisible: true,
+ },
+ ],
+ 'Updated Text',
+ );
+
+ const updatedResponse = await ctx.syncStream(auth, [SyncRequestType.AssetOcrV1]);
+ // upsert() deletes old entries first, so we expect both delete and upsert events
+ expect(updatedResponse).toEqual([
+ {
+ ack: expect.any(String),
+ data: {
+ id: expect.any(String),
+ assetId: asset.id,
+ deletedAt: expect.any(String),
+ },
+ type: 'AssetOcrDeleteV1',
+ },
+ {
+ ack: expect.any(String),
+ data: {
+ id: expect.any(String),
+ assetId: asset.id,
+ x1: 0.15,
+ y1: 0.25,
+ x2: 0.85,
+ y2: 0.25,
+ x3: 0.85,
+ y3: 0.75,
+ x4: 0.15,
+ y4: 0.75,
+ boxScore: 0.98,
+ textScore: 0.96,
+ text: 'Updated Text',
+ isVisible: true,
+ },
+ type: 'AssetOcrV1',
+ },
+ expect.objectContaining({ type: SyncEntityType.SyncCompleteV1 }),
+ ]);
+
+ await ctx.syncAckAll(auth, updatedResponse);
+ await ctx.assertSyncIsComplete(auth, [SyncRequestType.AssetOcrV1]);
+ });
+
+ it('should update asset OCR visibility flag', async () => {
+ const { auth, user, ctx } = await setup();
+
+ const ocrRepo = ctx.get(OcrRepository);
+ const { asset } = await ctx.newAsset({ ownerId: user.id });
+ await ocrRepo.upsert(
+ asset.id,
+ [
+ {
+ assetId: asset.id,
+ x1: 0.1,
+ y1: 0.2,
+ x2: 0.9,
+ y2: 0.2,
+ x3: 0.9,
+ y3: 0.8,
+ x4: 0.1,
+ y4: 0.8,
+ boxScore: 0.95,
+ textScore: 0.92,
+ text: 'Hello World',
+ isVisible: true,
+ },
+ ],
+ 'Hello World',
+ );
+
+ const response = await ctx.syncStream(auth, [SyncRequestType.AssetOcrV1]);
+ expect(response).toEqual([
+ {
+ ack: expect.any(String),
+ data: {
+ id: expect.any(String),
+ assetId: asset.id,
+ x1: 0.1,
+ y1: 0.2,
+ x2: 0.9,
+ y2: 0.2,
+ x3: 0.9,
+ y3: 0.8,
+ x4: 0.1,
+ y4: 0.8,
+ boxScore: 0.95,
+ textScore: 0.92,
+ text: 'Hello World',
+ isVisible: true,
+ },
+ type: 'AssetOcrV1',
+ },
+ expect.objectContaining({ type: SyncEntityType.SyncCompleteV1 }),
+ ]);
+
+ await ctx.syncAckAll(auth, response);
+
+ await ocrRepo.upsert(
+ asset.id,
+ [
+ {
+ assetId: asset.id,
+ x1: 0.1,
+ y1: 0.2,
+ x2: 0.9,
+ y2: 0.2,
+ x3: 0.9,
+ y3: 0.8,
+ x4: 0.1,
+ y4: 0.8,
+ boxScore: 0.95,
+ textScore: 0.92,
+ text: 'Hello World',
+ isVisible: false,
+ },
+ ],
+ 'Hello World',
+ );
+
+ const updatedResponse = await ctx.syncStream(auth, [SyncRequestType.AssetOcrV1]);
+ expect(updatedResponse).toEqual([
+ {
+ ack: expect.any(String),
+ data: {
+ id: expect.any(String),
+ assetId: asset.id,
+ deletedAt: expect.any(String),
+ },
+ type: 'AssetOcrDeleteV1',
+ },
+ {
+ ack: expect.any(String),
+ data: {
+ id: expect.any(String),
+ assetId: asset.id,
+ x1: 0.1,
+ y1: 0.2,
+ x2: 0.9,
+ y2: 0.2,
+ x3: 0.9,
+ y3: 0.8,
+ x4: 0.1,
+ y4: 0.8,
+ boxScore: 0.95,
+ textScore: 0.92,
+ text: 'Hello World',
+ isVisible: false,
+ },
+ type: 'AssetOcrV1',
+ },
+ expect.objectContaining({ type: SyncEntityType.SyncCompleteV1 }),
+ ]);
+
+ await ctx.syncAckAll(auth, updatedResponse);
+ await ctx.assertSyncIsComplete(auth, [SyncRequestType.AssetOcrV1]);
+ });
+});
+
+describe(SyncEntityType.AssetOcrDeleteV1, () => {
+ it('should delete and sync asset OCR', async () => {
+ const { auth, user, ctx } = await setup();
+
+ const ocrRepo = ctx.get(OcrRepository);
+ const { asset } = await ctx.newAsset({ ownerId: user.id });
+ await ocrRepo.upsert(
+ asset.id,
+ [
+ {
+ assetId: asset.id,
+ x1: 0.1,
+ y1: 0.2,
+ x2: 0.9,
+ y2: 0.2,
+ x3: 0.9,
+ y3: 0.8,
+ x4: 0.1,
+ y4: 0.8,
+ boxScore: 0.95,
+ textScore: 0.92,
+ text: 'Hello World',
+ isVisible: true,
+ },
+ ],
+ 'Hello World',
+ );
+
+ const response = await ctx.syncStream(auth, [SyncRequestType.AssetOcrV1]);
+ expect(response).toEqual([
+ {
+ ack: expect.any(String),
+ data: {
+ id: expect.any(String),
+ assetId: asset.id,
+ x1: 0.1,
+ y1: 0.2,
+ x2: 0.9,
+ y2: 0.2,
+ x3: 0.9,
+ y3: 0.8,
+ x4: 0.1,
+ y4: 0.8,
+ boxScore: 0.95,
+ textScore: 0.92,
+ text: 'Hello World',
+ isVisible: true,
+ },
+ type: 'AssetOcrV1',
+ },
+ expect.objectContaining({ type: SyncEntityType.SyncCompleteV1 }),
+ ]);
+
+ await ctx.syncAckAll(auth, response);
+
+ // Delete OCR data
+ await ocrRepo.upsert(asset.id, [], '');
+
+ await expect(ctx.syncStream(auth, [SyncRequestType.AssetOcrV1])).resolves.toEqual([
+ {
+ ack: expect.any(String),
+ data: {
+ assetId: asset.id,
+ deletedAt: expect.any(String),
+ id: expect.any(String),
+ },
+ type: 'AssetOcrDeleteV1',
+ },
+ expect.objectContaining({ type: SyncEntityType.SyncCompleteV1 }),
+ ]);
+ });
+});
diff --git a/server/test/small.factory.ts b/server/test/small.factory.ts
index 082167f647..5a1a8310b3 100644
--- a/server/test/small.factory.ts
+++ b/server/test/small.factory.ts
@@ -201,6 +201,7 @@ const assetSidecarWriteFactory = () => {
const assetOcrFactory = (
ocr: {
id?: string;
+ updateId?: string;
assetId?: string;
x1?: number;
y1?: number;
@@ -217,6 +218,7 @@ const assetOcrFactory = (
} = {},
) => ({
id: newUuid(),
+ updateId: newUuidV7(),
assetId: newUuid(),
x1: 0.1,
y1: 0.2,