StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
Isolate Xtream live attempts and seal recoverable snapshots
David Nashash9d40edd40fac
diff --git a/data/schemas/com.streamvault.data.local.StreamVaultDatabase/79.json b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/79.jsonnew file mode 100644index 00000000..e90d987e--- /dev/null+++ b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/79.json@@ -0,0 +1,7121 @@+{+ "formatVersion": 1,+ "database": {+ "version": 79,+ "identityHash": "da1965fa706973ef424aa863c8c1d563",+ "entities": [+ {+ "tableName": "providers",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `type` TEXT NOT NULL, `is_active` INTEGER NOT NULL, `status` TEXT NOT NULL, `last_synced_at` INTEGER NOT NULL, `created_at` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "isActive",+ "columnName": "is_active",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastSyncedAt",+ "columnName": "last_synced_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_providers_type",+ "unique": false,+ "columnNames": [+ "type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_providers_type` ON `${TABLE_NAME}` (`type`)"+ },+ {+ "name": "index_providers_is_active",+ "unique": false,+ "columnNames": [+ "is_active"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_providers_is_active` ON `${TABLE_NAME}` (`is_active`)"+ }+ ]+ },+ {+ "tableName": "provider_configs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `type` TEXT NOT NULL, `schema_version` INTEGER NOT NULL, `configuration_generation` INTEGER NOT NULL, `identity_key` TEXT NOT NULL, `encrypted_config_json` TEXT NOT NULL, `guide_source_policy` TEXT NOT NULL, `channel_logo_source_policy` TEXT NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "schemaVersion",+ "columnName": "schema_version",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "configurationGeneration",+ "columnName": "configuration_generation",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "identityKey",+ "columnName": "identity_key",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "encryptedConfigJson",+ "columnName": "encrypted_config_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "guideSourcePolicy",+ "columnName": "guide_source_policy",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "channelLogoSourcePolicy",+ "columnName": "channel_logo_source_policy",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id"+ ]+ },+ "indices": [+ {+ "name": "index_provider_configs_provider_id",+ "unique": true,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_configs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_provider_configs_identity_key",+ "unique": true,+ "columnNames": [+ "identity_key"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_configs_identity_key` ON `${TABLE_NAME}` (`identity_key`)"+ },+ {+ "name": "index_provider_configs_type",+ "unique": false,+ "columnNames": [+ "type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_configs_type` ON `${TABLE_NAME}` (`type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "provider_account_runtime",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `max_connections` INTEGER NOT NULL, `expiration_date` INTEGER, `api_version` TEXT, `allowed_output_formats_json` TEXT NOT NULL, `catalog_layout` TEXT NOT NULL, `catalog_layout_detection_version` INTEGER NOT NULL, `observed_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "maxConnections",+ "columnName": "max_connections",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "expirationDate",+ "columnName": "expiration_date",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "apiVersion",+ "columnName": "api_version",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "allowedOutputFormatsJson",+ "columnName": "allowed_output_formats_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "catalogLayout",+ "columnName": "catalog_layout",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "catalogLayoutDetectionVersion",+ "columnName": "catalog_layout_detection_version",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "observedAt",+ "columnName": "observed_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id"+ ]+ },+ "indices": [+ {+ "name": "index_provider_account_runtime_provider_id",+ "unique": true,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_account_runtime_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channels",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `quality_options_json` TEXT, `playback_metadata_json` TEXT, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "logoUrl",+ "columnName": "logo_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "groupTitle",+ "columnName": "group_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgChannelId",+ "columnName": "epg_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "number",+ "columnName": "number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSupported",+ "columnName": "catch_up_supported",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpDays",+ "columnName": "catch_up_days",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSource",+ "columnName": "catchUpSource",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "logicalGroupId",+ "columnName": "logical_group_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorCount",+ "columnName": "error_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "qualityOptionsJson",+ "columnName": "quality_options_json",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "playbackMetadataJson",+ "columnName": "playback_metadata_json",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_channels_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_channels_provider_id_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"+ },+ {+ "name": "index_channels_provider_id_stream_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "stream_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channels_provider_id_stream_id` ON `${TABLE_NAME}` (`provider_id`, `stream_id`)"+ },+ {+ "name": "index_channels_logical_group_id",+ "unique": false,+ "columnNames": [+ "logical_group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_logical_group_id` ON `${TABLE_NAME}` (`logical_group_id`)"+ },+ {+ "name": "index_channels_provider_id_category_id_logical_group_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "logical_group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id_logical_group_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `logical_group_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_preferences",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `channel_id` INTEGER NOT NULL, `aspect_ratio` TEXT, `audio_video_offset_ms` INTEGER, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`channel_id`) REFERENCES `channels`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "aspectRatio",+ "columnName": "aspect_ratio",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "audioVideoOffsetMs",+ "columnName": "audio_video_offset_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_channel_preferences_channel_id",+ "unique": true,+ "columnNames": [+ "channel_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channel_preferences_channel_id` ON `${TABLE_NAME}` (`channel_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "channels",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "channel_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channels_fts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`channels`)",+ "fields": [+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": []+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "simple",+ "tokenizerArgs": [],+ "contentTable": "channels",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_BEFORE_UPDATE BEFORE UPDATE ON `channels` BEGIN DELETE FROM `channels_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_BEFORE_DELETE BEFORE DELETE ON `channels` BEGIN DELETE FROM `channels_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_AFTER_UPDATE AFTER UPDATE ON `channels` BEGIN INSERT INTO `channels_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_AFTER_INSERT AFTER INSERT ON `channels` BEGIN INSERT INTO `channels_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"+ ]+ },+ {+ "tableName": "movies",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `year` TEXT, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `provider_id` INTEGER NOT NULL, `watch_progress` INTEGER NOT NULL, `watch_count` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `added_at` INTEGER NOT NULL, `cache_state` TEXT NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `remote_stale_at` INTEGER NOT NULL, `playback_metadata_json` TEXT, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "duration",+ "columnName": "duration",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "duration_seconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "year",+ "columnName": "year",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchProgress",+ "columnName": "watch_progress",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchCount",+ "columnName": "watch_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastWatchedAt",+ "columnName": "last_watched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "cacheState",+ "columnName": "cache_state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "detailHydratedAt",+ "columnName": "detail_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remoteStaleAt",+ "columnName": "remote_stale_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "playbackMetadataJson",+ "columnName": "playback_metadata_json",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_movies_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_movies_provider_id_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"+ },+ {+ "name": "index_movies_provider_id_stream_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "stream_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_movies_provider_id_stream_id` ON `${TABLE_NAME}` (`provider_id`, `stream_id`)"+ },+ {+ "name": "index_movies_provider_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `name`, `id`)"+ },+ {+ "name": "index_movies_provider_id_category_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_category_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `name`, `id`)"+ },+ {+ "name": "index_movies_provider_id_rating_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "rating",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_rating_name_id` ON `${TABLE_NAME}` (`provider_id`, `rating`, `name`, `id`)"+ },+ {+ "name": "index_movies_provider_id_added_at_release_date_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "added_at",+ "release_date",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_added_at_release_date_name_id` ON `${TABLE_NAME}` (`provider_id`, `added_at`, `release_date`, `name`, `id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "movies_fts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`movies`)",+ "fields": [+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": []+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "simple",+ "tokenizerArgs": [],+ "contentTable": "movies",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_BEFORE_UPDATE BEFORE UPDATE ON `movies` BEGIN DELETE FROM `movies_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_BEFORE_DELETE BEFORE DELETE ON `movies` BEGIN DELETE FROM `movies_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_AFTER_UPDATE AFTER UPDATE ON `movies` BEGIN INSERT INTO `movies_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_AFTER_INSERT AFTER INSERT ON `movies` BEGIN INSERT INTO `movies_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"+ ]+ },+ {+ "tableName": "series",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `series_id` INTEGER NOT NULL, `provider_series_id` TEXT, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `rating` REAL NOT NULL, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `episode_run_time` TEXT, `last_modified` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `cache_state` TEXT NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `remote_stale_at` INTEGER NOT NULL, `catalog_origin` TEXT NOT NULL, `episode_playback_template_url` TEXT, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerSeriesId",+ "columnName": "provider_series_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "episodeRunTime",+ "columnName": "episode_run_time",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastModified",+ "columnName": "last_modified",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "cacheState",+ "columnName": "cache_state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "detailHydratedAt",+ "columnName": "detail_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remoteStaleAt",+ "columnName": "remote_stale_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catalogOrigin",+ "columnName": "catalog_origin",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "episodePlaybackTemplateUrl",+ "columnName": "episode_playback_template_url",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_series_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_series_provider_id_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"+ },+ {+ "name": "index_series_provider_id_series_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "series_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_series_provider_id_series_id` ON `${TABLE_NAME}` (`provider_id`, `series_id`)"+ },+ {+ "name": "index_series_provider_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `name`, `id`)"+ },+ {+ "name": "index_series_provider_id_category_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_category_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `name`, `id`)"+ },+ {+ "name": "index_series_provider_id_rating_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "rating",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_rating_name_id` ON `${TABLE_NAME}` (`provider_id`, `rating`, `name`, `id`)"+ },+ {+ "name": "index_series_provider_id_last_modified_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "last_modified",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_last_modified_name_id` ON `${TABLE_NAME}` (`provider_id`, `last_modified`, `name`, `id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "series_fts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`series`)",+ "fields": [+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": []+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "simple",+ "tokenizerArgs": [],+ "contentTable": "series",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_UPDATE BEFORE UPDATE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_DELETE BEFORE DELETE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_UPDATE AFTER UPDATE ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_INSERT AFTER INSERT ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"+ ]+ },+ {+ "tableName": "episodes",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `episode_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `episode_number` INTEGER NOT NULL, `season_number` INTEGER NOT NULL, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `cover_url` TEXT, `plot` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `release_date` TEXT, `series_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `watch_progress` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`series_id`) REFERENCES `series`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "episodeId",+ "columnName": "episode_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "episodeNumber",+ "columnName": "episode_number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seasonNumber",+ "columnName": "season_number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "coverUrl",+ "columnName": "cover_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "duration",+ "columnName": "duration",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "duration_seconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchProgress",+ "columnName": "watch_progress",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastWatchedAt",+ "columnName": "last_watched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_episodes_series_id",+ "unique": false,+ "columnNames": [+ "series_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_series_id` ON `${TABLE_NAME}` (`series_id`)"+ },+ {+ "name": "index_episodes_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_episodes_provider_id_episode_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "episode_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_episodes_provider_id_episode_id` ON `${TABLE_NAME}` (`provider_id`, `episode_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "series",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "series_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "categories",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `provider_order` INTEGER NOT NULL DEFAULT 0, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "parentId",+ "columnName": "parent_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerOrder",+ "columnName": "provider_order",+ "affinity": "INTEGER",+ "notNull": true,+ "defaultValue": "0"+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_categories_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_categories_provider_id_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"+ },+ {+ "name": "index_categories_provider_id_category_id_type",+ "unique": true,+ "columnNames": [+ "provider_id",+ "category_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_categories_provider_id_category_id_type` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `is_adult` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `playback_metadata_json` TEXT, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `stream_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "logoUrl",+ "columnName": "logo_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "groupTitle",+ "columnName": "group_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgChannelId",+ "columnName": "epg_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "number",+ "columnName": "number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSupported",+ "columnName": "catch_up_supported",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpDays",+ "columnName": "catch_up_days",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSource",+ "columnName": "catchUpSource",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "logicalGroupId",+ "columnName": "logical_group_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorCount",+ "columnName": "error_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "playbackMetadataJson",+ "columnName": "playback_metadata_json",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "stream_id"+ ]+ },+ "indices": [+ {+ "name": "index_channel_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_channel_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "movie_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `year` TEXT, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `playback_metadata_json` TEXT, `added_at` INTEGER NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `stream_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "duration",+ "columnName": "duration",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "duration_seconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "year",+ "columnName": "year",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "playbackMetadataJson",+ "columnName": "playback_metadata_json",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "stream_id"+ ]+ },+ "indices": [+ {+ "name": "index_movie_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_movie_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "series_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `series_id` INTEGER NOT NULL, `provider_series_id` TEXT, `provider_series_key` TEXT NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `rating` REAL NOT NULL, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `episode_run_time` TEXT, `last_modified` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `provider_series_key`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerSeriesId",+ "columnName": "provider_series_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "providerSeriesKey",+ "columnName": "provider_series_key",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "episodeRunTime",+ "columnName": "episode_run_time",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastModified",+ "columnName": "last_modified",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "provider_series_key"+ ]+ },+ "indices": [+ {+ "name": "index_series_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_series_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "category_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `provider_order` INTEGER NOT NULL DEFAULT 0, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `category_id`, `type`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "parentId",+ "columnName": "parent_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerOrder",+ "columnName": "provider_order",+ "affinity": "INTEGER",+ "notNull": true,+ "defaultValue": "0"+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "category_id",+ "type"+ ]+ },+ "indices": [+ {+ "name": "index_category_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_category_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ },+ {+ "name": "index_category_import_stage_provider_id_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "programs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` TEXT NOT NULL, `title` TEXT NOT NULL, `description` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `end_time` INTEGER NOT NULL, `lang` TEXT NOT NULL, `rating` TEXT, `image_url` TEXT, `genre` TEXT, `category` TEXT, `has_archive` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "description",+ "columnName": "description",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "startTime",+ "columnName": "start_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "endTime",+ "columnName": "end_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lang",+ "columnName": "lang",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "imageUrl",+ "columnName": "image_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "category",+ "columnName": "category",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "hasArchive",+ "columnName": "has_archive",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_programs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_programs_provider_id_channel_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "channel_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id` ON `${TABLE_NAME}` (`provider_id`, `channel_id`)"+ },+ {+ "name": "index_programs_provider_id_end_time_channel_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "end_time",+ "channel_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_end_time_channel_id` ON `${TABLE_NAME}` (`provider_id`, `end_time`, `channel_id`)"+ },+ {+ "name": "index_programs_provider_id_start_time_end_time",+ "unique": false,+ "columnNames": [+ "provider_id",+ "start_time",+ "end_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_start_time_end_time` ON `${TABLE_NAME}` (`provider_id`, `start_time`, `end_time`)"+ },+ {+ "name": "index_programs_start_time",+ "unique": false,+ "columnNames": [+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_start_time` ON `${TABLE_NAME}` (`start_time`)"+ },+ {+ "name": "index_programs_provider_id_channel_id_start_time",+ "unique": false,+ "columnNames": [+ "provider_id",+ "channel_id",+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `start_time`)"+ },+ {+ "name": "index_programs_provider_id_channel_id_start_time_end_time",+ "unique": true,+ "columnNames": [+ "provider_id",+ "channel_id",+ "start_time",+ "end_time"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id_start_time_end_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `start_time`, `end_time`)"+ }+ ]+ },+ {+ "tableName": "favorites",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `position` INTEGER NOT NULL, `group_id` INTEGER, `group_key` INTEGER NOT NULL, `added_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`group_id`) REFERENCES `virtual_groups`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentId",+ "columnName": "content_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "position",+ "columnName": "position",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "groupId",+ "columnName": "group_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "groupKey",+ "columnName": "group_key",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_favorites_provider_id_content_id_content_type_group_key",+ "unique": true,+ "columnNames": [+ "provider_id",+ "content_id",+ "content_type",+ "group_key"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_favorites_provider_id_content_id_content_type_group_key` ON `${TABLE_NAME}` (`provider_id`, `content_id`, `content_type`, `group_key`)"+ },+ {+ "name": "index_favorites_provider_id_content_type_group_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_provider_id_content_type_group_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `group_id`)"+ },+ {+ "name": "index_favorites_group_id_position",+ "unique": false,+ "columnNames": [+ "group_id",+ "position"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_group_id_position` ON `${TABLE_NAME}` (`group_id`, `position`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "virtual_groups",+ "onDelete": "SET NULL",+ "onUpdate": "NO ACTION",+ "columns": [+ "group_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "virtual_groups",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `icon_emoji` TEXT, `position` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `content_type` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "iconEmoji",+ "columnName": "icon_emoji",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "position",+ "columnName": "position",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_virtual_groups_provider_id_content_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_provider_id_content_type` ON `${TABLE_NAME}` (`provider_id`, `content_type`)"+ },+ {+ "name": "index_virtual_groups_position",+ "unique": false,+ "columnNames": [+ "position"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_position` ON `${TABLE_NAME}` (`position`)"+ },+ {+ "name": "index_virtual_groups_content_type",+ "unique": false,+ "columnNames": [+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_content_type` ON `${TABLE_NAME}` (`content_type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "playback_history",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `poster_url` TEXT, `stream_url` TEXT NOT NULL, `resume_position_ms` INTEGER NOT NULL, `total_duration_ms` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `watch_count` INTEGER NOT NULL, `watched_status` TEXT NOT NULL, `series_id` INTEGER, `season_number` INTEGER, `episode_number` INTEGER, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentId",+ "columnName": "content_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "resumePositionMs",+ "columnName": "resume_position_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalDurationMs",+ "columnName": "total_duration_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastWatchedAt",+ "columnName": "last_watched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchCount",+ "columnName": "watch_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchedStatus",+ "columnName": "watched_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "seasonNumber",+ "columnName": "season_number",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "episodeNumber",+ "columnName": "episode_number",+ "affinity": "INTEGER"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_playback_history_content_id_content_type_provider_id",+ "unique": true,+ "columnNames": [+ "content_id",+ "content_type",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_playback_history_content_id_content_type_provider_id` ON `${TABLE_NAME}` (`content_id`, `content_type`, `provider_id`)"+ },+ {+ "name": "index_playback_history_last_watched_at",+ "unique": false,+ "columnNames": [+ "last_watched_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_last_watched_at` ON `${TABLE_NAME}` (`last_watched_at`)"+ },+ {+ "name": "index_playback_history_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_playback_history_provider_id_content_type_content_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "content_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id_content_type_content_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `content_id`)"+ },+ {+ "name": "index_playback_history_provider_id_content_type_last_watched_at",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "last_watched_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id_content_type_last_watched_at` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `last_watched_at`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "tmdb_identity",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`tmdb_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `canonical_provider_id` INTEGER NOT NULL, `first_seen_at` INTEGER NOT NULL, PRIMARY KEY(`tmdb_id`, `content_type`), FOREIGN KEY(`canonical_provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "canonicalProviderId",+ "columnName": "canonical_provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "firstSeenAt",+ "columnName": "first_seen_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "tmdb_id",+ "content_type"+ ]+ },+ "indices": [+ {+ "name": "index_tmdb_identity_content_type",+ "unique": false,+ "columnNames": [+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_tmdb_identity_content_type` ON `${TABLE_NAME}` (`content_type`)"+ },+ {+ "name": "index_tmdb_identity_canonical_provider_id",+ "unique": false,+ "columnNames": [+ "canonical_provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_tmdb_identity_canonical_provider_id` ON `${TABLE_NAME}` (`canonical_provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "canonical_provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "search_history",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `query` TEXT NOT NULL, `content_scope` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `used_at` INTEGER NOT NULL, `use_count` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "query",+ "columnName": "query",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "contentScope",+ "columnName": "content_scope",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "usedAt",+ "columnName": "used_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "useCount",+ "columnName": "use_count",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_search_history_content_scope_provider_id_used_at",+ "unique": false,+ "columnNames": [+ "content_scope",+ "provider_id",+ "used_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_content_scope_provider_id_used_at` ON `${TABLE_NAME}` (`content_scope`, `provider_id`, `used_at`)"+ },+ {+ "name": "index_search_history_used_at",+ "unique": false,+ "columnNames": [+ "used_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_used_at` ON `${TABLE_NAME}` (`used_at`)"+ },+ {+ "name": "index_search_history_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_search_history_query_content_scope_provider_id",+ "unique": true,+ "columnNames": [+ "query",+ "content_scope",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_search_history_query_content_scope_provider_id` ON `${TABLE_NAME}` (`query`, `content_scope`, `provider_id`)"+ }+ ]+ },+ {+ "tableName": "sync_metadata",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `last_live_sync` INTEGER NOT NULL, `last_live_success` INTEGER NOT NULL, `last_movie_sync` INTEGER NOT NULL, `last_series_sync` INTEGER NOT NULL, `last_series_success` INTEGER NOT NULL, `last_epg_sync` INTEGER NOT NULL, `last_epg_success` INTEGER NOT NULL, `last_movie_attempt` INTEGER NOT NULL, `last_movie_success` INTEGER NOT NULL, `last_movie_partial` INTEGER NOT NULL, `live_count` INTEGER NOT NULL, `movie_count` INTEGER NOT NULL, `series_count` INTEGER NOT NULL, `epg_count` INTEGER NOT NULL, `last_sync_status` TEXT NOT NULL, `movie_sync_mode` TEXT NOT NULL, `movie_warnings_count` INTEGER NOT NULL, `movie_catalog_stale` INTEGER NOT NULL, `live_avoid_full_until` INTEGER NOT NULL, `movie_avoid_full_until` INTEGER NOT NULL, `series_avoid_full_until` INTEGER NOT NULL, `live_sequential_failures_remembered` INTEGER NOT NULL, `live_healthy_sync_streak` INTEGER NOT NULL, `movie_parallel_failures_remembered` INTEGER NOT NULL, `movie_healthy_sync_streak` INTEGER NOT NULL, `series_sequential_failures_remembered` INTEGER NOT NULL, `series_healthy_sync_streak` INTEGER NOT NULL, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastLiveSync",+ "columnName": "last_live_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastLiveSuccess",+ "columnName": "last_live_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMovieSync",+ "columnName": "last_movie_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSeriesSync",+ "columnName": "last_series_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSeriesSuccess",+ "columnName": "last_series_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastEpgSync",+ "columnName": "last_epg_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastEpgSuccess",+ "columnName": "last_epg_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMovieAttempt",+ "columnName": "last_movie_attempt",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMovieSuccess",+ "columnName": "last_movie_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMoviePartial",+ "columnName": "last_movie_partial",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveCount",+ "columnName": "live_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieCount",+ "columnName": "movie_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesCount",+ "columnName": "series_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgCount",+ "columnName": "epg_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSyncStatus",+ "columnName": "last_sync_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "movieSyncMode",+ "columnName": "movie_sync_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "movieWarningsCount",+ "columnName": "movie_warnings_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieCatalogStale",+ "columnName": "movie_catalog_stale",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveAvoidFullUntil",+ "columnName": "live_avoid_full_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieAvoidFullUntil",+ "columnName": "movie_avoid_full_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesAvoidFullUntil",+ "columnName": "series_avoid_full_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveSequentialFailuresRemembered",+ "columnName": "live_sequential_failures_remembered",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveHealthySyncStreak",+ "columnName": "live_healthy_sync_streak",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieParallelFailuresRemembered",+ "columnName": "movie_parallel_failures_remembered",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieHealthySyncStreak",+ "columnName": "movie_healthy_sync_streak",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesSequentialFailuresRemembered",+ "columnName": "series_sequential_failures_remembered",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesHealthySyncStreak",+ "columnName": "series_healthy_sync_streak",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id"+ ]+ },+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "movie_category_hydration",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `advertised_total_items` INTEGER, `advertised_total_pages` INTEGER, `is_complete` INTEGER NOT NULL, `page_size` INTEGER NOT NULL, `retry_after_ms` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `retry_budget_remaining` INTEGER NOT NULL, `last_page_fingerprint` TEXT, PRIMARY KEY(`provider_id`, `category_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastHydratedAt",+ "columnName": "last_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "itemCount",+ "columnName": "item_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastStatus",+ "columnName": "last_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastLoadedPage",+ "columnName": "last_loaded_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastAttemptedPage",+ "columnName": "last_attempted_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessfulPage",+ "columnName": "last_successful_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalPages",+ "columnName": "total_pages",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "advertisedTotalItems",+ "columnName": "advertised_total_items",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "advertisedTotalPages",+ "columnName": "advertised_total_pages",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "isComplete",+ "columnName": "is_complete",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "pageSize",+ "columnName": "page_size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryAfterMs",+ "columnName": "retry_after_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failureCount",+ "columnName": "failure_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryBudgetRemaining",+ "columnName": "retry_budget_remaining",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastPageFingerprint",+ "columnName": "last_page_fingerprint",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ]+ },+ "indices": [+ {+ "name": "index_movie_category_hydration_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "series_category_hydration",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `advertised_total_items` INTEGER, `advertised_total_pages` INTEGER, `is_complete` INTEGER NOT NULL, `page_size` INTEGER NOT NULL, `retry_after_ms` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `retry_budget_remaining` INTEGER NOT NULL, `last_page_fingerprint` TEXT, PRIMARY KEY(`provider_id`, `category_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastHydratedAt",+ "columnName": "last_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "itemCount",+ "columnName": "item_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastStatus",+ "columnName": "last_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastLoadedPage",+ "columnName": "last_loaded_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastAttemptedPage",+ "columnName": "last_attempted_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessfulPage",+ "columnName": "last_successful_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalPages",+ "columnName": "total_pages",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "advertisedTotalItems",+ "columnName": "advertised_total_items",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "advertisedTotalPages",+ "columnName": "advertised_total_pages",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "isComplete",+ "columnName": "is_complete",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "pageSize",+ "columnName": "page_size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryAfterMs",+ "columnName": "retry_after_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failureCount",+ "columnName": "failure_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryBudgetRemaining",+ "columnName": "retry_budget_remaining",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastPageFingerprint",+ "columnName": "last_page_fingerprint",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ]+ },+ "indices": [+ {+ "name": "index_series_category_hydration_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "vod_category_hydration",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `advertised_total_items` INTEGER, `advertised_total_pages` INTEGER, `page_size` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `is_complete` INTEGER NOT NULL, `has_movies` INTEGER NOT NULL, `has_series` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, `retry_after_ms` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `retry_budget_remaining` INTEGER NOT NULL, `last_page_fingerprint` TEXT, PRIMARY KEY(`provider_id`, `category_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastLoadedPage",+ "columnName": "last_loaded_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastAttemptedPage",+ "columnName": "last_attempted_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessfulPage",+ "columnName": "last_successful_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalPages",+ "columnName": "total_pages",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "advertisedTotalItems",+ "columnName": "advertised_total_items",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "advertisedTotalPages",+ "columnName": "advertised_total_pages",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "pageSize",+ "columnName": "page_size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "itemCount",+ "columnName": "item_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isComplete",+ "columnName": "is_complete",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "hasMovies",+ "columnName": "has_movies",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "hasSeries",+ "columnName": "has_series",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastHydratedAt",+ "columnName": "last_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastStatus",+ "columnName": "last_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "retryAfterMs",+ "columnName": "retry_after_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failureCount",+ "columnName": "failure_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryBudgetRemaining",+ "columnName": "retry_budget_remaining",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastPageFingerprint",+ "columnName": "last_page_fingerprint",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ]+ },+ "indices": [+ {+ "name": "index_vod_category_hydration_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_vod_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "vod_catalog_entries",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `raw_item_id` TEXT NOT NULL, `item_type` TEXT NOT NULL, `target_id` INTEGER NOT NULL, `raw_page` INTEGER NOT NULL, `raw_index` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `category_id`, `raw_item_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rawItemId",+ "columnName": "raw_item_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "itemType",+ "columnName": "item_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "targetId",+ "columnName": "target_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rawPage",+ "columnName": "raw_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rawIndex",+ "columnName": "raw_index",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "raw_item_id"+ ]+ },+ "indices": [+ {+ "name": "index_vod_catalog_entries_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_vod_catalog_entries_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_vod_catalog_entries_provider_id_category_id_raw_page_raw_index",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "raw_page",+ "raw_index"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_vod_catalog_entries_provider_id_category_id_raw_page_raw_index` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `raw_page`, `raw_index`)"+ },+ {+ "name": "index_vod_catalog_entries_provider_id_item_type_target_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "item_type",+ "target_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_vod_catalog_entries_provider_id_item_type_target_id` ON `${TABLE_NAME}` (`provider_id`, `item_type`, `target_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "epg_sources",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `url` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `last_refresh_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `last_error` TEXT, `priority` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `etag` TEXT, `last_modified_header` TEXT, `timezone_policy` TEXT NOT NULL, `timezone_id` TEXT)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "url",+ "columnName": "url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastRefreshAt",+ "columnName": "last_refresh_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessAt",+ "columnName": "last_success_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "etag",+ "columnName": "etag",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastModifiedHeader",+ "columnName": "last_modified_header",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "timezonePolicy",+ "columnName": "timezone_policy",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "timezoneId",+ "columnName": "timezone_id",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_epg_sources_url",+ "unique": true,+ "columnNames": [+ "url"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_sources_url` ON `${TABLE_NAME}` (`url`)"+ }+ ]+ },+ {+ "tableName": "provider_epg_sources",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `epg_source_id` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_provider_epg_sources_provider_id_epg_source_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_epg_sources_provider_id_epg_source_id` ON `${TABLE_NAME}` (`provider_id`, `epg_source_id`)"+ },+ {+ "name": "index_provider_epg_sources_epg_source_id",+ "unique": false,+ "columnNames": [+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_epg_sources_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "epg_sources",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "epg_source_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "epg_channels",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `epg_source_id` INTEGER NOT NULL, `xmltv_channel_id` TEXT NOT NULL, `display_name` TEXT NOT NULL, `normalized_name` TEXT NOT NULL, `icon_url` TEXT, FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "xmltvChannelId",+ "columnName": "xmltv_channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "displayName",+ "columnName": "display_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "normalizedName",+ "columnName": "normalized_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "iconUrl",+ "columnName": "icon_url",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_epg_channels_epg_source_id_xmltv_channel_id",+ "unique": true,+ "columnNames": [+ "epg_source_id",+ "xmltv_channel_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_channels_epg_source_id_xmltv_channel_id` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`)"+ },+ {+ "name": "index_epg_channels_epg_source_id",+ "unique": false,+ "columnNames": [+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_channels_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"+ },+ {+ "name": "index_epg_channels_normalized_name",+ "unique": false,+ "columnNames": [+ "normalized_name"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_channels_normalized_name` ON `${TABLE_NAME}` (`normalized_name`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "epg_sources",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "epg_source_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "epg_programmes",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `epg_source_id` INTEGER NOT NULL, `xmltv_channel_id` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `end_time` INTEGER NOT NULL, `title` TEXT NOT NULL, `subtitle` TEXT, `description` TEXT NOT NULL, `category` TEXT, `lang` TEXT NOT NULL, `rating` TEXT, `image_url` TEXT, `episode_info` TEXT, FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "xmltvChannelId",+ "columnName": "xmltv_channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "startTime",+ "columnName": "start_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "endTime",+ "columnName": "end_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "subtitle",+ "columnName": "subtitle",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "description",+ "columnName": "description",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "category",+ "columnName": "category",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lang",+ "columnName": "lang",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "imageUrl",+ "columnName": "image_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "episodeInfo",+ "columnName": "episode_info",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_epg_programmes_epg_source_id_xmltv_channel_id_start_time",+ "unique": false,+ "columnNames": [+ "epg_source_id",+ "xmltv_channel_id",+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id_xmltv_channel_id_start_time` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`, `start_time`)"+ },+ {+ "name": "index_epg_programmes_epg_source_id_xmltv_channel_id_start_time_end_time",+ "unique": true,+ "columnNames": [+ "epg_source_id",+ "xmltv_channel_id",+ "start_time",+ "end_time"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id_xmltv_channel_id_start_time_end_time` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`, `start_time`, `end_time`)"+ },+ {+ "name": "index_epg_programmes_epg_source_id",+ "unique": false,+ "columnNames": [+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"+ },+ {+ "name": "index_epg_programmes_start_time",+ "unique": false,+ "columnNames": [+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_start_time` ON `${TABLE_NAME}` (`start_time`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "epg_sources",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "epg_source_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_epg_mappings",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_channel_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `source_type` TEXT NOT NULL, `epg_source_id` INTEGER, `xmltv_channel_id` TEXT, `match_type` TEXT, `confidence` REAL NOT NULL, `matched_at` INTEGER NOT NULL, `failed_attempts` INTEGER NOT NULL, `source` TEXT, `is_manual_override` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerChannelId",+ "columnName": "provider_channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "sourceType",+ "columnName": "source_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "xmltvChannelId",+ "columnName": "xmltv_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "matchType",+ "columnName": "match_type",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "confidence",+ "columnName": "confidence",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "matchedAt",+ "columnName": "matched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failedAttempts",+ "columnName": "failed_attempts",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "source",+ "columnName": "source",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "isManualOverride",+ "columnName": "is_manual_override",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_channel_epg_mappings_provider_id_provider_channel_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "provider_channel_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channel_epg_mappings_provider_id_provider_channel_id` ON `${TABLE_NAME}` (`provider_id`, `provider_channel_id`)"+ },+ {+ "name": "index_channel_epg_mappings_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_epg_mappings_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "combined_m3u_profiles",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "combined_m3u_profile_members",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `profile_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, FOREIGN KEY(`profile_id`) REFERENCES `combined_m3u_profiles`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "profileId",+ "columnName": "profile_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_combined_m3u_profile_members_profile_id",+ "unique": false,+ "columnNames": [+ "profile_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_profile_id` ON `${TABLE_NAME}` (`profile_id`)"+ },+ {+ "name": "index_combined_m3u_profile_members_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_combined_m3u_profile_members_profile_id_provider_id",+ "unique": true,+ "columnNames": [+ "profile_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_profile_id_provider_id` ON `${TABLE_NAME}` (`profile_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "combined_m3u_profiles",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "profile_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "recording_schedules",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` INTEGER NOT NULL, `channel_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `program_title` TEXT, `requested_start_ms` INTEGER NOT NULL, `requested_end_ms` INTEGER NOT NULL, `recurrence` TEXT NOT NULL, `recurring_rule_id` TEXT, `enabled` INTEGER NOT NULL, `is_manual` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelName",+ "columnName": "channel_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programTitle",+ "columnName": "program_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "requestedStartMs",+ "columnName": "requested_start_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "requestedEndMs",+ "columnName": "requested_end_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "recurrence",+ "columnName": "recurrence",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "recurringRuleId",+ "columnName": "recurring_rule_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isManual",+ "columnName": "is_manual",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_recording_schedules_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_recording_schedules_enabled_requested_start_ms",+ "unique": false,+ "columnNames": [+ "enabled",+ "requested_start_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_enabled_requested_start_ms` ON `${TABLE_NAME}` (`enabled`, `requested_start_ms`)"+ },+ {+ "name": "index_recording_schedules_recurring_rule_id",+ "unique": false,+ "columnNames": [+ "recurring_rule_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_recurring_rule_id` ON `${TABLE_NAME}` (`recurring_rule_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "recording_runs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `schedule_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` INTEGER NOT NULL, `channel_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `program_title` TEXT, `scheduled_start_ms` INTEGER NOT NULL, `scheduled_end_ms` INTEGER NOT NULL, `recurrence` TEXT NOT NULL, `recurring_rule_id` TEXT, `status` TEXT NOT NULL, `source_type` TEXT NOT NULL, `resolved_url` TEXT, `headers_json` TEXT NOT NULL, `user_agent` TEXT, `expiration_time` INTEGER, `provider_label` TEXT, `output_uri` TEXT, `output_display_path` TEXT, `bytes_written` INTEGER NOT NULL, `average_throughput_bps` INTEGER NOT NULL, `retry_count` INTEGER NOT NULL, `last_progress_at_ms` INTEGER, `failure_category` TEXT NOT NULL, `failure_reason` TEXT, `terminal_at_ms` INTEGER, `started_at_ms` INTEGER, `ended_at_ms` INTEGER, `schedule_enabled` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `alarm_start_at_ms` INTEGER, `alarm_stop_at_ms` INTEGER, `exact_alarm_armed` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`schedule_id`) REFERENCES `recording_schedules`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "scheduleId",+ "columnName": "schedule_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelName",+ "columnName": "channel_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programTitle",+ "columnName": "program_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "scheduledStartMs",+ "columnName": "scheduled_start_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "scheduledEndMs",+ "columnName": "scheduled_end_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "recurrence",+ "columnName": "recurrence",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "recurringRuleId",+ "columnName": "recurring_rule_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "sourceType",+ "columnName": "source_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "resolvedUrl",+ "columnName": "resolved_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "headersJson",+ "columnName": "headers_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "userAgent",+ "columnName": "user_agent",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "expirationTime",+ "columnName": "expiration_time",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "providerLabel",+ "columnName": "provider_label",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputUri",+ "columnName": "output_uri",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputDisplayPath",+ "columnName": "output_display_path",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "bytesWritten",+ "columnName": "bytes_written",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "averageThroughputBytesPerSecond",+ "columnName": "average_throughput_bps",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryCount",+ "columnName": "retry_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastProgressAtMs",+ "columnName": "last_progress_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "failureCategory",+ "columnName": "failure_category",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "failureReason",+ "columnName": "failure_reason",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "terminalAtMs",+ "columnName": "terminal_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "startedAtMs",+ "columnName": "started_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "endedAtMs",+ "columnName": "ended_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "scheduleEnabled",+ "columnName": "schedule_enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "alarmStartAtMs",+ "columnName": "alarm_start_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "alarmStopAtMs",+ "columnName": "alarm_stop_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "exactAlarmArmed",+ "columnName": "exact_alarm_armed",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_recording_runs_schedule_id",+ "unique": false,+ "columnNames": [+ "schedule_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_schedule_id` ON `${TABLE_NAME}` (`schedule_id`)"+ },+ {+ "name": "index_recording_runs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_recording_runs_status_scheduled_start_ms",+ "unique": false,+ "columnNames": [+ "status",+ "scheduled_start_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_status_scheduled_start_ms` ON `${TABLE_NAME}` (`status`, `scheduled_start_ms`)"+ },+ {+ "name": "index_recording_runs_alarm_start_at_ms",+ "unique": false,+ "columnNames": [+ "alarm_start_at_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_alarm_start_at_ms` ON `${TABLE_NAME}` (`alarm_start_at_ms`)"+ },+ {+ "name": "index_recording_runs_alarm_stop_at_ms",+ "unique": false,+ "columnNames": [+ "alarm_stop_at_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_alarm_stop_at_ms` ON `${TABLE_NAME}` (`alarm_stop_at_ms`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "recording_schedules",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "schedule_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "program_reminders",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` TEXT NOT NULL, `channel_name` TEXT NOT NULL, `program_title` TEXT NOT NULL, `program_start_time` INTEGER NOT NULL, `remind_at` INTEGER NOT NULL, `lead_time_minutes` INTEGER NOT NULL, `is_dismissed` INTEGER NOT NULL, `notified_at` INTEGER, `exact_alarm_armed` INTEGER NOT NULL, `delivery_state` TEXT NOT NULL, `delivery_attempt_token` TEXT, `delivery_attempted_at` INTEGER, `delivery_attempt_count` INTEGER NOT NULL, `delivery_failure_reason` TEXT, `created_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "channelName",+ "columnName": "channel_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programTitle",+ "columnName": "program_title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programStartTime",+ "columnName": "program_start_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remindAt",+ "columnName": "remind_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "leadTimeMinutes",+ "columnName": "lead_time_minutes",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isDismissed",+ "columnName": "is_dismissed",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "notifiedAt",+ "columnName": "notified_at",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "exactAlarmArmed",+ "columnName": "exact_alarm_armed",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "deliveryState",+ "columnName": "delivery_state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "deliveryAttemptToken",+ "columnName": "delivery_attempt_token",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "deliveryAttemptedAt",+ "columnName": "delivery_attempted_at",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "deliveryAttemptCount",+ "columnName": "delivery_attempt_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "deliveryFailureReason",+ "columnName": "delivery_failure_reason",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_program_reminders_provider_id_remind_at",+ "unique": false,+ "columnNames": [+ "provider_id",+ "remind_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_provider_id_remind_at` ON `${TABLE_NAME}` (`provider_id`, `remind_at`)"+ },+ {+ "name": "index_program_reminders_is_dismissed_notified_at_remind_at",+ "unique": false,+ "columnNames": [+ "is_dismissed",+ "notified_at",+ "remind_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_is_dismissed_notified_at_remind_at` ON `${TABLE_NAME}` (`is_dismissed`, `notified_at`, `remind_at`)"+ },+ {+ "name": "index_program_reminders_provider_id_channel_id_program_start_time",+ "unique": false,+ "columnNames": [+ "provider_id",+ "channel_id",+ "program_start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_provider_id_channel_id_program_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `program_start_time`)"+ },+ {+ "name": "index_program_reminders_provider_id_channel_id_program_title_program_start_time",+ "unique": true,+ "columnNames": [+ "provider_id",+ "channel_id",+ "program_title",+ "program_start_time"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_program_reminders_provider_id_channel_id_program_title_program_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `program_title`, `program_start_time`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "recording_storage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `tree_uri` TEXT, `display_name` TEXT, `output_directory` TEXT, `available_bytes` INTEGER, `is_writable` INTEGER NOT NULL, `file_name_pattern` TEXT NOT NULL, `retention_days` INTEGER, `max_simultaneous_recordings` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "treeUri",+ "columnName": "tree_uri",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "displayName",+ "columnName": "display_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputDirectory",+ "columnName": "output_directory",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "availableBytes",+ "columnName": "available_bytes",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "isWritable",+ "columnName": "is_writable",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "fileNamePattern",+ "columnName": "file_name_pattern",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "retentionDays",+ "columnName": "retention_days",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "maxSimultaneousRecordings",+ "columnName": "max_simultaneous_recordings",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "playback_compatibility_records",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `device_fingerprint` TEXT NOT NULL, `device_model` TEXT NOT NULL, `android_sdk` INTEGER NOT NULL, `stream_type` TEXT NOT NULL, `video_mime_type` TEXT NOT NULL, `resolution_bucket` TEXT NOT NULL, `decoder_name` TEXT NOT NULL, `surface_type` TEXT NOT NULL, `failure_type` TEXT NOT NULL, `last_failed_at` INTEGER NOT NULL, `last_succeeded_at` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `success_count` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "deviceFingerprint",+ "columnName": "device_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "deviceModel",+ "columnName": "device_model",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "androidSdk",+ "columnName": "android_sdk",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamType",+ "columnName": "stream_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "videoMimeType",+ "columnName": "video_mime_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "resolutionBucket",+ "columnName": "resolution_bucket",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "decoderName",+ "columnName": "decoder_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "surfaceType",+ "columnName": "surface_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "failureType",+ "columnName": "failure_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastFailedAt",+ "columnName": "last_failed_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSucceededAt",+ "columnName": "last_succeeded_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failureCount",+ "columnName": "failure_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "successCount",+ "columnName": "success_count",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket_decoder_name_surface_type",+ "unique": true,+ "columnNames": [+ "device_fingerprint",+ "stream_type",+ "video_mime_type",+ "resolution_bucket",+ "decoder_name",+ "surface_type"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket_decoder_name_surface_type` ON `${TABLE_NAME}` (`device_fingerprint`, `stream_type`, `video_mime_type`, `resolution_bucket`, `decoder_name`, `surface_type`)"+ },+ {+ "name": "index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket",+ "unique": false,+ "columnNames": [+ "device_fingerprint",+ "stream_type",+ "video_mime_type",+ "resolution_bucket"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket` ON `${TABLE_NAME}` (`device_fingerprint`, `stream_type`, `video_mime_type`, `resolution_bucket`)"+ },+ {+ "name": "index_playback_compatibility_records_last_failed_at",+ "unique": false,+ "columnNames": [+ "last_failed_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_last_failed_at` ON `${TABLE_NAME}` (`last_failed_at`)"+ },+ {+ "name": "index_playback_compatibility_records_last_succeeded_at",+ "unique": false,+ "columnNames": [+ "last_succeeded_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_last_succeeded_at` ON `${TABLE_NAME}` (`last_succeeded_at`)"+ }+ ]+ },+ {+ "tableName": "xtream_content_index",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `remote_id` TEXT NOT NULL, `local_content_id` INTEGER, `name` TEXT NOT NULL, `category_id` INTEGER, `category_name` TEXT, `image_url` TEXT, `container_extension` TEXT, `rating` REAL NOT NULL, `added_at` INTEGER NOT NULL, `remote_updated_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `indexed_at` INTEGER NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `stale_state` TEXT NOT NULL, `error_state` TEXT, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`provider_id`, `content_type`, `remote_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "remoteId",+ "columnName": "remote_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "localContentId",+ "columnName": "local_content_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "imageUrl",+ "columnName": "image_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remoteUpdatedAt",+ "columnName": "remote_updated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "indexedAt",+ "columnName": "indexed_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "detailHydratedAt",+ "columnName": "detail_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "staleState",+ "columnName": "stale_state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorState",+ "columnName": "error_state",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "remote_id"+ ]+ },+ "indices": [+ {+ "name": "index_xtream_content_index_provider_id_content_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type` ON `${TABLE_NAME}` (`provider_id`, `content_type`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_content_type_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_category_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `category_id`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_content_type_name",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "name"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_name` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `name`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_content_type_local_content_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "local_content_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_local_content_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `local_content_id`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_indexed_at",+ "unique": false,+ "columnNames": [+ "provider_id",+ "indexed_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_indexed_at` ON `${TABLE_NAME}` (`provider_id`, `indexed_at`)"+ },+ {+ "name": "index_xtream_content_index_stale_state",+ "unique": false,+ "columnNames": [+ "stale_state"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_stale_state` ON `${TABLE_NAME}` (`stale_state`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "xtream_index_jobs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `section` TEXT NOT NULL, `state` TEXT NOT NULL, `total_categories` INTEGER NOT NULL, `completed_categories` INTEGER NOT NULL, `next_category_index` INTEGER NOT NULL, `failed_categories` INTEGER NOT NULL, `indexed_rows` INTEGER NOT NULL, `skipped_malformed_rows` INTEGER NOT NULL, `deleted_pruned_rows` INTEGER NOT NULL, `priority_category_id` INTEGER, `priority_requested_at` INTEGER NOT NULL, `last_error` TEXT, `last_attempt_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `section`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "section",+ "columnName": "section",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "state",+ "columnName": "state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "totalCategories",+ "columnName": "total_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "completedCategories",+ "columnName": "completed_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "nextCategoryIndex",+ "columnName": "next_category_index",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failedCategories",+ "columnName": "failed_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "indexedRows",+ "columnName": "indexed_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "skippedMalformedRows",+ "columnName": "skipped_malformed_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "deletedPrunedRows",+ "columnName": "deleted_pruned_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priorityCategoryId",+ "columnName": "priority_category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "priorityRequestedAt",+ "columnName": "priority_requested_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastAttemptAt",+ "columnName": "last_attempt_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessAt",+ "columnName": "last_success_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "section"+ ]+ },+ "indices": [+ {+ "name": "index_xtream_index_jobs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_xtream_index_jobs_section",+ "unique": false,+ "columnNames": [+ "section"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_section` ON `${TABLE_NAME}` (`section`)"+ },+ {+ "name": "index_xtream_index_jobs_state",+ "unique": false,+ "columnNames": [+ "state"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_state` ON `${TABLE_NAME}` (`state`)"+ },+ {+ "name": "index_xtream_index_jobs_updated_at",+ "unique": false,+ "columnNames": [+ "updated_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_updated_at` ON `${TABLE_NAME}` (`updated_at`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "xtream_live_onboarding_state",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `provider_type` TEXT NOT NULL, `content_type` TEXT NOT NULL, `phase` TEXT NOT NULL, `staged_session_id` INTEGER, `import_strategy` TEXT, `next_category_index` INTEGER NOT NULL, `accepted_row_count` INTEGER NOT NULL, `staged_flush_count` INTEGER NOT NULL, `sealed_session_id` INTEGER, `sealed_row_count` INTEGER NOT NULL DEFAULT 0, `sealed_configuration_generation` INTEGER, `sealed_mapping_profile` TEXT, `sync_profile_tier` TEXT, `sync_profile_batch_size` INTEGER NOT NULL, `sync_profile_strategy` TEXT, `sync_profile_low_memory` INTEGER NOT NULL, `sync_profile_memory_class_mb` INTEGER NOT NULL, `sync_profile_available_mem_mb` INTEGER NOT NULL, `last_error` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `completed_at` INTEGER, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerType",+ "columnName": "provider_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "phase",+ "columnName": "phase",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stagedSessionId",+ "columnName": "staged_session_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "importStrategy",+ "columnName": "import_strategy",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "nextCategoryIndex",+ "columnName": "next_category_index",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "acceptedRowCount",+ "columnName": "accepted_row_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stagedFlushCount",+ "columnName": "staged_flush_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "sealedSessionId",+ "columnName": "sealed_session_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "sealedRowCount",+ "columnName": "sealed_row_count",+ "affinity": "INTEGER",+ "notNull": true,+ "defaultValue": "0"+ },+ {+ "fieldPath": "sealedConfigurationGeneration",+ "columnName": "sealed_configuration_generation",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "sealedMappingProfile",+ "columnName": "sealed_mapping_profile",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncProfileTier",+ "columnName": "sync_profile_tier",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncProfileBatchSize",+ "columnName": "sync_profile_batch_size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileStrategy",+ "columnName": "sync_profile_strategy",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncProfileLowMemory",+ "columnName": "sync_profile_low_memory",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileMemoryClassMb",+ "columnName": "sync_profile_memory_class_mb",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileAvailableMemMb",+ "columnName": "sync_profile_available_mem_mb",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "completedAt",+ "columnName": "completed_at",+ "affinity": "INTEGER"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id"+ ]+ },+ "indices": [+ {+ "name": "index_xtream_live_onboarding_state_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_xtream_live_onboarding_state_phase",+ "unique": false,+ "columnNames": [+ "phase"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_phase` ON `${TABLE_NAME}` (`phase`)"+ },+ {+ "name": "index_xtream_live_onboarding_state_updated_at",+ "unique": false,+ "columnNames": [+ "updated_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_updated_at` ON `${TABLE_NAME}` (`updated_at`)"+ },+ {+ "name": "index_xtream_live_onboarding_state_staged_session_id",+ "unique": false,+ "columnNames": [+ "staged_session_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_staged_session_id` ON `${TABLE_NAME}` (`staged_session_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "stalker_index_jobs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `section` TEXT NOT NULL, `state` TEXT NOT NULL, `total_categories` INTEGER NOT NULL, `completed_categories` INTEGER NOT NULL, `next_category_index` INTEGER NOT NULL, `failed_categories` INTEGER NOT NULL, `indexed_rows` INTEGER NOT NULL, `skipped_malformed_rows` INTEGER NOT NULL, `deleted_pruned_rows` INTEGER NOT NULL, `last_error` TEXT, `last_attempt_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `section`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "section",+ "columnName": "section",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "state",+ "columnName": "state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "totalCategories",+ "columnName": "total_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "completedCategories",+ "columnName": "completed_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "nextCategoryIndex",+ "columnName": "next_category_index",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failedCategories",+ "columnName": "failed_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "indexedRows",+ "columnName": "indexed_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "skippedMalformedRows",+ "columnName": "skipped_malformed_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "deletedPrunedRows",+ "columnName": "deleted_pruned_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastAttemptAt",+ "columnName": "last_attempt_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessAt",+ "columnName": "last_success_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "section"+ ]+ },+ "indices": [+ {+ "name": "index_stalker_index_jobs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_stalker_index_jobs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_stalker_index_jobs_state",+ "unique": false,+ "columnNames": [+ "state"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_stalker_index_jobs_state` ON `${TABLE_NAME}` (`state`)"+ },+ {+ "name": "index_stalker_index_jobs_updated_at",+ "unique": false,+ "columnNames": [+ "updated_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_stalker_index_jobs_updated_at` ON `${TABLE_NAME}` (`updated_at`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "stalker_portal_state",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `working_endpoint` TEXT, `bootstrap_recipe` TEXT, `bulk_live_supported` INTEGER, `bulk_live_category_fidelity` INTEGER, `movie_wildcard_supported` INTEGER, `series_wildcard_supported` INTEGER, `epg_supported` INTEGER, `safe_metadata_concurrency` INTEGER NOT NULL, `stress_cooldown_until` INTEGER NOT NULL, `endpoint_health_json` TEXT NOT NULL, `endpoint_failed_until` INTEGER NOT NULL, `validated_at` INTEGER NOT NULL, `schema_version` INTEGER NOT NULL, `configuration_generation` INTEGER NOT NULL, `learning_json` TEXT NOT NULL, `observation_source` TEXT NOT NULL, `observed_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "workingEndpoint",+ "columnName": "working_endpoint",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "bootstrapRecipe",+ "columnName": "bootstrap_recipe",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "bulkLiveSupported",+ "columnName": "bulk_live_supported",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "bulkLiveCategoryFidelity",+ "columnName": "bulk_live_category_fidelity",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "movieWildcardSupported",+ "columnName": "movie_wildcard_supported",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "seriesWildcardSupported",+ "columnName": "series_wildcard_supported",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "epgSupported",+ "columnName": "epg_supported",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "safeMetadataConcurrency",+ "columnName": "safe_metadata_concurrency",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stressCooldownUntil",+ "columnName": "stress_cooldown_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "endpointHealthJson",+ "columnName": "endpoint_health_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "endpointFailedUntil",+ "columnName": "endpoint_failed_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "validatedAt",+ "columnName": "validated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "schemaVersion",+ "columnName": "schema_version",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "configurationGeneration",+ "columnName": "configuration_generation",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "learningJson",+ "columnName": "learning_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "observationSource",+ "columnName": "observation_source",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "observedAt",+ "columnName": "observed_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id"+ ]+ },+ "indices": [+ {+ "name": "index_stalker_portal_state_provider_id",+ "unique": true,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_stalker_portal_state_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "stalker_remote_identities",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `raw_id` TEXT NOT NULL, `surrogate_id` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `content_type`, `raw_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "rawId",+ "columnName": "raw_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "surrogateId",+ "columnName": "surrogate_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "raw_id"+ ]+ },+ "indices": [+ {+ "name": "index_stalker_remote_identities_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_stalker_remote_identities_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_stalker_remote_identities_provider_id_content_type_surrogate_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "content_type",+ "surrogate_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_stalker_remote_identities_provider_id_content_type_surrogate_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `surrogate_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "stalker_discovery_staging",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`discovery_id` TEXT NOT NULL, `provider_id` INTEGER, `configuration_generation` INTEGER NOT NULL, `sanitized_summary` TEXT NOT NULL, `categories_json` TEXT NOT NULL, `channels_json` TEXT NOT NULL, `created_at` INTEGER NOT NULL, PRIMARY KEY(`discovery_id`))",+ "fields": [+ {+ "fieldPath": "discoveryId",+ "columnName": "discovery_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "configurationGeneration",+ "columnName": "configuration_generation",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "sanitizedSummary",+ "columnName": "sanitized_summary",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "categoriesJson",+ "columnName": "categories_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "channelsJson",+ "columnName": "channels_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "discovery_id"+ ]+ },+ "indices": [+ {+ "name": "index_stalker_discovery_staging_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_stalker_discovery_staging_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_stalker_discovery_staging_created_at",+ "unique": false,+ "columnNames": [+ "created_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_stalker_discovery_staging_created_at` ON `${TABLE_NAME}` (`created_at`)"+ }+ ]+ },+ {+ "tableName": "downloads",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `content_id` INTEGER NOT NULL, `content_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `source_stream_url` TEXT, `source_stream_id` INTEGER, `container_extension` TEXT, `poster_url` TEXT, `output_uri` TEXT, `output_display_path` TEXT, `status` TEXT NOT NULL, `bytes_written` INTEGER NOT NULL, `total_bytes` INTEGER, `supports_resume` INTEGER NOT NULL, `retry_count` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `completed_at` INTEGER, `failure_reason` TEXT, `owner_id` TEXT, `owner_epoch` INTEGER NOT NULL, `heartbeat_at` INTEGER, `series_id` INTEGER, `season_number` INTEGER, `episode_number` INTEGER, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "contentId",+ "columnName": "content_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentName",+ "columnName": "content_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "sourceStreamUrl",+ "columnName": "source_stream_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "sourceStreamId",+ "columnName": "source_stream_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputUri",+ "columnName": "output_uri",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputDisplayPath",+ "columnName": "output_display_path",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "bytesWritten",+ "columnName": "bytes_written",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalBytes",+ "columnName": "total_bytes",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "supportsResume",+ "columnName": "supports_resume",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryCount",+ "columnName": "retry_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "completedAt",+ "columnName": "completed_at",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "failureReason",+ "columnName": "failure_reason",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "ownerId",+ "columnName": "owner_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "ownerEpoch",+ "columnName": "owner_epoch",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "heartbeatAt",+ "columnName": "heartbeat_at",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "seasonNumber",+ "columnName": "season_number",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "episodeNumber",+ "columnName": "episode_number",+ "affinity": "INTEGER"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_downloads_status",+ "unique": false,+ "columnNames": [+ "status"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_downloads_status` ON `${TABLE_NAME}` (`status`)"+ },+ {+ "name": "index_downloads_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_downloads_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_downloads_content_type_content_id",+ "unique": false,+ "columnNames": [+ "content_type",+ "content_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_downloads_content_type_content_id` ON `${TABLE_NAME}` (`content_type`, `content_id`)"+ }+ ]+ },+ {+ "tableName": "provider_deletion_cleanup",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `action` TEXT NOT NULL, `target_id` TEXT NOT NULL, `created_at` INTEGER NOT NULL, `attempt_count` INTEGER NOT NULL, `last_error` TEXT)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "action",+ "columnName": "action",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "targetId",+ "columnName": "target_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "attemptCount",+ "columnName": "attempt_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_provider_deletion_cleanup_provider_id_action_target_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "action",+ "target_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_deletion_cleanup_provider_id_action_target_id` ON `${TABLE_NAME}` (`provider_id`, `action`, `target_id`)"+ }+ ]+ },+ {+ "tableName": "plugin_provider_ownership",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`package_name` TEXT NOT NULL, `service_class_name` TEXT NOT NULL, `manifest_id` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, PRIMARY KEY(`package_name`, `service_class_name`, `manifest_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "packageName",+ "columnName": "package_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "serviceClassName",+ "columnName": "service_class_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "manifestId",+ "columnName": "manifest_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "package_name",+ "service_class_name",+ "manifest_id"+ ]+ },+ "indices": [+ {+ "name": "index_plugin_provider_ownership_provider_id",+ "unique": true,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_plugin_provider_ownership_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "provider_config_revisions",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `revision` INTEGER NOT NULL, `config_json` TEXT NOT NULL, `state` TEXT NOT NULL, `attempt_count` INTEGER NOT NULL, `last_error` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `revision`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "revision",+ "columnName": "revision",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "configJson",+ "columnName": "config_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "state",+ "columnName": "state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "attemptCount",+ "columnName": "attempt_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "revision"+ ]+ },+ "indices": [+ {+ "name": "index_provider_config_revisions_provider_id_state",+ "unique": false,+ "columnNames": [+ "provider_id",+ "state"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_config_revisions_provider_id_state` ON `${TABLE_NAME}` (`provider_id`, `state`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "backup_restore_checkpoints",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`restore_key` TEXT NOT NULL, `room_complete` INTEGER NOT NULL, `preferences_complete` INTEGER NOT NULL, `presets_complete` INTEGER NOT NULL, `schedules_complete` INTEGER NOT NULL, `state` TEXT NOT NULL, `preference_snapshot_json` TEXT, `last_error` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`restore_key`))",+ "fields": [+ {+ "fieldPath": "restoreKey",+ "columnName": "restore_key",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "roomComplete",+ "columnName": "room_complete",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "preferencesComplete",+ "columnName": "preferences_complete",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "presetsComplete",+ "columnName": "presets_complete",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "schedulesComplete",+ "columnName": "schedules_complete",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "state",+ "columnName": "state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "preferenceSnapshotJson",+ "columnName": "preference_snapshot_json",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "restore_key"+ ]+ }+ },+ {+ "tableName": "backup_restore_jobs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `restore_key` TEXT NOT NULL, `backup_version` INTEGER NOT NULL, `conflict_strategy` TEXT NOT NULL, `status` TEXT NOT NULL, `total_count` INTEGER NOT NULL, `pending_count` INTEGER NOT NULL, `applied_count` INTEGER NOT NULL, `unresolved_count` INTEGER NOT NULL, `failed_count` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "restoreKey",+ "columnName": "restore_key",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "backupVersion",+ "columnName": "backup_version",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "conflictStrategy",+ "columnName": "conflict_strategy",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "totalCount",+ "columnName": "total_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "pendingCount",+ "columnName": "pending_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "appliedCount",+ "columnName": "applied_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "unresolvedCount",+ "columnName": "unresolved_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failedCount",+ "columnName": "failed_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_backup_restore_jobs_restore_key",+ "unique": true,+ "columnNames": [+ "restore_key"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_backup_restore_jobs_restore_key` ON `${TABLE_NAME}` (`restore_key`)"+ },+ {+ "name": "index_backup_restore_jobs_status",+ "unique": false,+ "columnNames": [+ "status"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_backup_restore_jobs_status` ON `${TABLE_NAME}` (`status`)"+ },+ {+ "name": "index_backup_restore_jobs_updated_at",+ "unique": false,+ "columnNames": [+ "updated_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_backup_restore_jobs_updated_at` ON `${TABLE_NAME}` (`updated_at`)"+ }+ ]+ },+ {+ "tableName": "backup_restore_items",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `job_id` TEXT NOT NULL, `provider_identity_key` TEXT NOT NULL, `local_provider_id` INTEGER, `section` TEXT NOT NULL, `content_type` TEXT, `stable_reference_key` TEXT NOT NULL, `reference_json` TEXT NOT NULL, `payload_json` TEXT NOT NULL, `status` TEXT NOT NULL, `attempt_count` INTEGER NOT NULL, `last_error` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`job_id`) REFERENCES `backup_restore_jobs`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "jobId",+ "columnName": "job_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerIdentityKey",+ "columnName": "provider_identity_key",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "localProviderId",+ "columnName": "local_provider_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "section",+ "columnName": "section",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "stableReferenceKey",+ "columnName": "stable_reference_key",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "referenceJson",+ "columnName": "reference_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "payloadJson",+ "columnName": "payload_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "attemptCount",+ "columnName": "attempt_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_backup_restore_items_job_id",+ "unique": false,+ "columnNames": [+ "job_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_backup_restore_items_job_id` ON `${TABLE_NAME}` (`job_id`)"+ },+ {+ "name": "index_backup_restore_items_provider_identity_key_status",+ "unique": false,+ "columnNames": [+ "provider_identity_key",+ "status"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_backup_restore_items_provider_identity_key_status` ON `${TABLE_NAME}` (`provider_identity_key`, `status`)"+ },+ {+ "name": "index_backup_restore_items_job_id_status",+ "unique": false,+ "columnNames": [+ "job_id",+ "status"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_backup_restore_items_job_id_status` ON `${TABLE_NAME}` (`job_id`, `status`)"+ },+ {+ "name": "index_backup_restore_items_job_id_section_stable_reference_key",+ "unique": true,+ "columnNames": [+ "job_id",+ "section",+ "stable_reference_key"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_backup_restore_items_job_id_section_stable_reference_key` ON `${TABLE_NAME}` (`job_id`, `section`, `stable_reference_key`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "backup_restore_jobs",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "job_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "provider_workflows",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `generation` INTEGER NOT NULL, `state` TEXT NOT NULL, `reason` TEXT NOT NULL, `priority` INTEGER NOT NULL, `force` INTEGER NOT NULL, `current_phase` TEXT, `lease_token` TEXT, `lease_expires_at` INTEGER, `heartbeat_at` INTEGER, `progress_message` TEXT, `last_error_code` TEXT, `last_error_message` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `completed_at` INTEGER, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "generation",+ "columnName": "generation",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "state",+ "columnName": "state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "reason",+ "columnName": "reason",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "force",+ "columnName": "force",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "currentPhase",+ "columnName": "current_phase",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "leaseToken",+ "columnName": "lease_token",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "leaseExpiresAt",+ "columnName": "lease_expires_at",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "heartbeatAt",+ "columnName": "heartbeat_at",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "progressMessage",+ "columnName": "progress_message",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastErrorCode",+ "columnName": "last_error_code",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastErrorMessage",+ "columnName": "last_error_message",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "completedAt",+ "columnName": "completed_at",+ "affinity": "INTEGER"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id"+ ]+ },+ "indices": [+ {+ "name": "index_provider_workflows_state",+ "unique": false,+ "columnNames": [+ "state"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflows_state` ON `${TABLE_NAME}` (`state`)"+ },+ {+ "name": "index_provider_workflows_updated_at",+ "unique": false,+ "columnNames": [+ "updated_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflows_updated_at` ON `${TABLE_NAME}` (`updated_at`)"+ },+ {+ "name": "index_provider_workflows_lease_expires_at",+ "unique": false,+ "columnNames": [+ "lease_expires_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflows_lease_expires_at` ON `${TABLE_NAME}` (`lease_expires_at`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "provider_workflow_phases",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `generation` INTEGER NOT NULL, `phase` TEXT NOT NULL, `state` TEXT NOT NULL, `attempt_count` INTEGER NOT NULL, `checkpoint` TEXT, `last_error_code` TEXT, `last_error_message` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `completed_at` INTEGER, PRIMARY KEY(`provider_id`, `generation`, `phase`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "generation",+ "columnName": "generation",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "phase",+ "columnName": "phase",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "state",+ "columnName": "state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "attemptCount",+ "columnName": "attempt_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "checkpoint",+ "columnName": "checkpoint",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastErrorCode",+ "columnName": "last_error_code",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastErrorMessage",+ "columnName": "last_error_message",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "completedAt",+ "columnName": "completed_at",+ "affinity": "INTEGER"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "generation",+ "phase"+ ]+ },+ "indices": [+ {+ "name": "index_provider_workflow_phases_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflow_phases_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_provider_workflow_phases_state",+ "unique": false,+ "columnNames": [+ "state"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflow_phases_state` ON `${TABLE_NAME}` (`state`)"+ },+ {+ "name": "index_provider_workflow_phases_updated_at",+ "unique": false,+ "columnNames": [+ "updated_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflow_phases_updated_at` ON `${TABLE_NAME}` (`updated_at`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "m3u_classification_overrides",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `source_key` TEXT NOT NULL, `stream_id` INTEGER NOT NULL, `target_type` TEXT NOT NULL, `group_key` TEXT NOT NULL, `series_key` TEXT, `series_name` TEXT, `season_number` INTEGER, `episode_number` INTEGER, `episode_title` TEXT, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `source_key`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "sourceKey",+ "columnName": "source_key",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "targetType",+ "columnName": "target_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "groupKey",+ "columnName": "group_key",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "seriesKey",+ "columnName": "series_key",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "seriesName",+ "columnName": "series_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "seasonNumber",+ "columnName": "season_number",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "episodeNumber",+ "columnName": "episode_number",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "episodeTitle",+ "columnName": "episode_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "source_key"+ ]+ },+ "indices": [+ {+ "name": "index_m3u_classification_overrides_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_m3u_classification_overrides_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "m3u_category_classification_rules",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `group_key` TEXT NOT NULL, `target_type` TEXT NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `group_key`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "groupKey",+ "columnName": "group_key",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "targetType",+ "columnName": "target_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "group_key"+ ]+ },+ "indices": [+ {+ "name": "index_m3u_category_classification_rules_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_m3u_category_classification_rules_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ }+ ],+ "setupQueries": [+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'da1965fa706973ef424aa863c8c1d563')"+ ]+ }+}\ No newline at end of filediff --git a/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.kt b/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.ktindex ddcaba54..0bd75d64 100644--- a/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.kt+++ b/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.kt@@ -1978,6 +1978,37 @@ class StreamVaultDatabaseMigrationTest {migrated.close()}+ @Test+ fun migrate78To79_preservesSavedImportWithoutGrantingCompletionProof() {+ val name = "streamvault-78-79-live-receipt"+ migrationTestHelper.createDatabase(name, 78).apply {+ execSQL("INSERT INTO providers (id,name,type,is_active,status,last_synced_at,created_at) " ++ "VALUES (1,'Synthetic','XTREAM_CODES',1,'UNKNOWN',0,0)")+ execSQL("""+ INSERT INTO xtream_live_onboarding_state (+ provider_id, provider_type, content_type, phase, staged_session_id, import_strategy,+ next_category_index, accepted_row_count, staged_flush_count, sync_profile_tier,+ sync_profile_batch_size, sync_profile_strategy, sync_profile_low_memory,+ sync_profile_memory_class_mb, sync_profile_available_mem_mb, last_error,+ created_at, updated_at, completed_at+ ) VALUES (1, 'XTREAM_CODES', 'LIVE', 'STAGED', 123, 'full', 0, 7, 1,+ 'MID', 250, 'STREAM_ALL', 0, 192, 512, NULL, 100, 200, NULL)+ """.trimIndent())+ close()+ }+ val migrated = migrationTestHelper.runMigrationsAndValidate(name, 79, true,+ StreamVaultDatabase.MIGRATION_78_79)+ assertEquals(1, countRows(migrated, "SELECT COUNT(*) FROM providers WHERE id=1 AND name='Synthetic'"))+ assertEquals(1, countRows(migrated, """+ SELECT COUNT(*) FROM xtream_live_onboarding_state WHERE provider_id=1+ AND staged_session_id=123 AND accepted_row_count=7 AND phase='STAGED'+ AND sealed_session_id IS NULL AND sealed_row_count=0+ AND sealed_configuration_generation IS NULL AND sealed_mapping_profile IS NULL+ """.trimIndent()))+ assertEquals(0, countRows(migrated, "SELECT COUNT(*) FROM pragma_foreign_key_check"))+ migrated.close()+ }+private fun SupportSQLiteDatabase.insertProvider72(id: Long, name: String, type: String) {execSQL("""diff --git a/data/src/main/java/com/streamvault/data/local/FeatureMigrationsV78To79.kt b/data/src/main/java/com/streamvault/data/local/FeatureMigrationsV78To79.ktnew file mode 100644index 00000000..5616fe9b--- /dev/null+++ b/data/src/main/java/com/streamvault/data/local/FeatureMigrationsV78To79.kt@@ -0,0 +1,16 @@+package com.streamvault.data.local++import androidx.room.migration.Migration+import androidx.sqlite.db.SupportSQLiteDatabase++/** Existing staged sessions have no receipt and must be fetched again. */+internal object FeatureMigrationsV78To79 {+ val MIGRATION_78_79 = object : Migration(78, 79) {+ override fun migrate(db: SupportSQLiteDatabase) {+ db.execSQL("ALTER TABLE xtream_live_onboarding_state ADD COLUMN sealed_session_id INTEGER")+ db.execSQL("ALTER TABLE xtream_live_onboarding_state ADD COLUMN sealed_row_count INTEGER NOT NULL DEFAULT 0")+ db.execSQL("ALTER TABLE xtream_live_onboarding_state ADD COLUMN sealed_configuration_generation INTEGER")+ db.execSQL("ALTER TABLE xtream_live_onboarding_state ADD COLUMN sealed_mapping_profile TEXT")+ }+ }+}diff --git a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.ktindex 70b6db8c..81027cf3 100644--- a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt+++ b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt@@ -12,7 +12,7 @@ import org.json.JSONObjectimport java.net.URIimport java.security.MessageDigest-internal const val STREAM_VAULT_DATABASE_VERSION = 78+internal const val STREAM_VAULT_DATABASE_VERSION = 79@Database(entities = [@@ -206,5 +206,6 @@ abstract class StreamVaultDatabase : RoomDatabase() {val MIGRATION_75_76 = FeatureMigrationsV75To76.MIGRATION_75_76val MIGRATION_76_77 = FeatureMigrationsV76To77.MIGRATION_76_77val MIGRATION_77_78 = FeatureMigrationsV77To78.MIGRATION_77_78+ val MIGRATION_78_79 = FeatureMigrationsV78To79.MIGRATION_78_79}}diff --git a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabaseMigrationRegistry.kt b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabaseMigrationRegistry.ktindex fe49f49f..75148d2f 100644--- a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabaseMigrationRegistry.kt+++ b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabaseMigrationRegistry.kt@@ -15,7 +15,8 @@ object StreamVaultDatabaseMigrationRegistry {val v75To76: List<Migration> = listOf(FeatureMigrationsV75To76.MIGRATION_75_76)val v76To77: List<Migration> = listOf(FeatureMigrationsV76To77.MIGRATION_76_77)val v77To78: List<Migration> = listOf(FeatureMigrationsV77To78.MIGRATION_77_78)- val all: List<Migration> = (v1To24 + v24To49 + v49To75 + v75To76 + v76To77 + v77To78).also(::validate)+ val v78To79: List<Migration> = listOf(FeatureMigrationsV78To79.MIGRATION_78_79)+ val all: List<Migration> = (v1To24 + v24To49 + v49To75 + v75To76 + v76To77 + v77To78 + v78To79).also(::validate)private fun validate(migrations: List<Migration>) {require(migrations.map { it.startVersion }.distinct().size == migrations.size) {diff --git a/data/src/main/java/com/streamvault/data/local/dao/CatalogSyncDao.kt b/data/src/main/java/com/streamvault/data/local/dao/CatalogSyncDao.ktindex e03e4fb2..e71df4af 100644--- a/data/src/main/java/com/streamvault/data/local/dao/CatalogSyncDao.kt+++ b/data/src/main/java/com/streamvault/data/local/dao/CatalogSyncDao.kt@@ -32,6 +32,11 @@ interface CatalogSyncDao {@Query("DELETE FROM channel_import_stage WHERE provider_id = :providerId AND session_id = :sessionId")suspend fun clearChannelStages(providerId: Long, sessionId: Long)+ // Keep the first completed category's row when a provider repeats a stream+ // in several categories. Failed attempts never reach this transfer.+ @Query("UPDATE OR IGNORE channel_import_stage SET session_id = :targetSessionId WHERE provider_id = :providerId AND session_id = :sourceSessionId")+ suspend fun moveCompletedChannelStages(providerId: Long, sourceSessionId: Long, targetSessionId: Long): Int+@Query("DELETE FROM movie_import_stage WHERE provider_id = :providerId AND session_id = :sessionId")suspend fun clearMovieStages(providerId: Long, sessionId: Long)diff --git a/data/src/main/java/com/streamvault/data/local/entity/XtreamLiveOnboardingEntities.kt b/data/src/main/java/com/streamvault/data/local/entity/XtreamLiveOnboardingEntities.ktindex 367f94b6..ebeb39f9 100644--- a/data/src/main/java/com/streamvault/data/local/entity/XtreamLiveOnboardingEntities.kt+++ b/data/src/main/java/com/streamvault/data/local/entity/XtreamLiveOnboardingEntities.kt@@ -31,6 +31,10 @@ data class XtreamLiveOnboardingStateEntity(@ColumnInfo(name = "next_category_index") val nextCategoryIndex: Int = 0,@ColumnInfo(name = "accepted_row_count") val acceptedRowCount: Int = 0,@ColumnInfo(name = "staged_flush_count") val stagedFlushCount: Int = 0,+ @ColumnInfo(name = "sealed_session_id") val sealedSessionId: Long? = null,+ @ColumnInfo(name = "sealed_row_count", defaultValue = "0") val sealedRowCount: Int = 0,+ @ColumnInfo(name = "sealed_configuration_generation") val sealedConfigurationGeneration: Long? = null,+ @ColumnInfo(name = "sealed_mapping_profile") val sealedMappingProfile: String? = null,@ColumnInfo(name = "sync_profile_tier") val syncProfileTier: String? = null,@ColumnInfo(name = "sync_profile_batch_size") val syncProfileBatchSize: Int = 0,@ColumnInfo(name = "sync_profile_strategy") val syncProfileStrategy: String? = null,@@ -41,4 +45,4 @@ data class XtreamLiveOnboardingStateEntity(@ColumnInfo(name = "created_at") val createdAt: Long = 0L,@ColumnInfo(name = "updated_at") val updatedAt: Long = 0L,@ColumnInfo(name = "completed_at") val completedAt: Long? = null-)\ No newline at end of file+)diff --git a/data/src/main/java/com/streamvault/data/remote/xtream/OkHttpXtreamApiService.kt b/data/src/main/java/com/streamvault/data/remote/xtream/OkHttpXtreamApiService.ktindex 57373614..c80e9a03 100644--- a/data/src/main/java/com/streamvault/data/remote/xtream/OkHttpXtreamApiService.kt+++ b/data/src/main/java/com/streamvault/data/remote/xtream/OkHttpXtreamApiService.kt@@ -21,6 +21,12 @@ import java.io.InputStreamimport java.io.InputStreamReaderimport java.io.PushbackInputStreamimport kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.CoroutineStart+import kotlinx.coroutines.awaitCancellation+import kotlinx.coroutines.coroutineScope+import kotlinx.coroutines.currentCoroutineContext+import kotlinx.coroutines.ensureActive+import kotlinx.coroutines.launchimport kotlinx.coroutines.suspendCancellableCoroutineimport kotlinx.coroutines.withContextimport kotlinx.serialization.DeserializationStrategy@@ -210,7 +216,7 @@ class OkHttpXtreamApiService(.withRequestProfile(effectiveRequestProfile)try {val call = clientFor(effectiveProfile).newCall(request)- executeCancellable(call).use { response ->+ withCancellableResponse(call) { response ->if (!response.isSuccessful) {val message = "HTTP ${response.code}"Log.w(@@ -241,6 +247,7 @@ class OkHttpXtreamApiService(} catch (e: XtreamApiException) {throw e} catch (e: IOException) {+ currentCoroutineContext().ensureActive()Log.w(TAG,"Xtream request network failure for ${descriptor.hint} (${request.safeRequestIdentitySummary(effectiveRequestProfile)}): ${XtreamUrlFactory.sanitizeLogMessage(e.message ?: "Network request failed")}"@@ -338,7 +345,7 @@ class OkHttpXtreamApiService(.withRequestProfile(effectiveRequestProfile)try {val call = clientFor(effectiveProfile).newCall(request)- executeCancellable(call).use { response ->+ withCancellableResponse(call) { response ->if (!response.isSuccessful) {val message = "HTTP ${response.code}"Log.w(@@ -380,6 +387,7 @@ class OkHttpXtreamApiService(} catch (e: XtreamApiException) {throw e} catch (e: IOException) {+ currentCoroutineContext().ensureActive()Log.w(TAG,"Xtream streamed request network failure for ${descriptor.hint} (${request.safeRequestIdentitySummary(effectiveRequestProfile)}): ${XtreamUrlFactory.sanitizeLogMessage(e.message ?: "Network request failed")}"@@ -394,6 +402,18 @@ class OkHttpXtreamApiService(}}+ private suspend fun <T> withCancellableResponse(call: Call, block: suspend (Response) -> T): T = coroutineScope {+ // Cancellation stays connected while a response body is being read.+ val watcher = launch(Dispatchers.Default, start = CoroutineStart.UNDISPATCHED) {+ try { awaitCancellation() } finally { call.cancel() }+ }+ try {+ executeCancellable(call).use { block(it) }+ } finally {+ watcher.cancel()+ }+ }+private suspend fun executeCancellable(call: Call) = suspendCancellableCoroutine { continuation ->continuation.invokeOnCancellation {call.cancel()@@ -407,7 +427,7 @@ class OkHttpXtreamApiService(override fun onResponse(call: Call, response: Response) {if (continuation.isActive) {- continuation.resume(response)+ continuation.resume(response) { _, deliveredResponse, _ -> deliveredResponse.close() }} else {response.close()}@@ -512,6 +532,7 @@ class OkHttpXtreamApiService(var emittedCount = 0reader.beginArray()while (reader.hasNext()) {+ currentCoroutineContext().ensureActive()val element = try {JsonParser.parseReader(reader)} catch (e: RuntimeException) {@@ -532,10 +553,16 @@ class OkHttpXtreamApiService(emittedCount++}reader.endArray()+ if (reader.peek() != JsonToken.END_DOCUMENT) {+ throw XtreamParsingException("Trailing data after JSON array from ${descriptor.hint}")+ }emittedCount}JsonToken.NULL -> {reader.nextNull()+ if (reader.peek() != JsonToken.END_DOCUMENT) {+ throw XtreamParsingException("Trailing data after JSON null from ${descriptor.hint}")+ }0}else -> throw XtreamParsingException(diff --git a/data/src/main/java/com/streamvault/data/sync/ProviderWorkflowCommitFence.kt b/data/src/main/java/com/streamvault/data/sync/ProviderWorkflowCommitFence.ktindex a850584f..5727fccf 100644--- a/data/src/main/java/com/streamvault/data/sync/ProviderWorkflowCommitFence.kt+++ b/data/src/main/java/com/streamvault/data/sync/ProviderWorkflowCommitFence.kt@@ -7,6 +7,7 @@ import javax.inject.Singletonimport kotlin.coroutines.AbstractCoroutineContextElementimport kotlin.coroutines.CoroutineContextimport kotlin.coroutines.coroutineContext+import kotlinx.coroutines.CancellationException/*** Lease propagated through the sync coroutine so catalog commits can prove they still belong to@@ -21,7 +22,7 @@ class ProviderWorkflowExecutionContext(class ProviderWorkflowSupersededException(providerId: Long,generation: Long-) : IllegalStateException(+) : CancellationException("Provider $providerId workflow generation $generation was superseded before catalog commit.")diff --git a/data/src/main/java/com/streamvault/data/sync/ProviderWorkflowRunner.kt b/data/src/main/java/com/streamvault/data/sync/ProviderWorkflowRunner.ktindex dbd04d61..f9c76380 100644--- a/data/src/main/java/com/streamvault/data/sync/ProviderWorkflowRunner.kt+++ b/data/src/main/java/com/streamvault/data/sync/ProviderWorkflowRunner.kt@@ -99,6 +99,8 @@ class ProviderWorkflowRunner @Inject constructor(publishOutcome(lease, outcome)} catch (lost: ProviderWorkflowLeaseLostException) {ProviderWorkflowDisposition.SUPERSEDED+ } catch (superseded: ProviderWorkflowSupersededException) {+ ProviderWorkflowDisposition.SUPERSEDED} catch (cancelled: CancellationException) {// Cancellation is owner control flow, not a provider failure. Leave the durable// lease running so the normal stale-lease recovery path can reclaim it withoutdiff --git a/data/src/main/java/com/streamvault/data/sync/SyncCatalogStore.kt b/data/src/main/java/com/streamvault/data/sync/SyncCatalogStore.ktindex f830912f..753f99c3 100644--- a/data/src/main/java/com/streamvault/data/sync/SyncCatalogStore.kt+++ b/data/src/main/java/com/streamvault/data/sync/SyncCatalogStore.kt@@ -502,6 +502,38 @@ internal class SyncCatalogStore(clearSession(providerId, sessionId)}+ suspend fun <T> withLiveCatalogFence(providerId: Long, block: suspend () -> T): T =+ providerTransaction(providerId, block)++ suspend fun sealCompletedLiveImport(+ providerId: Long,+ sessionId: Long,+ expectedCount: Int,+ categories: List<CategoryEntity>?,+ writeReceipt: suspend () -> Unit+ ) {+ providerTransaction(providerId) {+ check(expectedCount > 0 && catalogSyncDao.countChannelStages(providerId, sessionId) == expectedCount)+ categories?.let { stageCategories(providerId, sessionId, it) }+ writeReceipt()+ }+ }++ suspend fun mergeCompletedLiveCategory(providerId: Long, sourceSessionId: Long, targetSessionId: Long): Int {+ require(sourceSessionId != targetSessionId)+ return providerTransaction(providerId) {+ val moved = catalogSyncDao.moveCompletedChannelStages(providerId, sourceSessionId, targetSessionId)+ requireStageCapacity(+ currentCount = catalogSyncDao.countChannelStages(providerId, targetSessionId),+ incomingCount = 0,+ maximum = sizeLimits.maxChannelsPerProvider,+ label = "channel"+ )+ catalogSyncDao.clearChannelStages(providerId, sourceSessionId)+ moved+ }+ }+private suspend fun <T> providerTransaction(providerId: Long,block: suspend () -> T@@ -552,7 +584,7 @@ internal class SyncCatalogStore(}suspend fun clearProviderStaging(providerId: Long) {- transactionRunner.inTransaction {+ providerTransaction(providerId) {catalogSyncDao.clearProviderChannelStages(providerId)catalogSyncDao.clearProviderMovieStages(providerId)catalogSyncDao.clearProviderSeriesStages(providerId)diff --git a/data/src/main/java/com/streamvault/data/sync/SyncManager.kt b/data/src/main/java/com/streamvault/data/sync/SyncManager.ktindex 2fb068d8..d614e906 100644--- a/data/src/main/java/com/streamvault/data/sync/SyncManager.kt+++ b/data/src/main/java/com/streamvault/data/sync/SyncManager.kt@@ -571,6 +571,11 @@ class SyncManager @Inject constructor(channelDao = channelDao,categoryDao = categoryDao,xtreamLiveOnboardingDao = xtreamLiveOnboardingDao,+ configurationGeneration = { provider ->+ syncProviderSnapshotAdapter.getSnapshot(provider.id)+ ?.takeIf { it.configuration == syncProviderSnapshotAdapter.toSnapshot(provider).configuration }+ ?.configurationGeneration+ },syncCatalogStore = syncCatalogStore,sectionExecutor = xtreamCatalogSectionExecutor,liveStrategy = xtreamLiveStrategy,diff --git a/data/src/main/java/com/streamvault/data/sync/SyncManagerXtreamFetcher.kt b/data/src/main/java/com/streamvault/data/sync/SyncManagerXtreamFetcher.ktindex 32fac4fd..aeb98c1c 100644--- a/data/src/main/java/com/streamvault/data/sync/SyncManagerXtreamFetcher.kt+++ b/data/src/main/java/com/streamvault/data/sync/SyncManagerXtreamFetcher.kt@@ -8,6 +8,7 @@ import com.streamvault.data.remote.dto.XtreamStreamimport com.streamvault.data.remote.xtream.OkHttpXtreamApiServiceimport com.streamvault.data.remote.xtream.XtreamApiServiceimport com.streamvault.data.remote.xtream.XtreamProvider+import com.streamvault.data.remote.xtream.XtreamParsingExceptionimport com.streamvault.data.remote.xtream.XtreamUrlFactoryimport com.streamvault.data.util.runSuspendCatchingimport com.streamvault.domain.model.Channel@@ -29,7 +30,8 @@ internal class SyncManagerXtreamFetcher(api: XtreamProvider,category: XtreamCategory,stageBatchSize: Int? = null,- onMappedBatch: (suspend (List<Channel>) -> Unit)? = null+ onMappedBatch: (suspend (List<Channel>) -> Unit)? = null,+ onAttemptReset: suspend () -> Unit = {}): TimedCategoryOutcome<Channel> {val endpoint = XtreamUrlFactory.buildPlayerApiUrl(serverUrl = provider.serverUrl,@@ -82,6 +84,9 @@ internal class SyncManagerXtreamFetcher(val elapsedMs = measureTimeMillis {when (val attempt = xtreamSupport.attemptNonCancellation {xtreamSupport.retryXtreamCatalogTransient(provider.id) {+ onAttemptReset()+ rawCount = 0+ mappedChannels = emptyList()xtreamSupport.executeXtreamRequest(provider.id, XtreamAdaptiveSyncPolicy.Stage.CATEGORY) {val thinResult = runSuspendCatching {streamThinRowsInBatches()@@ -92,12 +97,14 @@ internal class SyncManagerXtreamFetcher(rawCount = thinCountmappedChannels = thinChannels} else {+ thinResult.exceptionOrNull()?.let { if (it !is XtreamParsingException) throw it }thinResult.exceptionOrNull()?.let { error ->Log.w(XTREAM_FETCHER_TAG,"Xtream live category '${category.categoryName}' thin decode failed; retrying legacy decode: ${sanitizeThrowableMessage(error)}")}+ onAttemptReset()val legacyStreams = xtreamCatalogApiService.getLiveStreams(endpoint)rawCount = legacyStreams.sizeemitMappedChannels(api.mapLiveStreamsResponse(legacyStreams))diff --git a/data/src/main/java/com/streamvault/data/sync/SyncManagerXtreamLiveStrategy.kt b/data/src/main/java/com/streamvault/data/sync/SyncManagerXtreamLiveStrategy.ktindex aadf88a1..0d26d648 100644--- a/data/src/main/java/com/streamvault/data/sync/SyncManagerXtreamLiveStrategy.kt+++ b/data/src/main/java/com/streamvault/data/sync/SyncManagerXtreamLiveStrategy.kt@@ -8,6 +8,7 @@ import com.streamvault.data.remote.dto.XtreamStreamimport com.streamvault.data.remote.xtream.OkHttpXtreamApiServiceimport com.streamvault.data.remote.xtream.XtreamApiServiceimport com.streamvault.data.remote.xtream.XtreamProvider+import com.streamvault.data.remote.xtream.XtreamParsingExceptionimport com.streamvault.data.remote.xtream.XtreamUrlFactoryimport com.streamvault.domain.model.Channelimport com.streamvault.domain.model.ContentType@@ -57,6 +58,9 @@ internal class SyncManagerXtreamLiveStrategy(requiredHiddenLiveCategoryIds: Set<Long> = emptySet()): CatalogSyncPayload<Channel> {Log.i(XTREAM_LIVE_STRATEGY_TAG, "Xtream live strategy start for provider ${provider.id}.")+ // Recovery runs before entering this strategy. Any other saved batches+ // are unsealed attempts and cannot be reused by this import.+ syncCatalogStore.clearProviderStaging(provider.id)val rawLiveCategories = when (val attempt = xtreamSupport.attemptNonCancellation {xtreamSupport.retryXtreamCatalogTransient(provider.id) {xtreamSupport.executeXtreamRequest(provider.id, XtreamAdaptiveSyncPolicy.Stage.LIGHTWEIGHT) {@@ -219,7 +223,7 @@ internal class SyncManagerXtreamLiveStrategy(private fun CatalogSyncPayload<Channel>.shouldRetryLegacyFullDecode(): Boolean {val result = catalogResultif ((result as? CatalogStrategyResult.Failure)?.error is LowMemoryCatalogAbortException) return false- return result is CatalogStrategyResult.Failure ||+ return (result is CatalogStrategyResult.Failure && result.error is XtreamParsingException) ||(result is CatalogStrategyResult.EmptyValid && result.warnings.any { warning ->warning.contains("raw items but none were usable", ignoreCase = true)})@@ -233,7 +237,7 @@ internal class SyncManagerXtreamLiveStrategy(mapRawBatch: suspend (Sequence<RawItem>) -> Sequence<Channel>,runtimeProfile: CatalogSyncRuntimeProfile): CatalogSyncPayload<Channel> {- val fallbackCollector = FallbackCategoryCollector(provider.id, ContentType.LIVE)+ var fallbackCollector = FallbackCategoryCollector(provider.id, ContentType.LIVE)val seenStreamIds = HashSet<Long>()val rawBatch = ArrayList<RawItem>(runtimeProfile.stageBatchSize)var stagedSessionId: Long? = null@@ -244,6 +248,15 @@ internal class SyncManagerXtreamLiveStrategy(var mappingElapsedMs = 0Lvar stagingElapsedMs = 0L+ suspend fun discardAttempt() {+ stagedSessionId?.let { syncCatalogStore.discardStagedImport(provider.id, it) }+ stagedSessionId = null+ rawBatch.clear()+ seenStreamIds.clear()+ fallbackCollector = FallbackCategoryCollector(provider.id, ContentType.LIVE)+ acceptedCount = 0+ }+fun abortIfLowMemory() {if (isCurrentlyLowOnMemory()) {// D12 — emission finale avant l'avortement low-memory : reflete l'etat@@ -274,6 +287,9 @@ internal class SyncManagerXtreamLiveStrategy(}lateinit var staged: StagedCatalogSnapshotstagingElapsedMs += measureTimeMillis {+ if (mappedChannels.isNotEmpty() && stagedSessionId == null) {+ stagedSessionId = syncCatalogStore.newSessionId()+ }staged = stageChannelItems(provider.id,mappedChannels,@@ -305,16 +321,25 @@ internal class SyncManagerXtreamLiveStrategy(val fullChannelsElapsedMs = measureTimeMillis {when (val attempt = xtreamSupport.attemptNonCancellation {xtreamSupport.retryXtreamCatalogTransient(provider.id) {- xtreamSupport.executeXtreamRequest(provider.id, XtreamAdaptiveSyncPolicy.Stage.HEAVY) {- streamItems { item ->- rawBatch += item- streamedRawCount++- if (rawBatch.size >= runtimeProfile.stageBatchSize) {+ streamedRawCount = 0+ flushCount = 0+ mappingElapsedMs = 0L+ stagingElapsedMs = 0L+ try {+ xtreamSupport.executeXtreamRequest(provider.id, XtreamAdaptiveSyncPolicy.Stage.HEAVY) {+ streamItems { item ->+ rawBatch += item+ streamedRawCount+++ if (rawBatch.size >= runtimeProfile.stageBatchSize) {+ flushRawBatch()+ }+ }.also {flushRawBatch()}- }.also {- flushRawBatch()}+ } catch (error: Throwable) {+ discardAttempt()+ throw error}}}) {@@ -414,159 +439,188 @@ internal class SyncManagerXtreamLiveStrategy(}val fallbackCollector = FallbackCategoryCollector(provider.id, ContentType.LIVE)- val seenStreamIds = HashSet<Long>()val stageMutex = Mutex()var stagedSessionId: Long? = nullvar stagedAcceptedCount = 0- suspend fun stageMappedBatch(channels: List<Channel>) {- if (channels.isEmpty()) return- stageMutex.withLock {- val staged = stageChannelItems(- provider.id,- channels,- seenStreamIds,- fallbackCollector,- stagedSessionId- )- stagedSessionId = staged.sessionId- stagedAcceptedCount += staged.acceptedCount- }- }+ suspend fun fetchCompletedCategory(category: XtreamCategory): TimedCategoryOutcome<Channel> {+ var attemptSessionId = syncCatalogStore.newSessionId()+ val attemptSeenIds = HashSet<Long>()+ var attemptCategories = FallbackCategoryCollector(provider.id, ContentType.LIVE)+ var attemptHasRows = false- val adaptiveConcurrency = xtreamAdaptiveSyncPolicy.concurrencyFor(- providerId = provider.id,- workloadSize = categories.size,- preferSequential = preferSequential,- stage = XtreamAdaptiveSyncPolicy.Stage.CATEGORY- )- val concurrency = adaptiveConcurrency.coerceAtMost(runtimeProfile.maxCategoryConcurrency)- progress(provider.id, onProgress, "Downloading Live TV by category 0/${categories.size}...")+ suspend fun discardAttempt() {+ // Session identity is known before staging, including when the+ // writer throws after accepting a batch.+ syncCatalogStore.discardStagedImport(provider.id, attemptSessionId)+ attemptHasRows = false+ }- // D11 — le total de catégories LIVE est fige une seule fois ici : la liste- // `categories` ne mute plus pendant la recuperation, donc la lambda- // `onCategoryCompleted` recoit le meme denominateur a chaque fenetre.- val executionPlan = xtreamSupport.executeCategoryRecoveryPlan(- provider = provider,- categories = categories,- initialConcurrency = concurrency,- sectionLabel = "Live TV",- sequentialModeWarning = liveCategorySequentialModeWarning,- onProgress = onProgress,- fetch = { category ->- xtreamFetcher.fetchLiveCategoryOutcome(+ try {+ val result = xtreamFetcher.fetchLiveCategoryOutcome(provider = provider,api = api,category = category,stageBatchSize = runtimeProfile.stageBatchSize,- onMappedBatch = ::stageMappedBatch- )- },- onCategoryCompleted = { completed, total, currentLabel ->- // D6 — emission structuree en parallele du callback string deja emis par- // `executeCategoryRecoveryPlan` via `progress(...)`. Le compteur cumulatif- // `stagedAcceptedCount` est mis a jour de maniere thread-safe sous le- // `stageMutex` (cf `stageMappedBatch`), la lecture ici est best-effort- // (snapshot UX, pas une metrique business).- emitProgress(provider.id,- SyncProgress(- section = Section.LIVE,- current = completed,- total = total,- currentLabel = currentLabel,- itemsIndexed = stagedAcceptedCount- )+ onAttemptReset = {+ if (attemptHasRows) discardAttempt()+ attemptSessionId = syncCatalogStore.newSessionId()+ attemptSeenIds.clear()+ attemptCategories = FallbackCategoryCollector(provider.id, ContentType.LIVE)+ },+ onMappedBatch = { channels ->+ if (channels.isNotEmpty()) {+ attemptHasRows = true+ stageChannelItems(+ provider.id, channels, attemptSeenIds, attemptCategories, attemptSessionId+ )+ }+ })- }- )- var timedOutcomes = executionPlan.outcomes- val categoryOutcomes = timedOutcomes.map { it.outcome }- val failureCount = timedOutcomes.count { it.outcome is CategoryFetchOutcome.Failure }- val fastFailureCount = timedOutcomes.count {- it.elapsedMs <= 5_000L && it.outcome is CategoryFetchOutcome.Failure+ if (result.outcome is CategoryFetchOutcome.Success && attemptHasRows) {+ stageMutex.withLock {+ val target = stagedSessionId ?: syncCatalogStore.newSessionId()+ val moved = syncCatalogStore.mergeCompletedLiveCategory(provider.id, attemptSessionId, target)+ stagedSessionId = target+ stagedAcceptedCount += moved+ attemptCategories.entities().forEach {+ fallbackCollector.record(it.categoryId, it.name, it.isAdult)+ }+ }+ }+ return result+ } finally {+ discardAttempt()+ }}- val downgradeRecommended = catalogStrategySupport.shouldDowngradeCategorySync(- categories.size,- failureCount,- fastFailureCount,- categoryOutcomes- )- var fallbackWarnings = executionPlan.warnings- if (concurrency > 1 && catalogStrategySupport.shouldRetryFailedCategories(- categories.size,- failureCount,- downgradeRecommended,- categoryOutcomes- )- ) {- val failedRetryTotal = timedOutcomes.count { it.outcome is CategoryFetchOutcome.Failure }- Log.w(- XTREAM_LIVE_STRATEGY_TAG,- "Xtream live category sync is continuing in sequential mode for failed categories on provider ${provider.id}."++ var retainedSnapshot = false+ try {+ val adaptiveConcurrency = xtreamAdaptiveSyncPolicy.concurrencyFor(+ providerId = provider.id,+ workloadSize = categories.size,+ preferSequential = preferSequential,+ stage = XtreamAdaptiveSyncPolicy.Stage.CATEGORY)- progress(provider.id, onProgress, "Retrying failed Live TV categories 0/$failedRetryTotal...")- timedOutcomes = xtreamSupport.continueFailedCategoryOutcomes(+ val concurrency = adaptiveConcurrency.coerceAtMost(runtimeProfile.maxCategoryConcurrency)+ progress(provider.id, onProgress, "Downloading Live TV by category 0/${categories.size}...")++ // D11 — le total de catégories LIVE est fige une seule fois ici : la liste+ // `categories` ne mute plus pendant la recuperation, donc la lambda+ // `onCategoryCompleted` recoit le meme denominateur a chaque fenetre.+ val executionPlan = xtreamSupport.executeCategoryRecoveryPlan(provider = provider,- timedOutcomes = timedOutcomes,- fetchSequentially = { category ->- xtreamFetcher.fetchLiveCategoryOutcome(- provider = provider,- api = api,- category = category,- stageBatchSize = runtimeProfile.stageBatchSize,- onMappedBatch = ::stageMappedBatch+ categories = categories,+ initialConcurrency = concurrency,+ sectionLabel = "Live TV",+ sequentialModeWarning = liveCategorySequentialModeWarning,+ onProgress = onProgress,+ fetch = ::fetchCompletedCategory,+ onCategoryCompleted = { completed, total, currentLabel ->+ // D6 — emission structuree en parallele du callback string deja emis par+ // `executeCategoryRecoveryPlan` via `progress(...)`. Le compteur cumulatif+ // `stagedAcceptedCount` est mis a jour de maniere thread-safe sous le+ // `stageMutex` (cf `fetchCompletedCategory`), la lecture ici est best-effort+ // (snapshot UX, pas une metrique business).+ emitProgress(provider.id,+ SyncProgress(+ section = Section.LIVE,+ current = completed,+ total = total,+ currentLabel = currentLabel,+ itemsIndexed = stagedAcceptedCount+ ))- },- onCategoryRetried = { completed, total, _ ->- progress(provider.id, onProgress, "Retrying failed Live TV categories $completed/$total...")})- fallbackWarnings = (fallbackWarnings + if (downgradeRecommended) listOf(liveCategorySequentialModeWarning) else emptyList()).distinct()- }+ var timedOutcomes = executionPlan.outcomes- val finalOutcomes = timedOutcomes.map { it.outcome }- val warnings = finalOutcomes- .filterIsInstance<CategoryFetchOutcome.Failure>()- .map { failure -> categoryFailureWarning("Live TV", failure.categoryName, failure.error) } +- fallbackWarnings+ val categoryOutcomes = timedOutcomes.map { it.outcome }+ val failureCount = timedOutcomes.count { it.outcome is CategoryFetchOutcome.Failure }+ val fastFailureCount = timedOutcomes.count {+ it.elapsedMs <= 5_000L && it.outcome is CategoryFetchOutcome.Failure+ }+ val downgradeRecommended = catalogStrategySupport.shouldDowngradeCategorySync(+ categories.size,+ failureCount,+ fastFailureCount,+ categoryOutcomes+ )+ var fallbackWarnings = executionPlan.warnings+ if (concurrency > 1 && catalogStrategySupport.shouldRetryFailedCategories(+ categories.size,+ failureCount,+ downgradeRecommended,+ categoryOutcomes+ )+ ) {+ val failedRetryTotal = timedOutcomes.count { it.outcome is CategoryFetchOutcome.Failure }+ Log.w(+ XTREAM_LIVE_STRATEGY_TAG,+ "Xtream live category sync is continuing in sequential mode for failed categories on provider ${provider.id}."+ )+ progress(provider.id, onProgress, "Retrying failed Live TV categories 0/$failedRetryTotal...")+ timedOutcomes = xtreamSupport.continueFailedCategoryOutcomes(+ provider = provider,+ timedOutcomes = timedOutcomes,+ fetchSequentially = ::fetchCompletedCategory,+ onCategoryRetried = { completed, total, _ ->+ progress(provider.id, onProgress, "Retrying failed Live TV categories $completed/$total...")+ }+ )+ fallbackWarnings = (fallbackWarnings + if (downgradeRecommended) listOf(liveCategorySequentialModeWarning) else emptyList()).distinct()+ }- val failedCategories = finalOutcomes.count { it is CategoryFetchOutcome.Failure }- val emptyCategories = finalOutcomes.count { it is CategoryFetchOutcome.Empty }- val successfulCategories = finalOutcomes.count { it is CategoryFetchOutcome.Success }- Log.i(- XTREAM_LIVE_STRATEGY_TAG,- "Xtream live category strategy summary for provider ${provider.id}: successful=$successfulCategories empty=$emptyCategories failed=$failedCategories stagedChannels=$stagedAcceptedCount concurrency=$concurrency"- )+ val finalOutcomes = timedOutcomes.map { it.outcome }+ val warnings = finalOutcomes+ .filterIsInstance<CategoryFetchOutcome.Failure>()+ .map { failure -> categoryFailureWarning("Live TV", failure.categoryName, failure.error) } ++ fallbackWarnings- return when {- stagedAcceptedCount > 0 && failedCategories == 0 -> CatalogSyncPayload(- catalogResult = CatalogStrategyResult.Success("category_bulk", emptyList(), warnings.toList()),- categories = fallbackCollector.entities().takeIf { it.isNotEmpty() },- stagedSessionId = stagedSessionId,- stagedAcceptedCount = stagedAcceptedCount- )- stagedAcceptedCount > 0 -> CatalogSyncPayload(- catalogResult = CatalogStrategyResult.Partial("category_bulk", emptyList(), warnings.toList()),- categories = fallbackCollector.entities().takeIf { it.isNotEmpty() },- stagedSessionId = stagedSessionId,- stagedAcceptedCount = stagedAcceptedCount- )- failedCategories > 0 -> CatalogSyncPayload(- catalogResult = CatalogStrategyResult.Failure(- strategyName = "category_bulk",- error = IllegalStateException("Live category-bulk sync failed for all usable categories"),- warnings = warnings.toList()- ),- categories = null- )- else -> CatalogSyncPayload(- catalogResult = CatalogStrategyResult.EmptyValid(- strategyName = "category_bulk",- warnings = listOf("All live categories returned valid empty results.")- ),- categories = null+ val failedCategories = finalOutcomes.count { it is CategoryFetchOutcome.Failure }+ val emptyCategories = finalOutcomes.count { it is CategoryFetchOutcome.Empty }+ val successfulCategories = finalOutcomes.count { it is CategoryFetchOutcome.Success }+ val incompleteCoverage = finalOutcomes.size != categories.size+ Log.i(+ XTREAM_LIVE_STRATEGY_TAG,+ "Xtream live category strategy summary for provider ${provider.id}: successful=$successfulCategories empty=$emptyCategories failed=$failedCategories stagedChannels=$stagedAcceptedCount concurrency=$concurrency")++ val payload: CatalogSyncPayload<Channel> = when {+ stagedAcceptedCount > 0 && failedCategories == 0 && !incompleteCoverage -> CatalogSyncPayload(+ catalogResult = CatalogStrategyResult.Success("category_bulk", emptyList(), warnings.toList()),+ categories = fallbackCollector.entities().takeIf { it.isNotEmpty() },+ stagedSessionId = stagedSessionId,+ stagedAcceptedCount = stagedAcceptedCount+ )+ stagedAcceptedCount > 0 -> CatalogSyncPayload(+ catalogResult = CatalogStrategyResult.Partial("category_bulk", emptyList(), warnings.toList()),+ categories = fallbackCollector.entities().takeIf { it.isNotEmpty() },+ stagedSessionId = stagedSessionId,+ stagedAcceptedCount = stagedAcceptedCount+ )+ failedCategories > 0 || incompleteCoverage -> CatalogSyncPayload(+ catalogResult = CatalogStrategyResult.Failure(+ strategyName = "category_bulk",+ error = IllegalStateException("Live category-bulk sync failed for all usable categories"),+ warnings = warnings.toList()+ ),+ categories = null+ )+ else -> CatalogSyncPayload(+ catalogResult = CatalogStrategyResult.EmptyValid(+ strategyName = "category_bulk",+ warnings = listOf("All live categories returned valid empty results.")+ ),+ categories = null+ )+ }+ return payload.also { retainedSnapshot = it.stagedSessionId != null }+ } finally {+ if (!retainedSnapshot) {+ stagedSessionId?.let { syncCatalogStore.discardStagedImport(provider.id, it) }+ }}}}diff --git a/data/src/main/java/com/streamvault/data/sync/XtreamCatalogSyncExecutor.kt b/data/src/main/java/com/streamvault/data/sync/XtreamCatalogSyncExecutor.ktindex 4c8f8d28..cc873f54 100644--- a/data/src/main/java/com/streamvault/data/sync/XtreamCatalogSyncExecutor.kt+++ b/data/src/main/java/com/streamvault/data/sync/XtreamCatalogSyncExecutor.kt@@ -52,6 +52,7 @@ internal class XtreamCatalogSyncExecutor(private val channelDao: ChannelDao,private val categoryDao: CategoryDao,private val xtreamLiveOnboardingDao: XtreamLiveOnboardingDao,+ private val configurationGeneration: suspend (Provider) -> Long? = { null },private val syncCatalogStore: SyncCatalogStore,private val sectionExecutor: XtreamCatalogSectionExecutor,private val liveStrategy: SyncManagerXtreamLiveStrategy,@@ -86,6 +87,8 @@ internal class XtreamCatalogSyncExecutor(progress(provider.id, onProgress, "Connecting to server...")val useTextClassification = preferencesRepository.useXtreamTextClassification.first()val enableBase64TextCompatibility = preferencesRepository.xtreamBase64TextCompatibility.first()+ val mappingProfile = "text=$useTextClassification;base64=$enableBase64TextCompatibility"+ val receiptGeneration = if (trackInitialLiveOnboarding) configurationGeneration(provider) else nullval hiddenLiveCategoryIds = preferencesRepository.getHiddenCategoryIds(provider.id, ContentType.LIVE).first()val requiredHiddenLiveCategoryIds = requiredHiddenCategoryIds(provider.id, ContentType.LIVE)val api = createProvider(provider, useTextClassification, enableBase64TextCompatibility)@@ -114,7 +117,7 @@ internal class XtreamCatalogSyncExecutor()val liveOutcome = runSuspendCatching {val recoveredLiveCommit = if (trackInitialLiveOnboarding) {- recoverOnboardingSession(provider, hiddenLiveCategoryIds, afterCatalogApply)+ recoverOnboardingSession(provider, hiddenLiveCategoryIds, receiptGeneration, mappingProfile, afterCatalogApply)} else {null}@@ -167,22 +170,42 @@ internal class XtreamCatalogSyncExecutor()if (trackInitialLiveOnboarding) {val stagedAcceptedCount = liveSyncResult.stagedAcceptedCount- recordOnboardingState(- provider = provider,- phase = if (liveSyncResult.stagedSessionId != null) {- XTREAM_ONBOARDING_PHASE_STAGED- } else {- XTREAM_ONBOARDING_PHASE_COMMITTING- },- now = System.currentTimeMillis(),- stagedSessionId = liveSyncResult.stagedSessionId,- importStrategy = liveSyncResult.catalogResult.strategyNameOrNull(),- acceptedRowCount = stagedAcceptedCount,- stagedFlushCount = stagedFlushCountFor(stagedAcceptedCount),- clearError = true,- runtimeProfile = runtimeProfile,- syncProfileStrategy = liveSyncResult.profileStrategyName(runtimeProfile, trackInitialLiveOnboarding)- )+ val canSeal = receiptGeneration != null && liveSyncResult.stagedSessionId != null &&+ liveSyncResult.catalogResult is CatalogStrategyResult.Success &&+ liveSyncResult.catalogResult.strategyName == "full"+ val writeState: suspend () -> Unit = {+ // Recheck configuration inside the transaction that seals the+ // snapshot. A changed provider must not receive an old receipt.+ if (canSeal && configurationGeneration(provider) != receiptGeneration) {+ throw ProviderWorkflowSupersededException(provider.id, requireNotNull(receiptGeneration))+ }+ recordOnboardingState(+ provider = provider,+ phase = if (liveSyncResult.stagedSessionId != null) {+ XTREAM_ONBOARDING_PHASE_STAGED+ } else {+ XTREAM_ONBOARDING_PHASE_COMMITTING+ },+ now = System.currentTimeMillis(),+ stagedSessionId = liveSyncResult.stagedSessionId,+ importStrategy = liveSyncResult.catalogResult.strategyNameOrNull(),+ acceptedRowCount = stagedAcceptedCount,+ stagedFlushCount = stagedFlushCountFor(stagedAcceptedCount),+ clearError = true,+ runtimeProfile = runtimeProfile,+ syncProfileStrategy = liveSyncResult.profileStrategyName(runtimeProfile, trackInitialLiveOnboarding),+ sealedSessionId = liveSyncResult.stagedSessionId.takeIf { canSeal },+ sealedRowCount = stagedAcceptedCount,+ sealedConfigurationGeneration = receiptGeneration,+ sealedMappingProfile = mappingProfile+ )+ }+ val session = liveSyncResult.stagedSessionId+ if (session != null && canSeal) {+ syncCatalogStore.sealCompletedLiveImport(provider.id, session, stagedAcceptedCount, liveSyncResult.categories, writeState)+ } else {+ writeState()+ }}val liveSequentialStress = liveSyncResult.strategyFeedback.segmentedStressDetectedval liveProviderAdaptation = updateSequentialProviderAdaptation(@@ -668,6 +691,8 @@ internal class XtreamCatalogSyncExecutor(private suspend fun recoverOnboardingSession(provider: Provider,hiddenLiveCategoryIds: Set<Long>,+ currentGeneration: Long?,+ mappingProfile: String,afterCatalogApply: suspend () -> Unit): XtreamLiveCommitResult? {val state = xtreamLiveOnboardingDao.getIncompleteByProvider(provider.id) ?: return null@@ -676,13 +701,17 @@ internal class XtreamCatalogSyncExecutor(discardOnboardingSession(provider, sessionId, "Saved Live TV import did not match this provider.")return null}- if (state.importStrategy != null && state.importStrategy != "full") {+ if (state.importStrategy != "full" || state.sealedSessionId != sessionId ||+ state.sealedRowCount <= 0 || state.sealedConfigurationGeneration == null ||+ state.sealedConfigurationGeneration != currentGeneration || state.sealedMappingProfile != mappingProfile ||+ hiddenLiveCategoryIds.isNotEmpty()) {discardOnboardingSession(provider, sessionId, "Saved Live TV import strategy could not be resumed.")return null}val stagedState = syncCatalogStore.stagedLiveImportState(provider.id, sessionId)val discardReason = when {- stagedState.channelCount <= 0 -> "Saved Live TV import was missing staged channels."+ stagedState.channelCount != state.sealedRowCount || state.acceptedRowCount != state.sealedRowCount ->+ "Saved Live TV import did not match its completed snapshot receipt."stagedState.movieCount > 0 || stagedState.seriesCount > 0 -> "Saved Live TV import contained rows for another catalog type."else -> null}@@ -699,14 +728,6 @@ internal class XtreamCatalogSyncExecutor(stagedFlushCount = stagedFlushCountFor(stagedState.channelCount),clearError = true)- if (hiddenLiveCategoryIds.isNotEmpty()) {- mergeHiddenChannelsIntoStaging(provider.id, sessionId, hiddenLiveCategoryIds)- }- val commitState = if (hiddenLiveCategoryIds.isNotEmpty()) {- syncCatalogStore.stagedLiveImportState(provider.id, sessionId)- } else {- stagedState- }recordOnboardingState(provider,XTREAM_ONBOARDING_PHASE_COMMITTING,@@ -719,7 +740,7 @@ internal class XtreamCatalogSyncExecutor(syncCatalogStore.applyStagedLiveCatalog(providerId = provider.id,sessionId = sessionId,- categories = commitState.categories.takeIf { it.isNotEmpty() },+ categories = stagedState.categories.takeIf { it.isNotEmpty() },afterCatalogApply = afterCatalogApply)return XtreamLiveCommitResult(stagedState.channelCount, listOf("Live TV import resumed from saved staged session."))@@ -750,36 +771,46 @@ internal class XtreamCatalogSyncExecutor(completedAt: Long? = null,clearStagedSession: Boolean = false,runtimeProfile: CatalogSyncRuntimeProfile? = null,- syncProfileStrategy: String? = null+ syncProfileStrategy: String? = null,+ sealedSessionId: Long? = null,+ sealedRowCount: Int = 0,+ sealedConfigurationGeneration: Long? = null,+ sealedMappingProfile: String? = null) {- val existing = xtreamLiveOnboardingDao.getByProvider(provider.id)- xtreamLiveOnboardingDao.upsert(- XtreamLiveOnboardingStateEntity(- providerId = provider.id,- providerType = provider.type.name,- contentType = ContentType.LIVE.name,- phase = phase,- stagedSessionId = if (clearStagedSession) null else stagedSessionId ?: existing?.stagedSessionId,- importStrategy = importStrategy ?: existing?.importStrategy,- nextCategoryIndex = nextCategoryIndex ?: existing?.nextCategoryIndex ?: 0,- acceptedRowCount = acceptedRowCount ?: existing?.acceptedRowCount ?: 0,- stagedFlushCount = stagedFlushCount ?: existing?.stagedFlushCount ?: 0,- syncProfileTier = runtimeProfile?.tier?.name ?: existing?.syncProfileTier,- syncProfileBatchSize = runtimeProfile?.stageBatchSize ?: existing?.syncProfileBatchSize ?: 0,- syncProfileStrategy = syncProfileStrategy ?: existing?.syncProfileStrategy,- syncProfileLowMemory = runtimeProfile?.snapshot?.isCurrentlyLowOnMemory ?: existing?.syncProfileLowMemory ?: false,- syncProfileMemoryClassMb = runtimeProfile?.snapshot?.memoryClassMb ?: existing?.syncProfileMemoryClassMb ?: 0,- syncProfileAvailableMemMb = runtimeProfile?.snapshot?.availableMemMb ?: existing?.syncProfileAvailableMemMb ?: 0L,- lastError = when {- clearError -> null- lastError != null -> lastError- else -> existing?.lastError- },- createdAt = existing?.createdAt?.takeIf { it > 0L } ?: now,- updatedAt = now,- completedAt = completedAt+ syncCatalogStore.withLiveCatalogFence(provider.id) {+ val existing = xtreamLiveOnboardingDao.getByProvider(provider.id)+ xtreamLiveOnboardingDao.upsert(+ XtreamLiveOnboardingStateEntity(+ providerId = provider.id,+ providerType = provider.type.name,+ contentType = ContentType.LIVE.name,+ phase = phase,+ stagedSessionId = if (clearStagedSession) null else stagedSessionId ?: existing?.stagedSessionId,+ importStrategy = importStrategy ?: existing?.importStrategy,+ nextCategoryIndex = nextCategoryIndex ?: existing?.nextCategoryIndex ?: 0,+ acceptedRowCount = acceptedRowCount ?: existing?.acceptedRowCount ?: 0,+ stagedFlushCount = stagedFlushCount ?: existing?.stagedFlushCount ?: 0,+ sealedSessionId = if (clearStagedSession) null else sealedSessionId ?: existing?.sealedSessionId,+ sealedRowCount = if (clearStagedSession) 0 else if (sealedSessionId != null) sealedRowCount else existing?.sealedRowCount ?: 0,+ sealedConfigurationGeneration = if (clearStagedSession) null else if (sealedSessionId != null) sealedConfigurationGeneration else existing?.sealedConfigurationGeneration,+ sealedMappingProfile = if (clearStagedSession) null else if (sealedSessionId != null) sealedMappingProfile else existing?.sealedMappingProfile,+ syncProfileTier = runtimeProfile?.tier?.name ?: existing?.syncProfileTier,+ syncProfileBatchSize = runtimeProfile?.stageBatchSize ?: existing?.syncProfileBatchSize ?: 0,+ syncProfileStrategy = syncProfileStrategy ?: existing?.syncProfileStrategy,+ syncProfileLowMemory = runtimeProfile?.snapshot?.isCurrentlyLowOnMemory ?: existing?.syncProfileLowMemory ?: false,+ syncProfileMemoryClassMb = runtimeProfile?.snapshot?.memoryClassMb ?: existing?.syncProfileMemoryClassMb ?: 0,+ syncProfileAvailableMemMb = runtimeProfile?.snapshot?.availableMemMb ?: existing?.syncProfileAvailableMemMb ?: 0L,+ lastError = when {+ clearError -> null+ lastError != null -> lastError+ else -> existing?.lastError+ },+ createdAt = existing?.createdAt?.takeIf { it > 0L } ?: now,+ updatedAt = now,+ completedAt = completedAt+ ))- )+ }}private suspend fun finalizeLiveCatalog(diff --git a/data/src/test/java/com/streamvault/data/local/StreamVaultDatabaseMigrationRegistryTest.kt b/data/src/test/java/com/streamvault/data/local/StreamVaultDatabaseMigrationRegistryTest.ktindex b799d36a..0f6f6381 100644--- a/data/src/test/java/com/streamvault/data/local/StreamVaultDatabaseMigrationRegistryTest.kt+++ b/data/src/test/java/com/streamvault/data/local/StreamVaultDatabaseMigrationRegistryTest.kt@@ -27,5 +27,6 @@ class StreamVaultDatabaseMigrationRegistryTest {assertThat(StreamVaultDatabaseMigrationRegistry.v75To76.single().endVersion).isEqualTo(76)assertThat(StreamVaultDatabaseMigrationRegistry.v76To77.single().endVersion).isEqualTo(77)assertThat(StreamVaultDatabaseMigrationRegistry.v77To78.single().endVersion).isEqualTo(78)+ assertThat(StreamVaultDatabaseMigrationRegistry.v78To79.single().endVersion).isEqualTo(79)}}diff --git a/data/src/test/java/com/streamvault/data/remote/xtream/OkHttpXtreamApiServiceTest.kt b/data/src/test/java/com/streamvault/data/remote/xtream/OkHttpXtreamApiServiceTest.ktindex fd4dd62c..2870b093 100644--- a/data/src/test/java/com/streamvault/data/remote/xtream/OkHttpXtreamApiServiceTest.kt+++ b/data/src/test/java/com/streamvault/data/remote/xtream/OkHttpXtreamApiServiceTest.kt@@ -5,6 +5,7 @@ import com.streamvault.data.remote.NetworkTimeoutConfigimport com.streamvault.data.remote.http.HttpRequestProfileimport com.streamvault.data.remote.dto.XtreamSeriesInfoResponseimport java.io.IOException+import java.io.InputStreamimport java.net.SocketTimeoutExceptionimport java.util.concurrent.CountDownLatchimport java.util.concurrent.TimeUnit@@ -16,6 +17,7 @@ import kotlinx.coroutines.cancelimport kotlinx.coroutines.cancelAndJoinimport kotlinx.coroutines.launchimport kotlinx.coroutines.withContext+import kotlinx.coroutines.withTimeoutimport kotlinx.coroutines.test.runTestimport kotlinx.serialization.json.Jsonimport okhttp3.Interceptor@@ -25,6 +27,9 @@ import okhttp3.Protocolimport okhttp3.Requestimport okhttp3.Responseimport okhttp3.ResponseBody.Companion.toResponseBody+import okhttp3.ResponseBody+import okio.buffer+import okio.sourceimport org.junit.Testclass OkHttpXtreamApiServiceTest {@@ -177,6 +182,53 @@ class OkHttpXtreamApiServiceTest {}}+ @Test+ fun `stream rejects trailing documents after emitting valid rows`() = runTest {+ val service = OkHttpXtreamApiService(clientReturning(200,+ """[{"stream_id":101,"name":"One"}] [{"stream_id":102,"name":"Two"}]"""), json)+ val seen = mutableListOf<Long>()+ val failure = runCatching {+ service.streamLiveStreamRows("https://example.test/player_api.php?action=get_live_streams") { seen += it.streamId }+ }.exceptionOrNull()+ assertThat(failure).isInstanceOf(XtreamParsingException::class.java)+ assertThat(seen).containsExactly(101L)+ }++ @Test+ fun `cancellation interrupts body reads after response headers have arrived`() = runTest {+ val bodyStarted = CountDownLatch(1)+ val cancellationObserved = CountDownLatch(1)+ val client = OkHttpClient.Builder().addInterceptor { chain ->+ val source = object : InputStream() {+ override fun read(): Int {+ bodyStarted.countDown()+ while (!chain.call().isCanceled()) Thread.sleep(10)+ cancellationObserved.countDown()+ throw IOException("Canceled body read")+ }+ }.source().buffer()+ Response.Builder().request(chain.request()).protocol(Protocol.HTTP_1_1).code(200).message("OK")+ .body(object : ResponseBody() {+ override fun contentType() = "application/json".toMediaType()+ override fun contentLength() = -1L+ override fun source() = source+ }).build()+ }.build()+ val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)+ try {+ val job = scope.launch {+ OkHttpXtreamApiService(client, json).streamLiveStreamRows(+ "https://example.test/player_api.php?action=get_live_streams") { }+ }+ assertThat(bodyStarted.await(5, TimeUnit.SECONDS)).isTrue()+ withContext(Dispatchers.Default) { withTimeout(5_000) { job.cancelAndJoin() } }+ assertThat(job.isCancelled).isTrue()+ assertThat(cancellationObserved.await(5, TimeUnit.SECONDS)).isTrue()+ } finally {+ scope.cancel()+ }+ }+@Testfun `segmented live requests use segmented timeout profile`() = runTest {val seenReadTimeoutMs = AtomicInteger(-1)diff --git a/data/src/test/java/com/streamvault/data/sync/ProviderWorkflowCommitFenceTest.kt b/data/src/test/java/com/streamvault/data/sync/ProviderWorkflowCommitFenceTest.ktindex dff6336f..864d555c 100644--- a/data/src/test/java/com/streamvault/data/sync/ProviderWorkflowCommitFenceTest.kt+++ b/data/src/test/java/com/streamvault/data/sync/ProviderWorkflowCommitFenceTest.kt@@ -77,6 +77,22 @@ class ProviderWorkflowCommitFenceTest {assertThat(retained.single().streamUrl).isEqualTo("old")}+ @Test+ fun `superseded cleanup cannot erase a newer staged snapshot`() = runTest {+ insertProvider()+ val dao = database.providerWorkflowDao()+ val ticket = dao.request(PROVIDER_ID, ProviderWorkflowPhase.PRIMARY_CATALOG, ProviderWorkflowReason.PERIODIC, now = 100L)+ val oldLease = checkNotNull(dao.claim(ticket, "old-owner", 101L, 1_000L, staleHeartbeatBefore = 0L))+ dao.request(PROVIDER_ID, ProviderWorkflowPhase.PREPARE, ProviderWorkflowReason.CONFIG_CHANGE,+ now = 200L, supersede = true, force = true)+ store().stageChannelBatch(PROVIDER_ID, 222L, listOf(channel("New snapshot", "fresh")))+ val failure = runCatching {+ withContext(ProviderWorkflowExecutionContext(oldLease)) { store().clearProviderStaging(PROVIDER_ID) }+ }.exceptionOrNull()+ assertThat(failure).isInstanceOf(ProviderWorkflowSupersededException::class.java)+ assertThat(database.catalogSyncDao().countChannelStages(PROVIDER_ID, 222L)).isEqualTo(1)+ }+@Testfun `current generation applies catalog inside fenced transaction`() = runTest {insertProvider()diff --git a/data/src/test/java/com/streamvault/data/sync/ProviderWorkflowRunnerTest.kt b/data/src/test/java/com/streamvault/data/sync/ProviderWorkflowRunnerTest.ktindex 9f2f8498..ea59724a 100644--- a/data/src/test/java/com/streamvault/data/sync/ProviderWorkflowRunnerTest.kt+++ b/data/src/test/java/com/streamvault/data/sync/ProviderWorkflowRunnerTest.kt@@ -133,6 +133,22 @@ class ProviderWorkflowRunnerTest {assertThat(workflow.state).isEqualTo(ProviderWorkflowState.PENDING)}+ @Test+ fun `superseded commit fence exits without publishing a retry or failure`() = runTest {+ insertProvider()+ val dao = database.providerWorkflowDao()+ val disposition = runner.execute(PROVIDER_ID, ProviderWorkflowPhase.PRIMARY_CATALOG, ProviderWorkflowReason.PERIODIC) {+ dao.request(providerId = PROVIDER_ID, phase = ProviderWorkflowPhase.PREPARE,+ reason = ProviderWorkflowReason.CONFIG_CHANGE, now = System.currentTimeMillis(), supersede = true, force = true)+ throw ProviderWorkflowSupersededException(PROVIDER_ID, 1)+ }+ assertThat(disposition).isEqualTo(ProviderWorkflowDisposition.SUPERSEDED)+ val workflow = dao.getWorkflow(PROVIDER_ID)!!+ assertThat(workflow.generation).isEqualTo(2L)+ assertThat(workflow.state).isEqualTo(ProviderWorkflowState.PENDING)+ assertThat(workflow.lastErrorCode).isNull()+ }+@Testfun `overlapping execution is told to retry while current owner retains lease`() = runTest {insertProvider()diff --git a/data/src/test/java/com/streamvault/data/sync/SyncManagerTest.kt b/data/src/test/java/com/streamvault/data/sync/SyncManagerTest.ktindex 9b791338..bfa05782 100644--- a/data/src/test/java/com/streamvault/data/sync/SyncManagerTest.kt+++ b/data/src/test/java/com/streamvault/data/sync/SyncManagerTest.kt@@ -358,7 +358,30 @@ class SyncManagerTest {org.mockito.kotlin.whenever(catalogSyncDao.getChannelStages(any(), any())).thenReturn(emptyList())org.mockito.kotlin.whenever(catalogSyncDao.getMovieStages(any(), any())).thenReturn(emptyList())org.mockito.kotlin.whenever(catalogSyncDao.getSeriesStages(any(), any())).thenReturn(emptyList())- org.mockito.kotlin.whenever(catalogSyncDao.countChannelStages(any(), any())).thenReturn(0)+ val liveStages = java.util.concurrent.ConcurrentHashMap<Pair<Long, Long>, java.util.concurrent.ConcurrentHashMap<Long, com.streamvault.data.local.entity.ChannelImportStageEntity>>()+ org.mockito.kotlin.whenever(catalogSyncDao.insertChannelStages(any())).thenAnswer { invocation ->+ invocation.getArgument<List<com.streamvault.data.local.entity.ChannelImportStageEntity>>(0).forEach { row ->+ liveStages.computeIfAbsent(row.providerId to row.sessionId) { java.util.concurrent.ConcurrentHashMap() }[row.streamId] = row+ }+ Unit+ }+ org.mockito.kotlin.whenever(catalogSyncDao.countChannelStages(any(), any())).thenAnswer { invocation ->+ liveStages[invocation.getArgument<Long>(0) to invocation.getArgument<Long>(1)]?.size ?: 0+ }+ org.mockito.kotlin.whenever(catalogSyncDao.moveCompletedChannelStages(any(), any(), any())).thenAnswer { invocation ->+ val provider = invocation.getArgument<Long>(0)+ val source = liveStages[provider to invocation.getArgument<Long>(1)]+ val target = liveStages.computeIfAbsent(provider to invocation.getArgument<Long>(2)) { java.util.concurrent.ConcurrentHashMap() }+ source?.values?.count { target.putIfAbsent(it.streamId, it) == null } ?: 0+ }+ org.mockito.kotlin.whenever(catalogSyncDao.clearChannelStages(any(), any())).thenAnswer { invocation ->+ liveStages.remove(invocation.getArgument<Long>(0) to invocation.getArgument<Long>(1))+ Unit+ }+ org.mockito.kotlin.whenever(catalogSyncDao.clearProviderChannelStages(any())).thenAnswer { invocation ->+ liveStages.keys.removeIf { it.first == invocation.getArgument<Long>(0) }+ Unit+ }org.mockito.kotlin.whenever(catalogSyncDao.countMovieStages(any(), any())).thenReturn(0)org.mockito.kotlin.whenever(catalogSyncDao.countSeriesStages(any(), any())).thenReturn(0)org.mockito.kotlin.whenever(catalogSyncDao.countCategoryStages(any(), any(), any())).thenReturn(0)@@ -812,6 +835,10 @@ class SyncManagerTest {phase = "STAGED",stagedSessionId = 123L,importStrategy = "full",+ sealedSessionId = 123L,+ sealedRowCount = 1,+ sealedConfigurationGeneration = 0L,+ sealedMappingProfile = "text=false;base64=false",acceptedRowCount = 1,stagedFlushCount = 1)@@ -865,6 +892,48 @@ class SyncManagerTest {verify(catalogSyncDao).clearChannelStages(1L, 456L)}+ @Test+ fun `unsealed nonempty onboarding rows are discarded instead of promoted`() = runTest {+ assertUnrecoverableLiveSnapshot(savedLiveSnapshot().copy(sealedSessionId = null))+ }++ @Test+ fun `onboarding receipt from another configuration is discarded`() = runTest {+ assertUnrecoverableLiveSnapshot(savedLiveSnapshot().copy(sealedConfigurationGeneration = 9L))+ }++ @Test+ fun `onboarding receipt from another mapping profile is discarded`() = runTest {+ assertUnrecoverableLiveSnapshot(savedLiveSnapshot().copy(sealedMappingProfile = "text=true;base64=false"))+ }++ @Test+ fun `onboarding receipt with missing staged rows is discarded`() = runTest {+ assertUnrecoverableLiveSnapshot(savedLiveSnapshot().copy(sealedRowCount = 2, acceptedRowCount = 2))+ }++ @Test+ fun `category onboarding snapshot without durable coverage is fetched again`() = runTest {+ assertUnrecoverableLiveSnapshot(savedLiveSnapshot().copy(importStrategy = "category_bulk"))+ }++ private fun savedLiveSnapshot() = XtreamLiveOnboardingStateEntity(providerId = 1L, phase = "STAGED",+ stagedSessionId = 456L, importStrategy = "full", acceptedRowCount = 1, sealedSessionId = 456L,+ sealedRowCount = 1, sealedConfigurationGeneration = 0L, sealedMappingProfile = "text=false;base64=false")++ private suspend fun assertUnrecoverableLiveSnapshot(state: XtreamLiveOnboardingStateEntity) {+ val mgr = buildManager(providerType = ProviderType.XTREAM_CODES)+ stubXtreamLiveCatalog()+ stubXtreamEmptyVodAndSeriesCategories()+ org.mockito.kotlin.whenever(xtreamLiveOnboardingDao.getIncompleteByProvider(1L)).thenReturn(state)+ org.mockito.kotlin.whenever(catalogSyncDao.countChannelStages(1L, 456L)).thenReturn(1)+ val result = mgr.sync(1L, force = false, trackInitialLiveOnboarding = true)+ assertThat(result.isSuccess).isTrue()+ assertThat(xtreamBackend.requestedActions).contains("get_live_streams")+ verify(catalogSyncDao).clearChannelStages(1L, 456L)+ verify(catalogSyncDao, org.mockito.kotlin.never()).deleteStaleChannelsForStage(1L, 456L)+ }+@Testfun `syncEpg_xtream_success_marks_epg_job_success`() = runTest {val mgr = buildManager(providerType = ProviderType.XTREAM_CODES)diff --git a/data/src/test/java/com/streamvault/data/sync/SyncManagerXtreamLiveStrategyTest.kt b/data/src/test/java/com/streamvault/data/sync/SyncManagerXtreamLiveStrategyTest.ktindex c11e5d4b..96c23c15 100644--- a/data/src/test/java/com/streamvault/data/sync/SyncManagerXtreamLiveStrategyTest.kt+++ b/data/src/test/java/com/streamvault/data/sync/SyncManagerXtreamLiveStrategyTest.kt@@ -37,6 +37,8 @@ import okhttp3.Responseimport okhttp3.ResponseBody.Companion.toResponseBodyimport org.junit.Testimport org.mockito.kotlin.mock+import org.mockito.kotlin.any+import org.mockito.kotlin.wheneverclass SyncManagerXtreamLiveStrategyTest {@@ -120,7 +122,7 @@ class SyncManagerXtreamLiveStrategyTest {val payload = strategy.loadXtreamLiveFull(provider, xtreamProvider, testRuntimeProfile(batchSize = 2))assertThat(payload.catalogResult).isInstanceOf(CatalogStrategyResult.Success::class.java)- assertThat(payload.stagedSessionId).isEqualTo(9001L)+ assertThat(payload.stagedSessionId).isNotNull()assertThat(payload.stagedAcceptedCount).isEqualTo(1)assertThat(stagedChannels.map { it.streamId }).containsExactly(777L)assertThat(stagedChannels.single().streamUrl).isEqualTo("xtream://42/live/777?ext=m3u8")@@ -294,7 +296,7 @@ class SyncManagerXtreamLiveStrategyTest {val result = payload.catalogResult as CatalogStrategyResult.SuccessassertThat(result.strategyName).isEqualTo("category_bulk")assertThat(result.items).isEmpty()- assertThat(payload.stagedSessionId).isEqualTo(1L)+ assertThat(payload.stagedSessionId).isNotNull()assertThat(payload.stagedAcceptedCount).isEqualTo(1)assertThat(payload.strategyFeedback.attemptedFullCatalog).isFalse()assertThat(payload.strategyFeedback.preferredSegmentedFirst).isTrue()@@ -385,7 +387,7 @@ class SyncManagerXtreamLiveStrategyTest {val result = payload.catalogResult as CatalogStrategyResult.SuccessassertThat(result.strategyName).isEqualTo("category_bulk")assertThat(result.items).isEmpty()- assertThat(payload.stagedSessionId).isEqualTo(1L)+ assertThat(payload.stagedSessionId).isNotNull()assertThat(payload.stagedAcceptedCount).isEqualTo(1)assertThat(payload.strategyFeedback.attemptedFullCatalog).isTrue()assertThat(payload.strategyFeedback.fullCatalogUnsafe).isTrue()@@ -508,7 +510,7 @@ class SyncManagerXtreamLiveStrategyTest {val result = payload.catalogResult as CatalogStrategyResult.SuccessassertThat(result.strategyName).isEqualTo("category_bulk")assertThat(result.items).isEmpty()- assertThat(payload.stagedSessionId).isEqualTo(1L)+ assertThat(payload.stagedSessionId).isNotNull()assertThat(payload.stagedAcceptedCount).isEqualTo(1)assertThat(payload.strategyFeedback.attemptedFullCatalog).isTrue()assertThat(payload.strategyFeedback.fullCatalogUnsafe).isTrue()@@ -619,7 +621,7 @@ class SyncManagerXtreamLiveStrategyTest {val result = payload.catalogResult as CatalogStrategyResult.SuccessassertThat(result.items).isEmpty()- assertThat(payload.stagedSessionId).isEqualTo(77L)+ assertThat(payload.stagedSessionId).isNotNull()assertThat(payload.stagedAcceptedCount).isEqualTo(3)assertThat(stageCalls).containsExactly(listOf(1001L, 1002L), listOf(1003L)).inOrder()}@@ -1019,6 +1021,22 @@ class SyncManagerXtreamLiveStrategyTest {seriesRequestTimeoutMillis = 60_000L,recoveryAbortWarningSuffix = "stopped early.")+ val dao = mock<CatalogSyncDao>()+ val stagedIds = java.util.concurrent.ConcurrentHashMap<Long, MutableSet<Long>>()+ runBlocking {+ whenever(dao.countChannelStages(any(), any())).thenAnswer { invocation ->+ stagedIds[invocation.getArgument<Long>(1)]?.size ?: 0+ }+ whenever(dao.moveCompletedChannelStages(any(), any(), any())).thenAnswer { invocation ->+ val source = stagedIds[invocation.getArgument<Long>(1)].orEmpty()+ val target = stagedIds.computeIfAbsent(invocation.getArgument<Long>(2)) { java.util.concurrent.ConcurrentHashMap.newKeySet() }+ source.count { target.add(it) }+ }+ whenever(dao.clearChannelStages(any(), any())).thenAnswer { invocation ->+ stagedIds.remove(invocation.getArgument<Long>(1))+ Unit+ }+ }return SyncManagerXtreamLiveStrategy(xtreamCatalogApiService = apiService,xtreamCatalogHttpService = httpService,@@ -1034,7 +1052,7 @@ class SyncManagerXtreamLiveStrategyTest {movieDao = mock<MovieDao>(),seriesDao = mock<SeriesDao>(),categoryDao = mock<CategoryDao>(),- catalogSyncDao = mock<CatalogSyncDao>(),+ catalogSyncDao = dao,tmdbIdentityDao = mock<TmdbIdentityDao>(),transactionRunner = object : DatabaseTransactionRunner {override suspend fun <T> inTransaction(block: suspend () -> T): T = block()@@ -1046,7 +1064,14 @@ class SyncManagerXtreamLiveStrategyTest {categoryFailureWarning = { section, category, error -> "$section category $category failed: ${sanitize(error)}" },liveCategorySequentialModeWarning = "Live category sync used sequential mode.",isCurrentlyLowOnMemory = isCurrentlyLowOnMemory,- stageChannelItems = stageChannelItems,+ stageChannelItems = { id, channels, seen, categories, session ->+ val actualSession = requireNotNull(session)+ val unique = channels.filter { seen.add(it.streamId) }+ val result = stageChannelItems(id, unique, seen, categories, actualSession)+ stagedIds.computeIfAbsent(actualSession) { java.util.concurrent.ConcurrentHashMap.newKeySet() }+ .addAll(unique.map { it.streamId })+ result.copy(sessionId = actualSession, acceptedCount = unique.size)+ },emitProgress = { _, _ -> })}diff --git a/data/src/test/java/com/streamvault/data/sync/XtreamLiveAttemptIsolationTest.kt b/data/src/test/java/com/streamvault/data/sync/XtreamLiveAttemptIsolationTest.ktnew file mode 100644index 00000000..5bd7fd52--- /dev/null+++ b/data/src/test/java/com/streamvault/data/sync/XtreamLiveAttemptIsolationTest.kt@@ -0,0 +1,215 @@+package com.streamvault.data.sync++import androidx.room.Room+import com.google.common.truth.Truth.assertThat+import com.streamvault.data.local.RoomDatabaseTransactionRunner+import com.streamvault.data.local.StreamVaultDatabase+import com.streamvault.data.local.entity.ProviderEntity+import com.streamvault.data.local.entity.ChannelEntity+import com.streamvault.data.local.entity.XtreamLiveOnboardingStateEntity+import com.streamvault.data.remote.dto.XtreamCategory+import com.streamvault.data.remote.xtream.OkHttpXtreamApiService+import com.streamvault.data.remote.xtream.XtreamProvider+import com.streamvault.domain.model.ContentType+import com.streamvault.domain.model.LegacyProvider+import com.streamvault.domain.model.ProviderType+import java.util.concurrent.atomic.AtomicInteger+import kotlinx.coroutines.CancellationException+import kotlinx.coroutines.runBlocking+import kotlinx.serialization.json.Json+import okhttp3.MediaType.Companion.toMediaType+import okhttp3.OkHttpClient+import okhttp3.Protocol+import okhttp3.Response+import okhttp3.ResponseBody.Companion.toResponseBody+import org.junit.After+import org.junit.Before+import org.junit.Test+import org.junit.runner.RunWith+import org.robolectric.RobolectricTestRunner+import org.robolectric.RuntimeEnvironment++@RunWith(RobolectricTestRunner::class)+class XtreamLiveAttemptIsolationTest {+ private lateinit var db: StreamVaultDatabase+ private lateinit var store: SyncCatalogStore+ private val provider = LegacyProvider(id = 1, name = "Synthetic", type = ProviderType.XTREAM_CODES,+ serverUrl = "https://fixture.invalid", username = "synthetic", password = "synthetic")++ @Before+ fun setUp() = runBlocking<Unit> {+ db = Room.inMemoryDatabaseBuilder(RuntimeEnvironment.getApplication(), StreamVaultDatabase::class.java)+ .allowMainThreadQueries().build()+ db.providerDao().insert(ProviderEntity(id = provider.id, name = provider.name, type = provider.type))+ store = SyncCatalogStore(db.channelDao(), db.movieDao(), db.seriesDao(), db.categoryDao(),+ db.catalogSyncDao(), db.tmdbIdentityDao(), RoomDatabaseTransactionRunner(db))+ }++ @After+ fun close() {+ db.close()+ RuntimeEnvironment.getApplication().deleteDatabase("xtream-receipt-reopen-test")+ }++ @Test+ fun `full retry replaces failed rows and resets duplicate admission`() = runBlocking<Unit> {+ val requests = AtomicInteger()+ val (strategy, api) = engine { _ ->+ if (requests.incrementAndGet() == 1) array(row(101), row(102)).dropLast(1) + ","+ else array(row(102, "fresh"), row(103))+ }+ val result = strategy.loadXtreamLiveFull(provider, api, profile())+ assertThat(result.catalogResult).isInstanceOf(CatalogStrategyResult.Success::class.java)+ assertThat(requests.get()).isEqualTo(2)+ assertThat(result.stagedAcceptedCount).isEqualTo(2)+ val rows = db.catalogSyncDao().getChannelStages(provider.id, requireNotNull(result.stagedSessionId))+ assertThat(rows.map { it.streamId }).containsExactly(102L, 103L)+ assertThat(rows.single { it.streamId == 102L }.name).startsWith("fresh")+ assertThat(totalStages()).isEqualTo(2)+ }++ @Test+ fun `failed category decoder attempt cannot overwrite successful category or retain partial rows`() = runBlocking<Unit> {+ val attempts = AtomicInteger()+ val (strategy, api) = engine { category ->+ when {+ category == "1" -> array(row(101, "completed", category = 1))+ attempts.incrementAndGet() == 1 -> array(row(101, "failed", 2), row(202, category = 2)).dropLast(1) + ","+ else -> array(row(203, category = 2))+ }+ }+ val result = strategy.loadXtreamLiveByCategory(provider, api, categories(), null, true, profile())+ assertThat(result.catalogResult).isInstanceOf(CatalogStrategyResult.Success::class.java)+ assertThat(result.stagedAcceptedCount).isEqualTo(2)+ val rows = db.catalogSyncDao().getChannelStages(provider.id, requireNotNull(result.stagedSessionId))+ assertThat(rows.map { it.streamId }).containsExactly(101L, 203L)+ assertThat(rows.single { it.streamId == 101L }.name).startsWith("completed")+ assertThat(totalStages()).isEqualTo(2)+ }++ @Test+ fun `permanent category failure publishes only completed scopes as partial`() = runBlocking<Unit> {+ db.channelDao().insertAll(listOf(ChannelEntity(streamId = 900, name = "Existing", streamUrl = "old", providerId = provider.id)))+ val (strategy, api) = engine { category ->+ if (category == "1") array(row(101)) else array(row(202, category = 2)).dropLast(1) + ","+ }+ val result = strategy.loadXtreamLiveByCategory(provider, api, categories(), null, true, profile())+ assertThat(result.catalogResult).isInstanceOf(CatalogStrategyResult.Partial::class.java)+ assertThat(result.stagedAcceptedCount).isEqualTo(1)+ assertThat(db.catalogSyncDao().getChannelStages(provider.id, requireNotNull(result.stagedSessionId)).map { it.streamId })+ .containsExactly(101L)+ assertThat(totalStages()).isEqualTo(1)+ store.applyStagedLiveCatalogUpsertOnly(provider.id, requireNotNull(result.stagedSessionId), result.categories)+ assertThat(db.channelDao().getByProviderSync(provider.id).map { it.streamId }).containsExactly(900L, 101L)+ }++ @Test+ fun `superseded full writer stops without retries or legacy download`() = runBlocking<Unit> {+ val requests = AtomicInteger()+ val (strategy, api) = engine(failWriter = true) { requests.incrementAndGet(); array(row(101), row(102)) }+ var failure: Throwable? = null+ try { strategy.loadXtreamLiveFull(provider, api, profile()) } catch (error: CancellationException) { failure = error }+ assertThat(failure).isInstanceOf(ProviderWorkflowSupersededException::class.java)+ assertThat(requests.get()).isEqualTo(1)+ assertThat(totalStages()).isEqualTo(0)+ }++ @Test+ fun `category supersession discards completed scopes and stops further requests`() = runBlocking<Unit> {+ val requests = AtomicInteger()+ val (strategy, api) = engine(failOnStreamId = 202L) { category ->+ requests.incrementAndGet()+ if (category == "1") array(row(101)) else array(row(202, category = 2))+ }+ val failure = runCatching {+ strategy.loadXtreamLiveByCategory(provider, api, categories(), null, true, profile())+ }.exceptionOrNull()+ assertThat(failure).isInstanceOf(ProviderWorkflowSupersededException::class.java)+ assertThat(requests.get()).isEqualTo(2)+ assertThat(totalStages()).isEqualTo(0)+ }++ @Test+ fun `sealed snapshot and metadata survive closing the database before promotion`() = runBlocking<Unit> {+ val context = RuntimeEnvironment.getApplication()+ val name = "xtream-receipt-reopen-test"+ db.close()+ context.deleteDatabase(name)+ fun open() = Room.databaseBuilder(context, StreamVaultDatabase::class.java, name).allowMainThreadQueries().build()+ fun catalogStore() = SyncCatalogStore(db.channelDao(), db.movieDao(), db.seriesDao(), db.categoryDao(),+ db.catalogSyncDao(), db.tmdbIdentityDao(), RoomDatabaseTransactionRunner(db))+ db = open()+ db.providerDao().insert(ProviderEntity(id = provider.id, name = provider.name, type = provider.type))+ store = catalogStore()+ val (strategy, api) = engine { array(row(101), row(102)) }+ val result = strategy.loadXtreamLiveFull(provider, api, profile())+ val session = requireNotNull(result.stagedSessionId)+ val receipt = XtreamLiveOnboardingStateEntity(providerId = provider.id, phase = "STAGED", stagedSessionId = session,+ importStrategy = "full", acceptedRowCount = 2, sealedSessionId = session, sealedRowCount = 2,+ sealedConfigurationGeneration = 1, sealedMappingProfile = "text=false;base64=false")+ store.sealCompletedLiveImport(provider.id, session, 2, result.categories) { db.xtreamLiveOnboardingDao().upsert(receipt) }+ db.close()+ db = open()+ store = catalogStore()+ assertThat(db.xtreamLiveOnboardingDao().getIncompleteByProvider(provider.id)).isEqualTo(receipt)+ val saved = store.stagedLiveImportState(provider.id, session)+ assertThat(saved.channelCount).isEqualTo(2)+ assertThat(saved.categories).isNotEmpty()+ store.applyStagedLiveCatalog(provider.id, session, saved.categories)+ assertThat(db.channelDao().getByProviderSync(provider.id).map { it.streamId }).containsExactly(101L, 102L)+ assertThat(totalStages()).isEqualTo(0)+ }++ @Test+ fun `snapshot receipt and category metadata are committed together only for matching row count`() = runBlocking<Unit> {+ val (strategy, api) = engine { array(row(101), row(102)) }+ val result = strategy.loadXtreamLiveFull(provider, api, profile())+ val session = requireNotNull(result.stagedSessionId)+ val receipt = XtreamLiveOnboardingStateEntity(providerId = provider.id, phase = "STAGED", stagedSessionId = session,+ importStrategy = "full", acceptedRowCount = 2, sealedSessionId = session, sealedRowCount = 2,+ sealedConfigurationGeneration = 1, sealedMappingProfile = "text=false;base64=false")+ var rejected = false+ try {+ store.sealCompletedLiveImport(provider.id, session, 3, result.categories) { db.xtreamLiveOnboardingDao().upsert(receipt) }+ } catch (_: IllegalStateException) { rejected = true }+ assertThat(rejected).isTrue()+ assertThat(db.xtreamLiveOnboardingDao().getByProvider(provider.id)).isNull()+ store.sealCompletedLiveImport(provider.id, session, 2, result.categories) { db.xtreamLiveOnboardingDao().upsert(receipt) }+ assertThat(db.xtreamLiveOnboardingDao().getByProvider(provider.id)).isEqualTo(receipt)+ assertThat(db.catalogSyncDao().getCategoryStages(provider.id, session, "LIVE")).isNotEmpty()+ }++ private suspend fun totalStages(): Int = db.openHelper.readableDatabase.query("SELECT COUNT(*) FROM channel_import_stage").use {+ it.moveToFirst(); it.getInt(0)+ }++ private fun row(id: Long, name: String = "Channel", category: Int = 1): String =+ """{"stream_id":$id,"name":"$name ${"x".repeat(600)}","category_id":"$category","container_extension":"m3u8"}"""++ private fun array(vararg rows: String) = rows.joinToString(",", "[", "]")+ private fun categories() = listOf(XtreamCategory("1", "One"), XtreamCategory("2", "Two"))++ private suspend fun engine(failWriter: Boolean = false, failOnStreamId: Long? = null,+ response: (String?) -> String): Pair<SyncManagerXtreamLiveStrategy, XtreamProvider> {+ val http = OkHttpXtreamApiService(OkHttpClient.Builder().addInterceptor { chain ->+ Response.Builder().request(chain.request()).protocol(Protocol.HTTP_1_1).code(200).message("OK")+ .body(response(chain.request().url.queryParameter("category_id")).toResponseBody("application/json".toMediaType())).build()+ }.build(), Json { ignoreUnknownKeys = true; isLenient = true; explicitNulls = false; coerceInputValues = true })+ val api = XtreamProvider(provider.id, http, provider.serverUrl, provider.username, provider.password)+ api.mapCategories(ContentType.LIVE, categories())+ val policy = XtreamAdaptiveSyncPolicy()+ val progress: (Long, ((String) -> Unit)?, String) -> Unit = { _, callback, label -> callback?.invoke(label) }+ val sanitize: (Throwable?) -> String = { it?.javaClass?.simpleName.orEmpty() }+ val support = SyncManagerXtreamSupport(policy, { false }, sanitize, progress, 60_000, 60_000, "stopped")+ val stager = SyncManagerCatalogStager(store, 1)+ return SyncManagerXtreamLiveStrategy(http, http, policy, support, SyncManagerXtreamFetcher(http, http, support, sanitize),+ SyncManagerCatalogStrategySupport({ false }, 60_000), store, progress, sanitize,+ { _, _ -> "full failed" }, { _, _, _ -> "category failed" }, "sequential", stageChannelItems = { id, channels, seen, collector, session ->+ if (failWriter || channels.any { it.streamId == failOnStreamId }) throw ProviderWorkflowSupersededException(id, 1)+ stager.stageChannelItems(id, channels, seen, collector, session)+ }, emitProgress = { _, _ -> }) to api+ }++ private fun profile() = CatalogSyncRuntimeProfile(DeviceSyncTier.HIGH, 1, 1, false, false,+ SyncDeviceSnapshot(512, 512, false, false, 1024, 512, true, "fixture", "fixture", 35))+}diff --git a/docs/XTREAM_SYNC_IMPROVEMENT_PLAN.md b/docs/XTREAM_SYNC_IMPROVEMENT_PLAN.mdindex 99b1a0b6..913dcd53 100644--- a/docs/XTREAM_SYNC_IMPROVEMENT_PLAN.md+++ b/docs/XTREAM_SYNC_IMPROVEMENT_PLAN.md@@ -1,12 +1,14 @@# Xtream sync improvement plan-Status: proposed implementation plan; implementation has not started.+Status: implementation in progress on `codex/xtream-live-sync-performance`.Prepared 2026-10-09 against source revision `540ec30c`.Supporting evidence:- [Initial live import comparison](XTREAM_LIVE_IMPORT_COMPARISON.md)- [Current sync engine review](XTREAM_SYNC_PERFORMANCE_REVIEW.md)+- [Initial backend baseline](XTREAM_SYNC_INITIAL_BASELINE.md)+- [Attempt isolation and recovery implementation](XTREAM_SYNC_RECOVERY_IMPLEMENTATION.md)The reference implementation provides hypotheses to investigate, not a designauthority or proof of correctness. Choose behavior for this app's measureddiff --git a/docs/XTREAM_SYNC_RECOVERY_IMPLEMENTATION.md b/docs/XTREAM_SYNC_RECOVERY_IMPLEMENTATION.mdnew file mode 100644index 00000000..a5bfa66a--- /dev/null+++ b/docs/XTREAM_SYNC_RECOVERY_IMPLEMENTATION.md@@ -0,0 +1,93 @@+# Xtream live attempt isolation and recovery++Implemented on `codex/xtream-live-sync-performance`, 2026-10-09, after the+initial backend baseline. This package supplies the safety boundary needed+before overlapping retrieval and database writes. Production AUTO selection,+request concurrency and healthy-provider spacing retain their existing behavior.++## Attempt boundaries++Every full response attempt owns its session, duplicate set, pending raw batch,+category collector and accepted-row count. Failure or cancellation clears that+session before retrying. A duplicate admitted by a failed attempt can therefore+be admitted correctly by the successful retry.++Every category attempt uses its own staging session. Only a completed category+is merged into the combined import session. Failed thin decoding, legacy+decoding and transport retries discard their own rows first. SQL merging ignores+channels already present in the completed session, preserving the first+completed category's row. A failed category cannot reserve a duplicate or+overwrite a successful category. Partial results use the existing upsert-only+promotion, preserving channels absent from the completed scopes.++Superseded workflows are cancellation control flow. They stop retry/decoder+fallback and return the workflow's superseded disposition. Provider-wide stage+cleanup and onboarding state writes now check ownership inside their database+transactions. Scoped cancellation cleanup remains possible for the old attempt+without touching a newer session.++HTTP cancellation remains connected throughout response-body reading, including+after headers arrive. A response delivered during a cancellation race is closed.+Streamed arrays must reach their closing token and end of document; extra JSON+after an otherwise valid array cannot establish completion. Alternate decoding+is reserved for parsing/compatibility errors instead of arbitrary writer or+transport failures.++## Durable completion receipt++Schema 79 adds nullable sealed session, configuration generation and mapping+profile columns, plus a sealed row count defaulting to zero. The 78-to-79+migration preserves existing imports while giving them no completion proof.++After a complete full-catalog response, onboarding checks the exact staged row+count and atomically writes category metadata and the receipt. The receipt binds+the session to the authoritative provider configuration generation and the text+classification/base64 mapping flags. Configuration is rechecked inside the+sealing transaction. The receipt contains no credentials or request URLs.++Recovery requires a matching full-catalog receipt, current configuration and+mapping profile, exact accepted/staged row counts, no mixed catalog rows, and+an unrestricted category scope. Anything else is discarded and fetched again.+Normal promotion remains transactional and clears the receipt on completion.++Category snapshots deliberately refetch after interruption. Durable per-category+coverage and resume are still work for the subsequent scheduling package. Until+that exists, a nonempty category stage is never treated as a complete snapshot.+Hidden-category imports also refetch rather than reuse an unproven scope.++## Validation++Focused checks exercise real Room staging, retries after emitted rows,+cross-category duplicates, partial promotion preserving the active library,+supersession, atomic sealing and database close/reopen before promotion.+Orchestration checks cover unsealed rows, missing rows, configuration/mapping+mismatch, category snapshots and valid sealed recovery. HTTP tests cover blocked+body cancellation and trailing documents.++Results:++- 177 focused JVM/Robolectric tests passed, including catalog-store and shared+ workflow/Jellyfin checkpoint regression checks.+- Android migration tests passed for a populated schema-78 onboarding record+ and the complete migration path from every exported historical schema.+- Benchmark debug application and instrumentation APKs built successfully.+ They use `com.streamvault.app.syncbenchmark`, separate from the user's app.+- Synthetic Add Provider and Settings Live refresh passed in all three requested+ modes: six samples, 2,000 channels in each, successful sync states and provider+ cleanup. No event-history truncation; instrumentation exited successfully.+ Report: `build/xtream-sync-performance/20261009T173718237727Z/report.json`.+ This is one sample per phase/mode with no warmups, a correctness smoke check.+ The device continued to select category requests, so it is not a bulk speed+ comparison. The fixture supplies no playable media.++Reproduction:++```powershell+.\gradlew.bat :data:testDebugUnitTest --tests '*XtreamLiveAttemptIsolationTest' --tests '*SyncManagerXtreamLiveStrategyTest' --tests '*SyncManagerTest' --tests '*ProviderWorkflowRunnerTest' --tests '*ProviderWorkflowCommitFenceTest' --tests '*OkHttpXtreamApiServiceTest' --tests '*StreamVaultDatabaseMigrationRegistryTest' --tests '*SyncCatalogStoreTest' --tests '*JellyfinCatalogCheckpointTest'+.\gradlew.bat :data:connectedDebugAndroidTest '-Pandroid.testInstrumentationRunnerArguments.class=com.streamvault.data.local.StreamVaultDatabaseMigrationTest#migrate78To79_preservesSavedImportWithoutGrantingCompletionProof,com.streamvault.data.local.StreamVaultDatabaseMigrationTest#everyExportedHistoricalSchemaMigratesToCurrent'+.\gradlew.bat :app:assembleDebug :app:assembleDebugAndroidTest -PxtreamSyncBenchmark=true+python tools/xtream_sync_benchmark.py --channels 2000 --categories 10 --iterations 1 --warmups 0 --refresh+```++This package makes no speedup claim; parsing, pipelining,+database costs, category scheduling and the AUTO release gate remain ahead.