Implementation chapter · Coverage index
Each text entry includes the complete pinned file to write at the displayed path, plus an exact-byte download. Read the chapter for implementation order and behavior, then connect callers and reproduce the tests. Platform variants preserve their platform capabilities. Binary assets are retained with applicable licenses or independently recreated, not transcribed as code.
Pinned baseline for comparison. Use the reviewed listings in the implementation chapters and the reviewed source archive when reconstructing the app. See the architecture review for changes.
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/1.json
- Source · configuration / resource · 1120 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 befed534597537488ef4e8ad532449e512dfff5d500b1316a605b4df815f62c7.
Complete file
{
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "b807d33edb197fd76700c0d9b94c580b",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"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, 'b807d33edb197fd76700c0d9b94c580b')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/10.json
- Source · configuration / resource · 1384 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 1cd6cdbdf87a04f7b6ad6af0f3df7b0b5a4fb72d0294a231e43d823e6e108bcf.
Complete file
{
"formatVersion": 1,
"database": {
"version": 10,
"identityHash": "79b71b094ab0bc43e2c5d2a2b815bb2c",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubRecoveryPending` INTEGER NOT NULL DEFAULT 0, `hubBootstrapComplete` INTEGER NOT NULL DEFAULT 1, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, `serverProvider` TEXT NOT NULL DEFAULT 'YokanHub', `mangayomiIdMappings` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubRecoveryPending",
"columnName": "hubRecoveryPending",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubBootstrapComplete",
"columnName": "hubBootstrapComplete",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
},
{
"fieldPath": "serverProvider",
"columnName": "serverProvider",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "'YokanHub'"
},
{
"fieldPath": "mangayomiIdMappings",
"columnName": "mangayomiIdMappings",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, `fetchedAt` INTEGER, `sourceId` INTEGER, `sourceVersion` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
},
{
"fieldPath": "fetchedAt",
"columnName": "fetchedAt",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceVersion",
"columnName": "sourceVersion",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, `epoch` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "epoch",
"columnName": "epoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
},
{
"tableName": "recipe_catalog_checkpoint",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `generation` INTEGER NOT NULL, `replayRevision` INTEGER, `replayPayloadHash` BLOB, PRIMARY KEY(`catalogId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "generation",
"columnName": "generation",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "replayRevision",
"columnName": "replayRevision",
"affinity": "INTEGER"
},
{
"fieldPath": "replayPayloadHash",
"columnName": "replayPayloadHash",
"affinity": "BLOB"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId"
]
}
},
{
"tableName": "recipe_catalog_trust_key",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `keyId` TEXT NOT NULL, `rawEd25519PublicKey` BLOB NOT NULL, `state` TEXT NOT NULL, `validFromEpochSeconds` INTEGER, `validUntilEpochSeconds` INTEGER, PRIMARY KEY(`catalogId`, `keyId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "keyId",
"columnName": "keyId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "rawEd25519PublicKey",
"columnName": "rawEd25519PublicKey",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "state",
"columnName": "state",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "validFromEpochSeconds",
"columnName": "validFromEpochSeconds",
"affinity": "INTEGER"
},
{
"fieldPath": "validUntilEpochSeconds",
"columnName": "validUntilEpochSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"keyId"
]
}
},
{
"tableName": "recipe_catalog_installed",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `stableId` TEXT NOT NULL, `catalogRevision` INTEGER NOT NULL, `releaseVersion` TEXT NOT NULL, `sha256` TEXT NOT NULL, `sizeBytes` INTEGER NOT NULL, `artifactBytes` BLOB NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`catalogId`, `stableId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "stableId",
"columnName": "stableId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "catalogRevision",
"columnName": "catalogRevision",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "releaseVersion",
"columnName": "releaseVersion",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sha256",
"columnName": "sha256",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sizeBytes",
"columnName": "sizeBytes",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "artifactBytes",
"columnName": "artifactBytes",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"stableId"
]
}
}
],
"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, '79b71b094ab0bc43e2c5d2a2b815bb2c')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/11.json
- Source · configuration / resource · 1391 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 a56583bf51fd656bd192822ddd581b0125bdc19d4e35dd66b84b1404648f007e.
Complete file
{
"formatVersion": 1,
"database": {
"version": 11,
"identityHash": "1469f76eb2baba46cb22243819de934a",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, `privateNote` TEXT NOT NULL DEFAULT '', PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "privateNote",
"columnName": "privateNote",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "''"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubRecoveryPending` INTEGER NOT NULL DEFAULT 0, `hubBootstrapComplete` INTEGER NOT NULL DEFAULT 1, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, `serverProvider` TEXT NOT NULL DEFAULT 'YokanHub', `mangayomiIdMappings` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubRecoveryPending",
"columnName": "hubRecoveryPending",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubBootstrapComplete",
"columnName": "hubBootstrapComplete",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
},
{
"fieldPath": "serverProvider",
"columnName": "serverProvider",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "'YokanHub'"
},
{
"fieldPath": "mangayomiIdMappings",
"columnName": "mangayomiIdMappings",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, `fetchedAt` INTEGER, `sourceId` INTEGER, `sourceVersion` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
},
{
"fieldPath": "fetchedAt",
"columnName": "fetchedAt",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceVersion",
"columnName": "sourceVersion",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, `epoch` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "epoch",
"columnName": "epoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
},
{
"tableName": "recipe_catalog_checkpoint",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `generation` INTEGER NOT NULL, `replayRevision` INTEGER, `replayPayloadHash` BLOB, PRIMARY KEY(`catalogId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "generation",
"columnName": "generation",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "replayRevision",
"columnName": "replayRevision",
"affinity": "INTEGER"
},
{
"fieldPath": "replayPayloadHash",
"columnName": "replayPayloadHash",
"affinity": "BLOB"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId"
]
}
},
{
"tableName": "recipe_catalog_trust_key",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `keyId` TEXT NOT NULL, `rawEd25519PublicKey` BLOB NOT NULL, `state` TEXT NOT NULL, `validFromEpochSeconds` INTEGER, `validUntilEpochSeconds` INTEGER, PRIMARY KEY(`catalogId`, `keyId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "keyId",
"columnName": "keyId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "rawEd25519PublicKey",
"columnName": "rawEd25519PublicKey",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "state",
"columnName": "state",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "validFromEpochSeconds",
"columnName": "validFromEpochSeconds",
"affinity": "INTEGER"
},
{
"fieldPath": "validUntilEpochSeconds",
"columnName": "validUntilEpochSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"keyId"
]
}
},
{
"tableName": "recipe_catalog_installed",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `stableId` TEXT NOT NULL, `catalogRevision` INTEGER NOT NULL, `releaseVersion` TEXT NOT NULL, `sha256` TEXT NOT NULL, `sizeBytes` INTEGER NOT NULL, `artifactBytes` BLOB NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`catalogId`, `stableId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "stableId",
"columnName": "stableId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "catalogRevision",
"columnName": "catalogRevision",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "releaseVersion",
"columnName": "releaseVersion",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sha256",
"columnName": "sha256",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sizeBytes",
"columnName": "sizeBytes",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "artifactBytes",
"columnName": "artifactBytes",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"stableId"
]
}
}
],
"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, '1469f76eb2baba46cb22243819de934a')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/12.json
- Source · configuration / resource · 1408 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 56c7f82fcf92396953aafc64324c074f1d62b1f99ea64a12da1acd61088ac374.
Complete file
{
"formatVersion": 1,
"database": {
"version": 12,
"identityHash": "ce6f66c11d6f01baebac2362b14d9d0c",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, `privateNote` TEXT NOT NULL DEFAULT '', PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "privateNote",
"columnName": "privateNote",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "''"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, `isPaused` INTEGER NOT NULL DEFAULT 0, `storageLocation` TEXT, `requestJson` TEXT, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isPaused",
"columnName": "isPaused",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "storageLocation",
"columnName": "storageLocation",
"affinity": "TEXT"
},
{
"fieldPath": "requestJson",
"columnName": "requestJson",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubRecoveryPending` INTEGER NOT NULL DEFAULT 0, `hubBootstrapComplete` INTEGER NOT NULL DEFAULT 1, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, `serverProvider` TEXT NOT NULL DEFAULT 'YokanHub', `mangayomiIdMappings` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubRecoveryPending",
"columnName": "hubRecoveryPending",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubBootstrapComplete",
"columnName": "hubBootstrapComplete",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
},
{
"fieldPath": "serverProvider",
"columnName": "serverProvider",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "'YokanHub'"
},
{
"fieldPath": "mangayomiIdMappings",
"columnName": "mangayomiIdMappings",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, `fetchedAt` INTEGER, `sourceId` INTEGER, `sourceVersion` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
},
{
"fieldPath": "fetchedAt",
"columnName": "fetchedAt",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceVersion",
"columnName": "sourceVersion",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, `epoch` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "epoch",
"columnName": "epoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
},
{
"tableName": "recipe_catalog_checkpoint",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `generation` INTEGER NOT NULL, `replayRevision` INTEGER, `replayPayloadHash` BLOB, PRIMARY KEY(`catalogId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "generation",
"columnName": "generation",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "replayRevision",
"columnName": "replayRevision",
"affinity": "INTEGER"
},
{
"fieldPath": "replayPayloadHash",
"columnName": "replayPayloadHash",
"affinity": "BLOB"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId"
]
}
},
{
"tableName": "recipe_catalog_trust_key",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `keyId` TEXT NOT NULL, `rawEd25519PublicKey` BLOB NOT NULL, `state` TEXT NOT NULL, `validFromEpochSeconds` INTEGER, `validUntilEpochSeconds` INTEGER, PRIMARY KEY(`catalogId`, `keyId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "keyId",
"columnName": "keyId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "rawEd25519PublicKey",
"columnName": "rawEd25519PublicKey",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "state",
"columnName": "state",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "validFromEpochSeconds",
"columnName": "validFromEpochSeconds",
"affinity": "INTEGER"
},
{
"fieldPath": "validUntilEpochSeconds",
"columnName": "validUntilEpochSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"keyId"
]
}
},
{
"tableName": "recipe_catalog_installed",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `stableId` TEXT NOT NULL, `catalogRevision` INTEGER NOT NULL, `releaseVersion` TEXT NOT NULL, `sha256` TEXT NOT NULL, `sizeBytes` INTEGER NOT NULL, `artifactBytes` BLOB NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`catalogId`, `stableId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "stableId",
"columnName": "stableId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "catalogRevision",
"columnName": "catalogRevision",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "releaseVersion",
"columnName": "releaseVersion",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sha256",
"columnName": "sha256",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sizeBytes",
"columnName": "sizeBytes",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "artifactBytes",
"columnName": "artifactBytes",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"stableId"
]
}
}
],
"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, 'ce6f66c11d6f01baebac2362b14d9d0c')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/13.json
- Source · configuration / resource · 1435 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 494deb7ea38c70006125830d3a5c598ac51abc631a107b4800da409e9d955fa3.
Complete file
{
"formatVersion": 1,
"database": {
"version": 13,
"identityHash": "034831b87844c47f0b69694b5cc60b08",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, `privateNote` TEXT NOT NULL DEFAULT '', `nextEpisodeAiringAt` INTEGER NOT NULL DEFAULT 0, `nextEpisodeNumber` INTEGER DEFAULT NULL, `airingScheduleUpdatedAt` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "privateNote",
"columnName": "privateNote",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "''"
},
{
"fieldPath": "nextEpisodeAiringAt",
"columnName": "nextEpisodeAiringAt",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "nextEpisodeNumber",
"columnName": "nextEpisodeNumber",
"affinity": "INTEGER",
"defaultValue": "NULL"
},
{
"fieldPath": "airingScheduleUpdatedAt",
"columnName": "airingScheduleUpdatedAt",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, `fetchedAt` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "fetchedAt",
"columnName": "fetchedAt",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, `isPaused` INTEGER NOT NULL DEFAULT 0, `storageLocation` TEXT, `requestJson` TEXT, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isPaused",
"columnName": "isPaused",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "storageLocation",
"columnName": "storageLocation",
"affinity": "TEXT"
},
{
"fieldPath": "requestJson",
"columnName": "requestJson",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubRecoveryPending` INTEGER NOT NULL DEFAULT 0, `hubBootstrapComplete` INTEGER NOT NULL DEFAULT 1, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, `serverProvider` TEXT NOT NULL DEFAULT 'YokanHub', `mangayomiIdMappings` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubRecoveryPending",
"columnName": "hubRecoveryPending",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubBootstrapComplete",
"columnName": "hubBootstrapComplete",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
},
{
"fieldPath": "serverProvider",
"columnName": "serverProvider",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "'YokanHub'"
},
{
"fieldPath": "mangayomiIdMappings",
"columnName": "mangayomiIdMappings",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, `fetchedAt` INTEGER, `sourceId` INTEGER, `sourceVersion` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
},
{
"fieldPath": "fetchedAt",
"columnName": "fetchedAt",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceVersion",
"columnName": "sourceVersion",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, `epoch` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "epoch",
"columnName": "epoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
},
{
"tableName": "recipe_catalog_checkpoint",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `generation` INTEGER NOT NULL, `replayRevision` INTEGER, `replayPayloadHash` BLOB, PRIMARY KEY(`catalogId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "generation",
"columnName": "generation",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "replayRevision",
"columnName": "replayRevision",
"affinity": "INTEGER"
},
{
"fieldPath": "replayPayloadHash",
"columnName": "replayPayloadHash",
"affinity": "BLOB"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId"
]
}
},
{
"tableName": "recipe_catalog_trust_key",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `keyId` TEXT NOT NULL, `rawEd25519PublicKey` BLOB NOT NULL, `state` TEXT NOT NULL, `validFromEpochSeconds` INTEGER, `validUntilEpochSeconds` INTEGER, PRIMARY KEY(`catalogId`, `keyId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "keyId",
"columnName": "keyId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "rawEd25519PublicKey",
"columnName": "rawEd25519PublicKey",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "state",
"columnName": "state",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "validFromEpochSeconds",
"columnName": "validFromEpochSeconds",
"affinity": "INTEGER"
},
{
"fieldPath": "validUntilEpochSeconds",
"columnName": "validUntilEpochSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"keyId"
]
}
},
{
"tableName": "recipe_catalog_installed",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `stableId` TEXT NOT NULL, `catalogRevision` INTEGER NOT NULL, `releaseVersion` TEXT NOT NULL, `sha256` TEXT NOT NULL, `sizeBytes` INTEGER NOT NULL, `artifactBytes` BLOB NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`catalogId`, `stableId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "stableId",
"columnName": "stableId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "catalogRevision",
"columnName": "catalogRevision",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "releaseVersion",
"columnName": "releaseVersion",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sha256",
"columnName": "sha256",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sizeBytes",
"columnName": "sizeBytes",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "artifactBytes",
"columnName": "artifactBytes",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"stableId"
]
}
}
],
"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, '034831b87844c47f0b69694b5cc60b08')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/14.json
- Source · configuration / resource · 1453 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 7f9135d399d9ef180f716edbb0fdad8d8d6ba5ee90ab8680544dced798b95ca0.
Complete file
{
"formatVersion": 1,
"database": {
"version": 14,
"identityHash": "5f6c499859bef5bdab1a4c438248b95b",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, `privateNote` TEXT NOT NULL DEFAULT '', `nextEpisodeAiringAt` INTEGER NOT NULL DEFAULT 0, `nextEpisodeNumber` INTEGER DEFAULT NULL, `airingScheduleUpdatedAt` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "privateNote",
"columnName": "privateNote",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "''"
},
{
"fieldPath": "nextEpisodeAiringAt",
"columnName": "nextEpisodeAiringAt",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "nextEpisodeNumber",
"columnName": "nextEpisodeNumber",
"affinity": "INTEGER",
"defaultValue": "NULL"
},
{
"fieldPath": "airingScheduleUpdatedAt",
"columnName": "airingScheduleUpdatedAt",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, `fetchedAt` INTEGER NOT NULL DEFAULT 0, `number` REAL DEFAULT NULL, `season` INTEGER DEFAULT NULL, `numberingName` TEXT DEFAULT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "fetchedAt",
"columnName": "fetchedAt",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "number",
"columnName": "number",
"affinity": "REAL",
"defaultValue": "NULL"
},
{
"fieldPath": "season",
"columnName": "season",
"affinity": "INTEGER",
"defaultValue": "NULL"
},
{
"fieldPath": "numberingName",
"columnName": "numberingName",
"affinity": "TEXT",
"defaultValue": "NULL"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, `isPaused` INTEGER NOT NULL DEFAULT 0, `storageLocation` TEXT, `requestJson` TEXT, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isPaused",
"columnName": "isPaused",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "storageLocation",
"columnName": "storageLocation",
"affinity": "TEXT"
},
{
"fieldPath": "requestJson",
"columnName": "requestJson",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubRecoveryPending` INTEGER NOT NULL DEFAULT 0, `hubBootstrapComplete` INTEGER NOT NULL DEFAULT 1, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, `serverProvider` TEXT NOT NULL DEFAULT 'YokanHub', `mangayomiIdMappings` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubRecoveryPending",
"columnName": "hubRecoveryPending",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubBootstrapComplete",
"columnName": "hubBootstrapComplete",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
},
{
"fieldPath": "serverProvider",
"columnName": "serverProvider",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "'YokanHub'"
},
{
"fieldPath": "mangayomiIdMappings",
"columnName": "mangayomiIdMappings",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, `fetchedAt` INTEGER, `sourceId` INTEGER, `sourceVersion` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
},
{
"fieldPath": "fetchedAt",
"columnName": "fetchedAt",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceVersion",
"columnName": "sourceVersion",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, `epoch` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "epoch",
"columnName": "epoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
},
{
"tableName": "recipe_catalog_checkpoint",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `generation` INTEGER NOT NULL, `replayRevision` INTEGER, `replayPayloadHash` BLOB, PRIMARY KEY(`catalogId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "generation",
"columnName": "generation",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "replayRevision",
"columnName": "replayRevision",
"affinity": "INTEGER"
},
{
"fieldPath": "replayPayloadHash",
"columnName": "replayPayloadHash",
"affinity": "BLOB"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId"
]
}
},
{
"tableName": "recipe_catalog_trust_key",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `keyId` TEXT NOT NULL, `rawEd25519PublicKey` BLOB NOT NULL, `state` TEXT NOT NULL, `validFromEpochSeconds` INTEGER, `validUntilEpochSeconds` INTEGER, PRIMARY KEY(`catalogId`, `keyId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "keyId",
"columnName": "keyId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "rawEd25519PublicKey",
"columnName": "rawEd25519PublicKey",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "state",
"columnName": "state",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "validFromEpochSeconds",
"columnName": "validFromEpochSeconds",
"affinity": "INTEGER"
},
{
"fieldPath": "validUntilEpochSeconds",
"columnName": "validUntilEpochSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"keyId"
]
}
},
{
"tableName": "recipe_catalog_installed",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `stableId` TEXT NOT NULL, `catalogRevision` INTEGER NOT NULL, `releaseVersion` TEXT NOT NULL, `sha256` TEXT NOT NULL, `sizeBytes` INTEGER NOT NULL, `artifactBytes` BLOB NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`catalogId`, `stableId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "stableId",
"columnName": "stableId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "catalogRevision",
"columnName": "catalogRevision",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "releaseVersion",
"columnName": "releaseVersion",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sha256",
"columnName": "sha256",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sizeBytes",
"columnName": "sizeBytes",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "artifactBytes",
"columnName": "artifactBytes",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"stableId"
]
}
}
],
"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, '5f6c499859bef5bdab1a4c438248b95b')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/15.json
- Source · configuration / resource · 1512 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 b1a389f1633cc6cae21167371ca9c2cc1a59ed68bf8476ae74c7365b2fe50371.
Complete file
{
"formatVersion": 1,
"database": {
"version": 15,
"identityHash": "f038e9b8c2a419731c1e16a5b1413dc5",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, `privateNote` TEXT NOT NULL DEFAULT '', `nextEpisodeAiringAt` INTEGER NOT NULL DEFAULT 0, `nextEpisodeNumber` INTEGER DEFAULT NULL, `airingScheduleUpdatedAt` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "privateNote",
"columnName": "privateNote",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "''"
},
{
"fieldPath": "nextEpisodeAiringAt",
"columnName": "nextEpisodeAiringAt",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "nextEpisodeNumber",
"columnName": "nextEpisodeNumber",
"affinity": "INTEGER",
"defaultValue": "NULL"
},
{
"fieldPath": "airingScheduleUpdatedAt",
"columnName": "airingScheduleUpdatedAt",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "manga_credit",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`mangaId` INTEGER NOT NULL, `position` INTEGER NOT NULL, `name` TEXT NOT NULL, `role` TEXT, `character` TEXT, `imageUrl` TEXT, PRIMARY KEY(`mangaId`, `position`), FOREIGN KEY(`mangaId`) REFERENCES `manga`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "role",
"columnName": "role",
"affinity": "TEXT"
},
{
"fieldPath": "character",
"columnName": "character",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"mangaId",
"position"
]
},
"foreignKeys": [
{
"table": "manga",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"mangaId"
],
"referencedColumns": [
"id"
]
}
]
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, `fetchedAt` INTEGER NOT NULL DEFAULT 0, `number` REAL DEFAULT NULL, `season` INTEGER DEFAULT NULL, `numberingName` TEXT DEFAULT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "fetchedAt",
"columnName": "fetchedAt",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "number",
"columnName": "number",
"affinity": "REAL",
"defaultValue": "NULL"
},
{
"fieldPath": "season",
"columnName": "season",
"affinity": "INTEGER",
"defaultValue": "NULL"
},
{
"fieldPath": "numberingName",
"columnName": "numberingName",
"affinity": "TEXT",
"defaultValue": "NULL"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, `isPaused` INTEGER NOT NULL DEFAULT 0, `storageLocation` TEXT, `requestJson` TEXT, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isPaused",
"columnName": "isPaused",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "storageLocation",
"columnName": "storageLocation",
"affinity": "TEXT"
},
{
"fieldPath": "requestJson",
"columnName": "requestJson",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubRecoveryPending` INTEGER NOT NULL DEFAULT 0, `hubBootstrapComplete` INTEGER NOT NULL DEFAULT 1, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, `serverProvider` TEXT NOT NULL DEFAULT 'YokanHub', `mangayomiIdMappings` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubRecoveryPending",
"columnName": "hubRecoveryPending",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubBootstrapComplete",
"columnName": "hubBootstrapComplete",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
},
{
"fieldPath": "serverProvider",
"columnName": "serverProvider",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "'YokanHub'"
},
{
"fieldPath": "mangayomiIdMappings",
"columnName": "mangayomiIdMappings",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, `fetchedAt` INTEGER, `sourceId` INTEGER, `sourceVersion` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
},
{
"fieldPath": "fetchedAt",
"columnName": "fetchedAt",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceVersion",
"columnName": "sourceVersion",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, `epoch` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "epoch",
"columnName": "epoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
},
{
"tableName": "recipe_catalog_checkpoint",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `generation` INTEGER NOT NULL, `replayRevision` INTEGER, `replayPayloadHash` BLOB, PRIMARY KEY(`catalogId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "generation",
"columnName": "generation",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "replayRevision",
"columnName": "replayRevision",
"affinity": "INTEGER"
},
{
"fieldPath": "replayPayloadHash",
"columnName": "replayPayloadHash",
"affinity": "BLOB"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId"
]
}
},
{
"tableName": "recipe_catalog_trust_key",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `keyId` TEXT NOT NULL, `rawEd25519PublicKey` BLOB NOT NULL, `state` TEXT NOT NULL, `validFromEpochSeconds` INTEGER, `validUntilEpochSeconds` INTEGER, PRIMARY KEY(`catalogId`, `keyId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "keyId",
"columnName": "keyId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "rawEd25519PublicKey",
"columnName": "rawEd25519PublicKey",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "state",
"columnName": "state",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "validFromEpochSeconds",
"columnName": "validFromEpochSeconds",
"affinity": "INTEGER"
},
{
"fieldPath": "validUntilEpochSeconds",
"columnName": "validUntilEpochSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"keyId"
]
}
},
{
"tableName": "recipe_catalog_installed",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `stableId` TEXT NOT NULL, `catalogRevision` INTEGER NOT NULL, `releaseVersion` TEXT NOT NULL, `sha256` TEXT NOT NULL, `sizeBytes` INTEGER NOT NULL, `artifactBytes` BLOB NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`catalogId`, `stableId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "stableId",
"columnName": "stableId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "catalogRevision",
"columnName": "catalogRevision",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "releaseVersion",
"columnName": "releaseVersion",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sha256",
"columnName": "sha256",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sizeBytes",
"columnName": "sizeBytes",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "artifactBytes",
"columnName": "artifactBytes",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"stableId"
]
}
}
],
"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, 'f038e9b8c2a419731c1e16a5b1413dc5')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/16.json
- Source · configuration / resource · 1537 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 6791c68d339f1de656ececcc3585cdf6de3e08ed3e1040aef75554725d4a739e.
Complete file
{
"formatVersion": 1,
"database": {
"version": 16,
"identityHash": "706c595a945fa2b4b13a91250acb388c",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, `privateNote` TEXT NOT NULL DEFAULT '', `nextEpisodeAiringAt` INTEGER NOT NULL DEFAULT 0, `nextEpisodeNumber` INTEGER DEFAULT NULL, `airingScheduleUpdatedAt` INTEGER NOT NULL DEFAULT 0, `parentId` INTEGER DEFAULT NULL, `fetchType` TEXT NOT NULL DEFAULT 'Episodes', `seasonNumber` REAL DEFAULT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "privateNote",
"columnName": "privateNote",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "''"
},
{
"fieldPath": "nextEpisodeAiringAt",
"columnName": "nextEpisodeAiringAt",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "nextEpisodeNumber",
"columnName": "nextEpisodeNumber",
"affinity": "INTEGER",
"defaultValue": "NULL"
},
{
"fieldPath": "airingScheduleUpdatedAt",
"columnName": "airingScheduleUpdatedAt",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "parentId",
"columnName": "parentId",
"affinity": "INTEGER",
"defaultValue": "NULL"
},
{
"fieldPath": "fetchType",
"columnName": "fetchType",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "'Episodes'"
},
{
"fieldPath": "seasonNumber",
"columnName": "seasonNumber",
"affinity": "REAL",
"defaultValue": "NULL"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "manga_credit",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`mangaId` INTEGER NOT NULL, `position` INTEGER NOT NULL, `name` TEXT NOT NULL, `role` TEXT, `character` TEXT, `imageUrl` TEXT, PRIMARY KEY(`mangaId`, `position`), FOREIGN KEY(`mangaId`) REFERENCES `manga`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "role",
"columnName": "role",
"affinity": "TEXT"
},
{
"fieldPath": "character",
"columnName": "character",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"mangaId",
"position"
]
},
"foreignKeys": [
{
"table": "manga",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"mangaId"
],
"referencedColumns": [
"id"
]
}
]
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, `fetchedAt` INTEGER NOT NULL DEFAULT 0, `number` REAL DEFAULT NULL, `season` INTEGER DEFAULT NULL, `numberingName` TEXT DEFAULT NULL, `fillerOverride` INTEGER DEFAULT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "fetchedAt",
"columnName": "fetchedAt",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "number",
"columnName": "number",
"affinity": "REAL",
"defaultValue": "NULL"
},
{
"fieldPath": "season",
"columnName": "season",
"affinity": "INTEGER",
"defaultValue": "NULL"
},
{
"fieldPath": "numberingName",
"columnName": "numberingName",
"affinity": "TEXT",
"defaultValue": "NULL"
},
{
"fieldPath": "fillerOverride",
"columnName": "fillerOverride",
"affinity": "INTEGER",
"defaultValue": "NULL"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, `isPaused` INTEGER NOT NULL DEFAULT 0, `storageLocation` TEXT, `requestJson` TEXT, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isPaused",
"columnName": "isPaused",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "storageLocation",
"columnName": "storageLocation",
"affinity": "TEXT"
},
{
"fieldPath": "requestJson",
"columnName": "requestJson",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubRecoveryPending` INTEGER NOT NULL DEFAULT 0, `hubBootstrapComplete` INTEGER NOT NULL DEFAULT 1, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, `serverProvider` TEXT NOT NULL DEFAULT 'YokanHub', `mangayomiIdMappings` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubRecoveryPending",
"columnName": "hubRecoveryPending",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubBootstrapComplete",
"columnName": "hubBootstrapComplete",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
},
{
"fieldPath": "serverProvider",
"columnName": "serverProvider",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "'YokanHub'"
},
{
"fieldPath": "mangayomiIdMappings",
"columnName": "mangayomiIdMappings",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, `fetchedAt` INTEGER, `sourceId` INTEGER, `sourceVersion` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
},
{
"fieldPath": "fetchedAt",
"columnName": "fetchedAt",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceVersion",
"columnName": "sourceVersion",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, `epoch` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "epoch",
"columnName": "epoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
},
{
"tableName": "recipe_catalog_checkpoint",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `generation` INTEGER NOT NULL, `replayRevision` INTEGER, `replayPayloadHash` BLOB, PRIMARY KEY(`catalogId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "generation",
"columnName": "generation",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "replayRevision",
"columnName": "replayRevision",
"affinity": "INTEGER"
},
{
"fieldPath": "replayPayloadHash",
"columnName": "replayPayloadHash",
"affinity": "BLOB"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId"
]
}
},
{
"tableName": "recipe_catalog_trust_key",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `keyId` TEXT NOT NULL, `rawEd25519PublicKey` BLOB NOT NULL, `state` TEXT NOT NULL, `validFromEpochSeconds` INTEGER, `validUntilEpochSeconds` INTEGER, PRIMARY KEY(`catalogId`, `keyId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "keyId",
"columnName": "keyId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "rawEd25519PublicKey",
"columnName": "rawEd25519PublicKey",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "state",
"columnName": "state",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "validFromEpochSeconds",
"columnName": "validFromEpochSeconds",
"affinity": "INTEGER"
},
{
"fieldPath": "validUntilEpochSeconds",
"columnName": "validUntilEpochSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"keyId"
]
}
},
{
"tableName": "recipe_catalog_installed",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `stableId` TEXT NOT NULL, `catalogRevision` INTEGER NOT NULL, `releaseVersion` TEXT NOT NULL, `sha256` TEXT NOT NULL, `sizeBytes` INTEGER NOT NULL, `artifactBytes` BLOB NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`catalogId`, `stableId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "stableId",
"columnName": "stableId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "catalogRevision",
"columnName": "catalogRevision",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "releaseVersion",
"columnName": "releaseVersion",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sha256",
"columnName": "sha256",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sizeBytes",
"columnName": "sizeBytes",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "artifactBytes",
"columnName": "artifactBytes",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"stableId"
]
}
}
],
"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, '706c595a945fa2b4b13a91250acb388c')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/2.json
- Source · configuration / resource · 1195 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 1eee318b2ded5dd85aca1a7d77267d2cad9d042307469e7384bedae5f80be36b.
Complete file
{
"formatVersion": 1,
"database": {
"version": 2,
"identityHash": "040eb9bf4ad0cf3d320de2ad8011e69b",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
}
],
"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, '040eb9bf4ad0cf3d320de2ad8011e69b')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/3.json
- Source · configuration / resource · 1202 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 4e31417cb88167a7bc3d86b3a9d90df070c828cdcb1d0fd0531a6303b2202245.
Complete file
{
"formatVersion": 1,
"database": {
"version": 3,
"identityHash": "3144eef539a5998a14579bf04516565c",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, `epoch` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "epoch",
"columnName": "epoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
}
],
"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, '3144eef539a5998a14579bf04516565c')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/4.json
- Source · configuration / resource · 1209 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 fad81f67b92f2e1a9a6211e37d12d78849e038dc6317a8b86dccb6b5e9558641.
Complete file
{
"formatVersion": 1,
"database": {
"version": 4,
"identityHash": "765d3e24c4565a4181b49c46cc0e9fc9",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubRecoveryPending` INTEGER NOT NULL DEFAULT 0, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubRecoveryPending",
"columnName": "hubRecoveryPending",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, `epoch` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "epoch",
"columnName": "epoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
}
],
"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, '765d3e24c4565a4181b49c46cc0e9fc9')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/5.json
- Source · configuration / resource · 1216 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 843779242d2f8b60ca19d730e3668aa557e36d96d300a5c31b488111b98c5727.
Complete file
{
"formatVersion": 1,
"database": {
"version": 5,
"identityHash": "c33259b810d394a8cdb715a794e18a5b",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubRecoveryPending` INTEGER NOT NULL DEFAULT 0, `hubBootstrapComplete` INTEGER NOT NULL DEFAULT 1, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubRecoveryPending",
"columnName": "hubRecoveryPending",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubBootstrapComplete",
"columnName": "hubBootstrapComplete",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, `epoch` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "epoch",
"columnName": "epoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
}
],
"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, 'c33259b810d394a8cdb715a794e18a5b')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/6.json
- Source · configuration / resource · 1352 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 23d028f08c7a9c3d147149850f6c7005a97471eec24d9f5d5cf36622da7caf97.
Complete file
{
"formatVersion": 1,
"database": {
"version": 6,
"identityHash": "4ad538d8be284f87f48d1d39692cf2d2",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubRecoveryPending` INTEGER NOT NULL DEFAULT 0, `hubBootstrapComplete` INTEGER NOT NULL DEFAULT 1, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubRecoveryPending",
"columnName": "hubRecoveryPending",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubBootstrapComplete",
"columnName": "hubBootstrapComplete",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, `epoch` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "epoch",
"columnName": "epoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
},
{
"tableName": "recipe_catalog_checkpoint",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `generation` INTEGER NOT NULL, `replayRevision` INTEGER, `replayPayloadHash` BLOB, PRIMARY KEY(`catalogId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "generation",
"columnName": "generation",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "replayRevision",
"columnName": "replayRevision",
"affinity": "INTEGER"
},
{
"fieldPath": "replayPayloadHash",
"columnName": "replayPayloadHash",
"affinity": "BLOB"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId"
]
}
},
{
"tableName": "recipe_catalog_trust_key",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `keyId` TEXT NOT NULL, `rawEd25519PublicKey` BLOB NOT NULL, `state` TEXT NOT NULL, `validFromEpochSeconds` INTEGER, `validUntilEpochSeconds` INTEGER, PRIMARY KEY(`catalogId`, `keyId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "keyId",
"columnName": "keyId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "rawEd25519PublicKey",
"columnName": "rawEd25519PublicKey",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "state",
"columnName": "state",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "validFromEpochSeconds",
"columnName": "validFromEpochSeconds",
"affinity": "INTEGER"
},
{
"fieldPath": "validUntilEpochSeconds",
"columnName": "validUntilEpochSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"keyId"
]
}
},
{
"tableName": "recipe_catalog_installed",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `stableId` TEXT NOT NULL, `catalogRevision` INTEGER NOT NULL, `releaseVersion` TEXT NOT NULL, `sha256` TEXT NOT NULL, `sizeBytes` INTEGER NOT NULL, `artifactBytes` BLOB NOT NULL, PRIMARY KEY(`catalogId`, `stableId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "stableId",
"columnName": "stableId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "catalogRevision",
"columnName": "catalogRevision",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "releaseVersion",
"columnName": "releaseVersion",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sha256",
"columnName": "sha256",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sizeBytes",
"columnName": "sizeBytes",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "artifactBytes",
"columnName": "artifactBytes",
"affinity": "BLOB",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"stableId"
]
}
}
],
"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, '4ad538d8be284f87f48d1d39692cf2d2')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/7.json
- Source · configuration / resource · 1357 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 dc8bfa1734488eb58aee6435ff1cad0cde41b6053137ebbdef845e93b642655b.
Complete file
{
"formatVersion": 1,
"database": {
"version": 7,
"identityHash": "65d360f0ee74b32d7b0f7a939be9a4c8",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubRecoveryPending` INTEGER NOT NULL DEFAULT 0, `hubBootstrapComplete` INTEGER NOT NULL DEFAULT 1, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubRecoveryPending",
"columnName": "hubRecoveryPending",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubBootstrapComplete",
"columnName": "hubBootstrapComplete",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, `epoch` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "epoch",
"columnName": "epoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
},
{
"tableName": "recipe_catalog_checkpoint",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `generation` INTEGER NOT NULL, `replayRevision` INTEGER, `replayPayloadHash` BLOB, PRIMARY KEY(`catalogId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "generation",
"columnName": "generation",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "replayRevision",
"columnName": "replayRevision",
"affinity": "INTEGER"
},
{
"fieldPath": "replayPayloadHash",
"columnName": "replayPayloadHash",
"affinity": "BLOB"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId"
]
}
},
{
"tableName": "recipe_catalog_trust_key",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `keyId` TEXT NOT NULL, `rawEd25519PublicKey` BLOB NOT NULL, `state` TEXT NOT NULL, `validFromEpochSeconds` INTEGER, `validUntilEpochSeconds` INTEGER, PRIMARY KEY(`catalogId`, `keyId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "keyId",
"columnName": "keyId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "rawEd25519PublicKey",
"columnName": "rawEd25519PublicKey",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "state",
"columnName": "state",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "validFromEpochSeconds",
"columnName": "validFromEpochSeconds",
"affinity": "INTEGER"
},
{
"fieldPath": "validUntilEpochSeconds",
"columnName": "validUntilEpochSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"keyId"
]
}
},
{
"tableName": "recipe_catalog_installed",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `stableId` TEXT NOT NULL, `catalogRevision` INTEGER NOT NULL, `releaseVersion` TEXT NOT NULL, `sha256` TEXT NOT NULL, `sizeBytes` INTEGER NOT NULL, `artifactBytes` BLOB NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`catalogId`, `stableId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "stableId",
"columnName": "stableId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "catalogRevision",
"columnName": "catalogRevision",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "releaseVersion",
"columnName": "releaseVersion",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sha256",
"columnName": "sha256",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sizeBytes",
"columnName": "sizeBytes",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "artifactBytes",
"columnName": "artifactBytes",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"stableId"
]
}
}
],
"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, '65d360f0ee74b32d7b0f7a939be9a4c8')"
]
}
}
composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/8.json
- Source · configuration / resource · 1372 lines.
- Manual task: Recreate the keys, identifiers, build relationships or resource names used by the consuming code. Preserve serialized names and schema compatibility; omit machine-specific values.
Exact file bytes / download · SHA-256 681c974dda0d1206af6decd116d20508b8f234b44b06b8046f8c596b87156a29.
Complete file
{
"formatVersion": 1,
"database": {
"version": 8,
"identityHash": "969ec08d91fe10c205c6b4752a653e64",
"entities": [
{
"tableName": "manga",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT, `link` TEXT, `imageUrl` TEXT, `description` TEXT, `author` TEXT, `artist` TEXT, `status` TEXT NOT NULL, `itemType` TEXT NOT NULL, `genre` TEXT, `favorite` INTEGER NOT NULL, `source` TEXT, `lang` TEXT, `dateAdded` INTEGER, `lastUpdate` INTEGER, `lastRead` INTEGER NOT NULL, `categories` TEXT, `isLocalArchive` INTEGER NOT NULL, `customCoverImage` BLOB, `customCoverFromTracker` TEXT, `smartUpdateDays` INTEGER, `updatedAt` INTEGER NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT"
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT"
},
{
"fieldPath": "artist",
"columnName": "artist",
"affinity": "TEXT"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "genre",
"columnName": "genre",
"affinity": "TEXT"
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT"
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT"
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER"
},
{
"fieldPath": "lastUpdate",
"columnName": "lastUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categories",
"columnName": "categories",
"affinity": "TEXT"
},
{
"fieldPath": "isLocalArchive",
"columnName": "isLocalArchive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "customCoverImage",
"columnName": "customCoverImage",
"affinity": "BLOB"
},
{
"fieldPath": "customCoverFromTracker",
"columnName": "customCoverFromTracker",
"affinity": "TEXT"
},
{
"fieldPath": "smartUpdateDays",
"columnName": "smartUpdateDays",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "chapter",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `name` TEXT, `url` TEXT NOT NULL, `dateUpload` TEXT NOT NULL, `scanlator` TEXT NOT NULL, `isBookmarked` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `lastPageRead` TEXT NOT NULL, `archivePath` TEXT NOT NULL, `isFiller` INTEGER NOT NULL, `thumbnailUrl` TEXT, `description` TEXT, `downloadSize` TEXT, `duration` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateUpload",
"columnName": "dateUpload",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scanlator",
"columnName": "scanlator",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isBookmarked",
"columnName": "isBookmarked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPageRead",
"columnName": "lastPageRead",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "archivePath",
"columnName": "archivePath",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFiller",
"columnName": "isFiller",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "thumbnailUrl",
"columnName": "thumbnailUrl",
"affinity": "TEXT"
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "downloadSize",
"columnName": "downloadSize",
"affinity": "TEXT"
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `forItemType` TEXT NOT NULL, `position` INTEGER, `hidden` INTEGER, `shouldUpdate` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "forItemType",
"columnName": "forItemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER"
},
{
"fieldPath": "hidden",
"columnName": "hidden",
"affinity": "INTEGER"
},
{
"fieldPath": "shouldUpdate",
"columnName": "shouldUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "source",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `baseUrl` TEXT NOT NULL, `lang` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `isAdded` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `isNsfw` INTEGER NOT NULL, `sourceCode` TEXT NOT NULL, `sourceCodeUrl` TEXT NOT NULL, `typeSource` TEXT NOT NULL, `iconUrl` TEXT NOT NULL, `isFullData` INTEGER NOT NULL, `hasCloudflare` INTEGER NOT NULL, `lastUsed` INTEGER NOT NULL, `dateFormat` TEXT NOT NULL, `dateFormatLocale` TEXT NOT NULL, `apiUrl` TEXT NOT NULL, `version` TEXT NOT NULL, `versionLast` TEXT NOT NULL, `headers` TEXT NOT NULL, `supportLatest` INTEGER, `filterList` TEXT, `preferenceList` TEXT, `itemType` TEXT NOT NULL, `appMinVerReq` TEXT NOT NULL, `additionalParams` TEXT NOT NULL, `isLocal` INTEGER NOT NULL, `isObsolete` INTEGER NOT NULL, `sourceCodeLanguage` TEXT NOT NULL, `notes` TEXT NOT NULL, `repoJson` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseUrl",
"columnName": "baseUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lang",
"columnName": "lang",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isActive",
"columnName": "isActive",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isAdded",
"columnName": "isAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isPinned",
"columnName": "isPinned",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNsfw",
"columnName": "isNsfw",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCode",
"columnName": "sourceCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceCodeUrl",
"columnName": "sourceCodeUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "typeSource",
"columnName": "typeSource",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "iconUrl",
"columnName": "iconUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFullData",
"columnName": "isFullData",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hasCloudflare",
"columnName": "hasCloudflare",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastUsed",
"columnName": "lastUsed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dateFormat",
"columnName": "dateFormat",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateFormatLocale",
"columnName": "dateFormatLocale",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "apiUrl",
"columnName": "apiUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "version",
"columnName": "version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "versionLast",
"columnName": "versionLast",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "supportLatest",
"columnName": "supportLatest",
"affinity": "INTEGER"
},
{
"fieldPath": "filterList",
"columnName": "filterList",
"affinity": "TEXT"
},
{
"fieldPath": "preferenceList",
"columnName": "preferenceList",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appMinVerReq",
"columnName": "appMinVerReq",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "additionalParams",
"columnName": "additionalParams",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLocal",
"columnName": "isLocal",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isObsolete",
"columnName": "isObsolete",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sourceCodeLanguage",
"columnName": "sourceCodeLanguage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoJson",
"columnName": "repoJson",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `itemType` TEXT NOT NULL, `date` TEXT, `updatedAt` INTEGER NOT NULL, `readingTimeSeconds` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "readingTimeSeconds",
"columnName": "readingTimeSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "library_update",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `mangaId` INTEGER, `chapterId` INTEGER, `chapterName` TEXT, `date` TEXT, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "chapterName",
"columnName": "chapterName",
"affinity": "TEXT"
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT"
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "download",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `chapterId` INTEGER, `succeeded` INTEGER, `failed` INTEGER, `total` INTEGER, `isDownload` INTEGER, `isStartDownload` INTEGER, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER"
},
{
"fieldPath": "succeeded",
"columnName": "succeeded",
"affinity": "INTEGER"
},
{
"fieldPath": "failed",
"columnName": "failed",
"affinity": "INTEGER"
},
{
"fieldPath": "total",
"columnName": "total",
"affinity": "INTEGER"
},
{
"fieldPath": "isDownload",
"columnName": "isDownload",
"affinity": "INTEGER"
},
{
"fieldPath": "isStartDownload",
"columnName": "isStartDownload",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `libraryId` INTEGER, `mediaId` INTEGER, `mangaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` INTEGER, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `itemType` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "mangaId",
"columnName": "mangaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "INTEGER"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "itemType",
"columnName": "itemType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "track_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `username` TEXT, `oauth` TEXT, `prefs` TEXT, `refreshing` INTEGER, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT"
},
{
"fieldPath": "oauth",
"columnName": "oauth",
"affinity": "TEXT"
},
{
"fieldPath": "prefs",
"columnName": "prefs",
"affinity": "TEXT"
},
{
"fieldPath": "refreshing",
"columnName": "refreshing",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "track_search",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`rowId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER, `libraryId` INTEGER, `mediaId` INTEGER, `syncId` INTEGER, `title` TEXT, `lastChapterRead` INTEGER, `totalChapter` INTEGER, `score` REAL, `status` TEXT NOT NULL, `startedReadingDate` INTEGER, `finishedReadingDate` INTEGER, `trackingUrl` TEXT, `coverUrl` TEXT NOT NULL, `summary` TEXT NOT NULL, `publishingStatus` TEXT NOT NULL, `publishingType` TEXT NOT NULL, `startDate` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "rowId",
"columnName": "rowId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER"
},
{
"fieldPath": "libraryId",
"columnName": "libraryId",
"affinity": "INTEGER"
},
{
"fieldPath": "mediaId",
"columnName": "mediaId",
"affinity": "INTEGER"
},
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER"
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "lastChapterRead",
"columnName": "lastChapterRead",
"affinity": "INTEGER"
},
{
"fieldPath": "totalChapter",
"columnName": "totalChapter",
"affinity": "INTEGER"
},
{
"fieldPath": "score",
"columnName": "score",
"affinity": "REAL"
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startedReadingDate",
"columnName": "startedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "finishedReadingDate",
"columnName": "finishedReadingDate",
"affinity": "INTEGER"
},
{
"fieldPath": "trackingUrl",
"columnName": "trackingUrl",
"affinity": "TEXT"
},
{
"fieldPath": "coverUrl",
"columnName": "coverUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "summary",
"columnName": "summary",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingStatus",
"columnName": "publishingStatus",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "publishingType",
"columnName": "publishingType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "startDate",
"columnName": "startDate",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"rowId"
]
}
},
{
"tableName": "sync_preference",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` INTEGER NOT NULL, `email` TEXT, `authToken` TEXT, `lastSyncManga` INTEGER, `lastSyncHistory` INTEGER, `lastSyncUpdate` INTEGER, `server` TEXT, `syncOn` INTEGER NOT NULL, `autoSyncFrequency` INTEGER NOT NULL, `syncHistories` INTEGER NOT NULL, `syncUpdates` INTEGER NOT NULL, `syncSettings` INTEGER NOT NULL, `hubHead` INTEGER NOT NULL DEFAULT 0, `hubEpoch` INTEGER NOT NULL DEFAULT 0, `hubRecoveryPending` INTEGER NOT NULL DEFAULT 0, `hubBootstrapComplete` INTEGER NOT NULL DEFAULT 1, `hubHlc` INTEGER NOT NULL DEFAULT 0, `deviceId` TEXT, PRIMARY KEY(`syncId`))",
"fields": [
{
"fieldPath": "syncId",
"columnName": "syncId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT"
},
{
"fieldPath": "authToken",
"columnName": "authToken",
"affinity": "TEXT"
},
{
"fieldPath": "lastSyncManga",
"columnName": "lastSyncManga",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncHistory",
"columnName": "lastSyncHistory",
"affinity": "INTEGER"
},
{
"fieldPath": "lastSyncUpdate",
"columnName": "lastSyncUpdate",
"affinity": "INTEGER"
},
{
"fieldPath": "server",
"columnName": "server",
"affinity": "TEXT"
},
{
"fieldPath": "syncOn",
"columnName": "syncOn",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "autoSyncFrequency",
"columnName": "autoSyncFrequency",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncHistories",
"columnName": "syncHistories",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncUpdates",
"columnName": "syncUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "syncSettings",
"columnName": "syncSettings",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hubHead",
"columnName": "hubHead",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubEpoch",
"columnName": "hubEpoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubRecoveryPending",
"columnName": "hubRecoveryPending",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "hubBootstrapComplete",
"columnName": "hubBootstrapComplete",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "hubHlc",
"columnName": "hubHlc",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "deviceId",
"columnName": "deviceId",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"syncId"
]
}
},
{
"tableName": "changed_part",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `actionType` TEXT NOT NULL, `isarId` INTEGER, `data` TEXT NOT NULL, `clientDate` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionType",
"columnName": "actionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isarId",
"columnName": "isarId",
"affinity": "INTEGER"
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "clientDate",
"columnName": "clientDate",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "custom_button",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT, `codePress` TEXT, `codeLongPress` TEXT NOT NULL, `codeStartup` TEXT NOT NULL, `isFavourite` INTEGER NOT NULL, `position` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT"
},
{
"fieldPath": "codePress",
"columnName": "codePress",
"affinity": "TEXT"
},
{
"fieldPath": "codeLongPress",
"columnName": "codeLongPress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "codeStartup",
"columnName": "codeStartup",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isFavourite",
"columnName": "isFavourite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "page_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterId` INTEGER NOT NULL, `chapterUrl` TEXT, `urls` TEXT, `headers` TEXT, `fetchedAt` INTEGER, `sourceId` INTEGER, `sourceVersion` TEXT, PRIMARY KEY(`chapterId`))",
"fields": [
{
"fieldPath": "chapterId",
"columnName": "chapterId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT"
},
{
"fieldPath": "urls",
"columnName": "urls",
"affinity": "TEXT"
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT"
},
{
"fieldPath": "fetchedAt",
"columnName": "fetchedAt",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
},
{
"fieldPath": "sourceVersion",
"columnName": "sourceVersion",
"affinity": "TEXT"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterId"
]
}
},
{
"tableName": "settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `json` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "json",
"columnName": "json",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "outbox",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, `value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, `epoch` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`kind`, `id`, `path`))",
"fields": [
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT"
},
{
"fieldPath": "hlc",
"columnName": "hlc",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "epoch",
"columnName": "epoch",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"kind",
"id",
"path"
]
}
},
{
"tableName": "recipe_catalog_checkpoint",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `generation` INTEGER NOT NULL, `replayRevision` INTEGER, `replayPayloadHash` BLOB, PRIMARY KEY(`catalogId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "generation",
"columnName": "generation",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "replayRevision",
"columnName": "replayRevision",
"affinity": "INTEGER"
},
{
"fieldPath": "replayPayloadHash",
"columnName": "replayPayloadHash",
"affinity": "BLOB"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId"
]
}
},
{
"tableName": "recipe_catalog_trust_key",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `keyId` TEXT NOT NULL, `rawEd25519PublicKey` BLOB NOT NULL, `state` TEXT NOT NULL, `validFromEpochSeconds` INTEGER, `validUntilEpochSeconds` INTEGER, PRIMARY KEY(`catalogId`, `keyId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "keyId",
"columnName": "keyId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "rawEd25519PublicKey",
"columnName": "rawEd25519PublicKey",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "state",
"columnName": "state",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "validFromEpochSeconds",
"columnName": "validFromEpochSeconds",
"affinity": "INTEGER"
},
{
"fieldPath": "validUntilEpochSeconds",
"columnName": "validUntilEpochSeconds",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"keyId"
]
}
},
{
"tableName": "recipe_catalog_installed",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`catalogId` TEXT NOT NULL, `stableId` TEXT NOT NULL, `catalogRevision` INTEGER NOT NULL, `releaseVersion` TEXT NOT NULL, `sha256` TEXT NOT NULL, `sizeBytes` INTEGER NOT NULL, `artifactBytes` BLOB NOT NULL, `sourceId` INTEGER, PRIMARY KEY(`catalogId`, `stableId`))",
"fields": [
{
"fieldPath": "catalogId",
"columnName": "catalogId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "stableId",
"columnName": "stableId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "catalogRevision",
"columnName": "catalogRevision",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "releaseVersion",
"columnName": "releaseVersion",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sha256",
"columnName": "sha256",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sizeBytes",
"columnName": "sizeBytes",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "artifactBytes",
"columnName": "artifactBytes",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "sourceId",
"columnName": "sourceId",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"catalogId",
"stableId"
]
}
}
],
"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, '969ec08d91fe10c205c6b4752a653e64')"
]
}
}
composeApp/src/androidMain/kotlin/eu/friedcutlet/yokan/database/PersistentDatabase.android.kt
- Source · implementation · 25 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
7: actual fun createDefaultDatabaseSnapshotStore(): DatabaseSnapshotStore = AndroidDatabaseSnapshotStore()
9: private class AndroidDatabaseSnapshotStore : DatabaseSnapshotStore {
13: override fun load(): YokanDatabaseSnapshot? = file
18: override fun save(snapshot: YokanDatabaseSnapshot) {
Exact file bytes / download · SHA-256 e567d1376b03e09be74906100741f42edc17a4cc1fc73a4658320ad54949b04d.
Complete file
package eu.friedcutlet.yokan.database
import eu.friedcutlet.yokan.AndroidAppContext
import android.content.Context
import java.io.File
actual fun createDefaultDatabaseSnapshotStore(): DatabaseSnapshotStore = AndroidDatabaseSnapshotStore()
private class AndroidDatabaseSnapshotStore : DatabaseSnapshotStore {
private val file: File?
get() = AndroidAppContext.appContext?.filesDir?.resolve(DatabaseFileName)
override fun load(): YokanDatabaseSnapshot? = file
?.takeIf { it.exists() }
?.readText()
?.let(::decodeDatabaseSnapshot)
override fun save(snapshot: YokanDatabaseSnapshot) {
val target = file ?: return
target.parentFile?.mkdirs()
target.writeText(encodeDatabaseSnapshot(snapshot))
}
}
private const val DatabaseFileName = "yokan-database-v1.json"
composeApp/src/androidMain/kotlin/eu/friedcutlet/yokan/database/room/YokanRoomDatabase.android.kt
- Source · implementation · 14 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
6: actual fun createYokanRoomDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanRoomDatabase {
Exact file bytes / download · SHA-256 235800f22764b046cacfc82e2d8354924888d4fc64e194790a61ddbe9e0d7245.
Complete file
package eu.friedcutlet.yokan.database.room
import androidx.room.Room
import eu.friedcutlet.yokan.AndroidAppContext
actual fun createYokanRoomDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanRoomDatabase {
val ctx = AndroidAppContext.appContext
?: error("AndroidAppContext.appContext not initialized; call before opening Room.")
val dbFile = ctx.getDatabasePath(eu.friedcutlet.yokan.domain.ProfileStorageNamespace(profileId).databaseRelativePath).apply { parentFile?.mkdirs() }
return Room.databaseBuilder<YokanRoomDatabase>(
context = ctx.applicationContext,
name = dbFile.absolutePath,
).buildYokanRoom()
}
composeApp/src/commonMain/kotlin/eu/friedcutlet/yokan/database/InMemoryYokanDatabase.kt
- Source · implementation · 634 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
19: class InMemoryYokanDatabase(
58: override fun snapshot(): YokanDatabaseSnapshot = lock.withLock(::current)
60: override fun snapshots(): StateFlow<YokanDatabaseSnapshot> = snapshotState
62: override fun supportsAtomicSnapshotPersistence(): Boolean = true
64: override suspend fun replaceAllAtomically(
72: override suspend fun replaceAllRemoteAtomically(snapshot: YokanDatabaseSnapshot, expectedSnapshot: YokanDatabaseSnapshot?) {
76: override fun replaceAll(
85: fun <T> MutableList<T>.reset(items: List<T>) {
114: private fun current(): YokanDatabaseSnapshot =
117: private fun createSnapshot(): YokanDatabaseSnapshot = YokanDatabaseSnapshot(
136: override fun settings(): DbSettings = lock.withLock { settings }
138: override fun updateSettings(settings: DbSettings) = lock.withLock {
147: override fun mangas(itemType: DbItemType?): List<DbManga> = lock.withLock {
151: override fun manga(id: Long): DbManga? = lock.withLock { mangas[id] }
153: override fun upsertManga(manga: DbManga): DbManga = lock.withLock {
160: override fun removeManga(id: Long, recordChange: Boolean) = lock.withLock {
165: override fun chapters(mangaId: Long?): List<DbChapter> = lock.withLock {
169: override fun chapter(id: Long): DbChapter? = lock.withLock { chapters[id] }
171: override fun upsertChapter(chapter: DbChapter): DbChapter = lock.withLock {
178: override fun removeChapter(id: Long, recordChange: Boolean) = lock.withLock {
184: override fun categories(itemType: DbItemType?): List<DbCategory> = lock.withLock {
188: override fun upsertCategory(category: DbCategory): DbCategory = lock.withLock {
195: override fun removeCategory(id: Long, recordChange: Boolean) = lock.withLock {
200: override fun sources(itemType: DbItemType?): List<DbSource> = lock.withLock {
208: override fun source(id: Long): DbSource? = lock.withLock { sources[id] }
210: override fun upsertSource(source: DbSource): DbSource = lock.withLock {
214: override fun removeSource(id: Long) = lock.withLock {
222: override fun histories(): List<DbHistory> = lock.withLock { histories.rows.toList() }
224: override fun upsertHistory(history: DbHistory): DbHistory = lock.withLock {
231: override fun removeHistory(id: Long, recordChange: Boolean) = lock.withLock {
236: override fun updates(): List<DbUpdate> = lock.withLock { updates.rows.toList() }
238: override fun upsertUpdate(update: DbUpdate): DbUpdate = lock.withLock {
245: override fun removeUpdate(id: Long, recordChange: Boolean) = lock.withLock {
250: override fun downloads(): List<DbDownload> = lock.withLock { downloads.rows.toList() }
252: override fun download(id: Long): DbDownload? = lock.withLock { downloads[id] }
254: override fun upsertDownload(download: DbDownload): DbDownload = lock.withLock {
258: override fun removeDownload(id: Long) = lock.withLock {
263: override fun tracks(mangaId: Long?): List<DbTrack> = lock.withLock {
267: override fun upsertTrack(track: DbTrack): DbTrack = lock.withLock {
274: override fun removeTrack(id: Long, recordChange: Boolean) = lock.withLock {
279: override fun trackPreferences(): List<DbTrackPreference> = lock.withLock { trackPreferences.toList() }
281: override fun upsertTrackPreference(preference: DbTrackPreference): DbTrackPreference = lock.withLock {
285: override fun trackSearches(syncId: Int?): List<DbTrackSearch> = lock.withLock {
289: override fun upsertTrackSearch(search: DbTrackSearch): DbTrackSearch = lock.withLock {
293: override fun syncPreferences(): List<DbSyncPreference> = lock.withLock { syncPreferences.toList() }
295: override fun upsertSyncPreference(preference: DbSyncPreference): DbSyncPreference = lock.withLock {
299: override suspend fun upsertSyncPreferenceIf(
312: override fun changedParts(): List<DbChangedPart> = lock.withLock { changedParts.rows.toList() }
314: override fun recordChange(change: DbChangedPart): DbChangedPart = lock.withLock {
323: override fun clearChangedParts() = lock.withLock {
328: override fun customButtons(): List<DbCustomButton> = lock.withLock { customButtons.rows.sortedBy { it.position } }
330: override fun upsertCustomButton(button: DbCustomButton): DbCustomButton = lock.withLock {
334: override fun removeCustomButton(id: Long) = lock.withLock {
339: override fun pageCache(chapterId: Long?): List<DbChapterPageUrls> = lock.withLock {
343: override fun upsertPageCache(cache: DbChapterPageUrls): DbChapterPageUrls = lock.withLock {
352: override fun removePageCache(chapterIds: Collection<Long>) {
358: override fun clearPageCache() = lock.withLock {
365: override fun outbox(): List<DbOutboxOp> = lock.withLock { outbox.values.toList() }
368: internal fun <T> recordingOutbox(block: () -> T): Pair<T, List<DbOutboxOp>> = lock.withLock {
380: override fun removeOutbox(ops: List<DbOutboxOp>) = lock.withLock {
389: override suspend fun resyncHub(syncId: Long, epoch: Int): DbSyncPreference = lock.withLock {
401: override fun <T> applyRemote(block: () -> T): T = lock.withLock {
410: override fun <T> batch(block: () -> T): T = lock.withLock {
424: private fun <T> recordDoc(kind: Int, id: Long, before: T?, after: T, serializer: KSerializer<T>) {
431: private fun recordDelete(kind: Int, id: Long) {
437: private fun record(kind: Int, id: Long, changes: List<SyncPaths.PathChange>, epoch: Int) {
455: private fun <T> docOf(kind: Int, serializer: KSerializer<T>, value: T): JsonObject {
464: private fun putOutbox(op: DbOutboxOp) {
470: private fun resetOutbox(ops: List<DbOutboxOp>) {
475: private fun activeHubEpoch(): Int? = SyncPaths.activeHubEpoch(syncPreferences)
477: private fun <T> localTimestamp(
490: private fun recordMangayomiDelete(kind: Int, id: Long, action: DbActionType) {
495: private fun emitSnapshot(part: SnapshotPart) {
503: private fun publishDirtySnapshot() {
530: private enum class SnapshotPart {
549: private fun <T> upsert(
568: private fun <T, K : Any> upsertNullableKey(items: MutableList<T>, item: T, key: (T) -> K?): T {
584: private fun <T> assignId(item: T): T = when (item) {
598: private fun <T> nextId(items: List<T>, key: (T) -> Long): Long =
603: private class Table<T>(initial: List<T>, val key: (T) -> Long) {
607: fun indexOf(id: Long): Int {
615: operator fun get(id: Long): T? = indexOf(id).let { if (it >= 0) rows[it] else null }
617: fun add(row: T) {
623: fun remove(id: Long): Boolean = rows.removeAll { key(it) == id }.also { removed -> if (removed) index = null }
625: fun reset(items: List<T>) {
632: private data class OutboxKey(val kind: Int, val id: Long, val path: String)
634: private fun DbOutboxOp.key() = OutboxKey(kind, id, path)
Exact file bytes / download · SHA-256 1fc24f2966b10320be5ccb50b0328d9808b1450e38a5ae1d4a05b59ba5cc8eef.
Complete file
package eu.friedcutlet.yokan.database
import eu.friedcutlet.yokan.database.sync.SyncClock
import eu.friedcutlet.yokan.database.sync.SyncIds
import eu.friedcutlet.yokan.database.sync.SyncPaths
import eu.friedcutlet.yokan.database.sync.hubResync
import eu.friedcutlet.yokan.database.sync.mangayomiDeleteParts
import eu.friedcutlet.yokan.util.PlatformLock
import eu.friedcutlet.yokan.util.nowMillis
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.serialization.KSerializer
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive
/** Chapter page lists kept by [InMemoryYokanDatabase.upsertPageCache]; older ones are refetched (page URLs expire anyway). */
internal const val MAX_PAGE_CACHE = 100
class InMemoryYokanDatabase(
initial: YokanDatabaseSnapshot = seedDatabaseSnapshot(),
) : YokanDatabase {
private val lock = PlatformLock()
private var settings = initial.settings
private val mangas = Table(initial.mangas, DbManga::id)
private val chapters = Table(initial.chapters, DbChapter::id)
private val categories = Table(initial.categories, DbCategory::id)
private val sources = Table(initial.sources, DbSource::id)
private val histories = Table(initial.histories, DbHistory::id)
private val updates = Table(initial.updates, DbUpdate::id)
private val downloads = Table(initial.downloads, DbDownload::id)
private val tracks = Table(initial.tracks, DbTrack::id)
private val trackPreferences = initial.trackPreferences.toMutableList()
private val trackSearches = initial.trackSearches.toMutableList()
private val syncPreferences = initial.syncPreferences.toMutableList()
private val changedParts = Table(initial.changedParts, DbChangedPart::id)
private val customButtons = Table(initial.customButtons, DbCustomButton::id)
private val pageCache = initial.pageCache.toMutableList()
/** Keyed by (kind, id, path) so a rewrite replaces its op in O(1); iteration order is seq order. */
private val outbox = LinkedHashMap<OutboxKey, DbOutboxOp>()
private var outboxSeq = initial.outbox.maxOfOrNull { it.seq } ?: 0L
private var suppressOutbox = 0
private var batchDepth = 0
private var newOutboxOps: MutableList<DbOutboxOp>? = null
private var lastDocValue: Any? = null
private var lastDoc: JsonObject? = null
private val dirtySnapshotParts = mutableSetOf<SnapshotPart>()
init {
resetOutbox(initial.outbox)
// Epoch-0 ops from before recording required a logged-in hub: no hub ever accepts them
// (the first sync seeds full state instead), so they were only growing the database.
if (activeHubEpoch() == null) outbox.values.removeAll { it.epoch == 0 }
}
private val snapshotState = MutableStateFlow(createSnapshot())
override fun snapshot(): YokanDatabaseSnapshot = lock.withLock(::current)
override fun snapshots(): StateFlow<YokanDatabaseSnapshot> = snapshotState
override fun supportsAtomicSnapshotPersistence(): Boolean = true
override suspend fun replaceAllAtomically(
snapshot: YokanDatabaseSnapshot,
expectedSnapshot: YokanDatabaseSnapshot?,
removedSourceIds: Set<Long>,
) {
replaceAll(snapshot, expectedSnapshot)
}
override suspend fun replaceAllRemoteAtomically(snapshot: YokanDatabaseSnapshot, expectedSnapshot: YokanDatabaseSnapshot?) {
applyRemote { replaceAll(snapshot, expectedSnapshot) }
}
override fun replaceAll(
snapshot: YokanDatabaseSnapshot,
expectedSnapshot: YokanDatabaseSnapshot?,
) = lock.withLock {
if (expectedSnapshot != null && current() != expectedSnapshot) {
throw SnapshotReplacementConflictException()
}
val before = current()
val replacement = if (suppressOutbox > 0) snapshot else snapshot.withMangayomiLocalSyncTimestamps(before)
fun <T> MutableList<T>.reset(items: List<T>) {
clear()
addAll(items)
}
settings = replacement.settings
mangas.reset(replacement.mangas)
chapters.reset(replacement.chapters)
categories.reset(replacement.categories)
sources.reset(replacement.sources)
histories.reset(replacement.histories)
updates.reset(replacement.updates)
downloads.reset(replacement.downloads)
tracks.reset(replacement.tracks)
trackPreferences.reset(replacement.trackPreferences)
trackSearches.reset(replacement.trackSearches)
syncPreferences.reset(replacement.syncPreferences)
changedParts.reset(replacement.changedParts)
customButtons.reset(replacement.customButtons)
pageCache.reset(replacement.pageCache)
resetOutbox(replacement.outbox)
outboxSeq = replacement.outbox.maxOfOrNull { it.seq } ?: 0L
if (suppressOutbox == 0) {
mangayomiDeleteParts(before, replacement, changedParts.rows.toList(), nowMillis()).forEach(::recordChange)
}
dirtySnapshotParts.clear()
snapshotState.value = createSnapshot()
}
/** The published snapshot is current whenever nothing is pending, so reads skip the full copy. */
private fun current(): YokanDatabaseSnapshot =
if (dirtySnapshotParts.isEmpty()) snapshotState.value else createSnapshot()
private fun createSnapshot(): YokanDatabaseSnapshot = YokanDatabaseSnapshot(
settings = settings,
mangas = mangas.rows.toList(),
chapters = chapters.rows.toList(),
categories = categories.rows.toList(),
sources = sources.rows.toList(),
histories = histories.rows.toList(),
updates = updates.rows.toList(),
downloads = downloads.rows.toList(),
tracks = tracks.rows.toList(),
trackPreferences = trackPreferences.toList(),
trackSearches = trackSearches.toList(),
syncPreferences = syncPreferences.toList(),
changedParts = changedParts.rows.toList(),
customButtons = customButtons.rows.toList(),
pageCache = pageCache.toList(),
outbox = outbox.values.toList(),
)
override fun settings(): DbSettings = lock.withLock { settings }
override fun updateSettings(settings: DbSettings) = lock.withLock {
val before = this.settings
this.settings = settings
if (before != settings) {
recordDoc(SyncPaths.KIND_SETTINGS, SyncPaths.SETTINGS_ID, before, settings, DbSettings.serializer())
}
emitSnapshot(SnapshotPart.Settings)
}
override fun mangas(itemType: DbItemType?): List<DbManga> = lock.withLock {
mangas.rows.filter { itemType == null || it.itemType == itemType }
}
override fun manga(id: Long): DbManga? = lock.withLock { mangas[id] }
override fun upsertManga(manga: DbManga): DbManga = lock.withLock {
val identified = if (manga.id == 0L) assignId(manga) else manga
val old = mangas[identified.id]
val value = localTimestamp(identified, old, SyncPaths.KIND_MANGA, DbManga.serializer(), DbManga::updatedAt) { row, at -> row.copy(updatedAt = at) }
upsert(mangas, value, SyncPaths.KIND_MANGA, DbManga.serializer()).also { emitSnapshot(SnapshotPart.Mangas) }
}
override fun removeManga(id: Long, recordChange: Boolean) = lock.withLock {
if (mangas.remove(id) && recordChange) { recordDelete(SyncPaths.KIND_MANGA, id); recordMangayomiDelete(SyncPaths.KIND_MANGA, id, DbActionType.RemoveItem) }
emitSnapshot(SnapshotPart.Mangas)
}
override fun chapters(mangaId: Long?): List<DbChapter> = lock.withLock {
chapters.rows.filter { mangaId == null || it.mangaId == mangaId }
}
override fun chapter(id: Long): DbChapter? = lock.withLock { chapters[id] }
override fun upsertChapter(chapter: DbChapter): DbChapter = lock.withLock {
val identified = if (chapter.id == 0L) assignId(chapter) else chapter
val old = chapters[identified.id]
val value = localTimestamp(identified, old, SyncPaths.KIND_CHAPTER, DbChapter.serializer(), DbChapter::updatedAt) { row, at -> row.copy(updatedAt = at) }
upsert(chapters, value, SyncPaths.KIND_CHAPTER, DbChapter.serializer()).also { emitSnapshot(SnapshotPart.Chapters) }
}
override fun removeChapter(id: Long, recordChange: Boolean) = lock.withLock {
if (chapters.remove(id) && recordChange) { recordDelete(SyncPaths.KIND_CHAPTER, id); recordMangayomiDelete(SyncPaths.KIND_CHAPTER, id, DbActionType.RemoveChapter) }
if (pageCache.removeAll { it.chapterId == id }) dirtySnapshotParts += SnapshotPart.PageCache
emitSnapshot(SnapshotPart.Chapters)
}
override fun categories(itemType: DbItemType?): List<DbCategory> = lock.withLock {
categories.rows.filter { itemType == null || it.forItemType == itemType }.sortedBy { it.position ?: 0 }
}
override fun upsertCategory(category: DbCategory): DbCategory = lock.withLock {
val identified = if (category.id == 0L) assignId(category) else category
val old = categories[identified.id]
val value = localTimestamp(identified, old, SyncPaths.KIND_CATEGORY, DbCategory.serializer(), DbCategory::updatedAt) { row, at -> row.copy(updatedAt = at) }
upsert(categories, value, SyncPaths.KIND_CATEGORY, DbCategory.serializer()).also { emitSnapshot(SnapshotPart.Categories) }
}
override fun removeCategory(id: Long, recordChange: Boolean) = lock.withLock {
if (categories.remove(id) && recordChange) { recordDelete(SyncPaths.KIND_CATEGORY, id); recordMangayomiDelete(SyncPaths.KIND_CATEGORY, id, DbActionType.RemoveCategory) }
emitSnapshot(SnapshotPart.Categories)
}
override fun sources(itemType: DbItemType?): List<DbSource> = lock.withLock {
// Strict item-type match. Local sources used to leak into every tab
// via `|| it.isLocal`, which mixed Anime archives into the Manga
// browse tab. If a user has local archives for multiple item types,
// they need separate local sources per type.
sources.rows.filter { itemType == null || it.itemType == itemType }
}
override fun source(id: Long): DbSource? = lock.withLock { sources[id] }
override fun upsertSource(source: DbSource): DbSource = lock.withLock {
upsert(sources, source).also { emitSnapshot(SnapshotPart.Sources) }
}
override fun removeSource(id: Long) = lock.withLock {
batch {
sources.remove(id)
recordChange(DbChangedPart(actionType = DbActionType.RemoveExtension, isarId = id, data = "", clientDate = nowMillis()))
emitSnapshot(SnapshotPart.Sources)
}
}
override fun histories(): List<DbHistory> = lock.withLock { histories.rows.toList() }
override fun upsertHistory(history: DbHistory): DbHistory = lock.withLock {
val identified = if (history.id == 0L) assignId(history) else history
val old = histories[identified.id]
val value = localTimestamp(identified, old, SyncPaths.KIND_HISTORY, DbHistory.serializer(), DbHistory::updatedAt) { row, at -> row.copy(updatedAt = at) }
upsert(histories, value, SyncPaths.KIND_HISTORY, DbHistory.serializer()).also { emitSnapshot(SnapshotPart.Histories) }
}
override fun removeHistory(id: Long, recordChange: Boolean) = lock.withLock {
if (histories.remove(id) && recordChange) { recordDelete(SyncPaths.KIND_HISTORY, id); recordMangayomiDelete(SyncPaths.KIND_HISTORY, id, DbActionType.RemoveHistory) }
emitSnapshot(SnapshotPart.Histories)
}
override fun updates(): List<DbUpdate> = lock.withLock { updates.rows.toList() }
override fun upsertUpdate(update: DbUpdate): DbUpdate = lock.withLock {
val identified = if (update.id == 0L) assignId(update) else update
val old = updates[identified.id]
val value = localTimestamp(identified, old, SyncPaths.KIND_UPDATE, DbUpdate.serializer(), DbUpdate::updatedAt) { row, at -> row.copy(updatedAt = at) }
upsert(updates, value, SyncPaths.KIND_UPDATE, DbUpdate.serializer()).also { emitSnapshot(SnapshotPart.Updates) }
}
override fun removeUpdate(id: Long, recordChange: Boolean) = lock.withLock {
if (updates.remove(id) && recordChange) { recordDelete(SyncPaths.KIND_UPDATE, id); recordMangayomiDelete(SyncPaths.KIND_UPDATE, id, DbActionType.RemoveUpdate) }
emitSnapshot(SnapshotPart.Updates)
}
override fun downloads(): List<DbDownload> = lock.withLock { downloads.rows.toList() }
override fun download(id: Long): DbDownload? = lock.withLock { downloads[id] }
override fun upsertDownload(download: DbDownload): DbDownload = lock.withLock {
upsert(downloads, download).also { emitSnapshot(SnapshotPart.Downloads) }
}
override fun removeDownload(id: Long) = lock.withLock {
downloads.remove(id)
emitSnapshot(SnapshotPart.Downloads)
}
override fun tracks(mangaId: Long?): List<DbTrack> = lock.withLock {
tracks.rows.filter { mangaId == null || it.mangaId == mangaId }
}
override fun upsertTrack(track: DbTrack): DbTrack = lock.withLock {
val identified = if (track.id == 0L) assignId(track) else track
val old = tracks[identified.id]
val value = localTimestamp(identified, old, SyncPaths.KIND_TRACK, DbTrack.serializer(), DbTrack::updatedAt) { row, at -> row.copy(updatedAt = at) }
upsert(tracks, value, SyncPaths.KIND_TRACK, DbTrack.serializer()).also { emitSnapshot(SnapshotPart.Tracks) }
}
override fun removeTrack(id: Long, recordChange: Boolean) = lock.withLock {
if (tracks.remove(id) && recordChange) { recordDelete(SyncPaths.KIND_TRACK, id); recordMangayomiDelete(SyncPaths.KIND_TRACK, id, DbActionType.RemoveTrack) }
emitSnapshot(SnapshotPart.Tracks)
}
override fun trackPreferences(): List<DbTrackPreference> = lock.withLock { trackPreferences.toList() }
override fun upsertTrackPreference(preference: DbTrackPreference): DbTrackPreference = lock.withLock {
upsertNullableKey(trackPreferences, preference, DbTrackPreference::syncId).also { emitSnapshot(SnapshotPart.TrackPreferences) }
}
override fun trackSearches(syncId: Int?): List<DbTrackSearch> = lock.withLock {
trackSearches.filter { syncId == null || it.syncId == syncId }
}
override fun upsertTrackSearch(search: DbTrackSearch): DbTrackSearch = lock.withLock {
upsertNullableKey(trackSearches, search, DbTrackSearch::id).also { emitSnapshot(SnapshotPart.TrackSearches) }
}
override fun syncPreferences(): List<DbSyncPreference> = lock.withLock { syncPreferences.toList() }
override fun upsertSyncPreference(preference: DbSyncPreference): DbSyncPreference = lock.withLock {
upsertNullableKey(syncPreferences, preference, DbSyncPreference::syncId).also { emitSnapshot(SnapshotPart.SyncPreferences) }
}
override suspend fun upsertSyncPreferenceIf(
syncId: Long,
accepts: (DbSyncPreference?) -> Boolean,
transform: (DbSyncPreference?) -> DbSyncPreference,
): Boolean = lock.withLock {
val current = syncPreferences.firstOrNull { it.syncId == syncId }
if (!accepts(current)) return@withLock false
val updated = transform(current).copy(syncId = syncId)
upsertNullableKey(syncPreferences, updated, DbSyncPreference::syncId)
emitSnapshot(SnapshotPart.SyncPreferences)
true
}
override fun changedParts(): List<DbChangedPart> = lock.withLock { changedParts.rows.toList() }
override fun recordChange(change: DbChangedPart): DbChangedPart = lock.withLock {
val used = changedParts.rows.mapTo(HashSet(), DbChangedPart::id)
var id = change.id.takeIf { it > 0 && it !in used } ?: SyncIds.random()
while (id in used) id = SyncIds.random()
upsert(changedParts, change.copy(id = id)).also {
emitSnapshot(SnapshotPart.ChangedParts)
}
}
override fun clearChangedParts() = lock.withLock {
changedParts.reset(emptyList())
emitSnapshot(SnapshotPart.ChangedParts)
}
override fun customButtons(): List<DbCustomButton> = lock.withLock { customButtons.rows.sortedBy { it.position } }
override fun upsertCustomButton(button: DbCustomButton): DbCustomButton = lock.withLock {
upsert(customButtons, button).also { emitSnapshot(SnapshotPart.CustomButtons) }
}
override fun removeCustomButton(id: Long) = lock.withLock {
customButtons.remove(id)
emitSnapshot(SnapshotPart.CustomButtons)
}
override fun pageCache(chapterId: Long?): List<DbChapterPageUrls> = lock.withLock {
pageCache.filter { chapterId == null || it.chapterId == chapterId }
}
override fun upsertPageCache(cache: DbChapterPageUrls): DbChapterPageUrls = lock.withLock {
cache.chapterId?.let { id -> pageCache.removeAll { it.chapterId == id } }
pageCache += cache
// ponytail: evicts by write order only; track read recency if the offline reader needs older lists.
if (pageCache.size > MAX_PAGE_CACHE) pageCache.subList(0, pageCache.size - MAX_PAGE_CACHE).clear()
emitSnapshot(SnapshotPart.PageCache)
cache
}
override fun removePageCache(chapterIds: Collection<Long>) {
lock.withLock {
if (pageCache.removeAll { it.chapterId in chapterIds }) emitSnapshot(SnapshotPart.PageCache)
}
}
override fun clearPageCache() = lock.withLock {
pageCache.clear()
emitSnapshot(SnapshotPart.PageCache)
}
// ── hub sync ────────────────────────────────────────────────────────────
override fun outbox(): List<DbOutboxOp> = lock.withLock { outbox.values.toList() }
/** Runs [block] and also returns the outbox ops it appended, so the Room layer persists exactly those. */
internal fun <T> recordingOutbox(block: () -> T): Pair<T, List<DbOutboxOp>> = lock.withLock {
val outer = newOutboxOps
val ops = ArrayList<DbOutboxOp>()
newOutboxOps = ops
try {
block() to ops
} finally {
newOutboxOps = outer
outer?.addAll(ops)
}
}
override fun removeOutbox(ops: List<DbOutboxOp>) = lock.withLock {
if (ops.isEmpty()) return@withLock
for (op in ops) {
val key = op.key()
if (outbox[key]?.seq == op.seq) outbox.remove(key)
}
emitSnapshot(SnapshotPart.Outbox)
}
override suspend fun resyncHub(syncId: Long, epoch: Int): DbSyncPreference = lock.withLock {
val current = syncPreferences.firstOrNull { it.syncId == syncId }
?: DbSyncPreference(syncId = syncId)
val (updated, dropBefore) = current.hubResync(epoch)
upsertNullableKey(syncPreferences, updated, DbSyncPreference::syncId)
if (dropBefore != null) outbox.values.removeAll { it.epoch < dropBefore }
dirtySnapshotParts += SnapshotPart.SyncPreferences
dirtySnapshotParts += SnapshotPart.Outbox
publishDirtySnapshot()
updated
}
override fun <T> applyRemote(block: () -> T): T = lock.withLock {
suppressOutbox++
try {
block()
} finally {
suppressOutbox--
}
}
override fun <T> batch(block: () -> T): T = lock.withLock {
batchDepth++
try {
block()
} finally {
batchDepth--
if (batchDepth == 0) publishDirtySnapshot()
}
}
/**
* Record the path-level difference between two versions of a row. Nothing is recorded while
* no hub is logged in: the first sync seeds the hub with full local state, not the outbox.
*/
private fun <T> recordDoc(kind: Int, id: Long, before: T?, after: T, serializer: KSerializer<T>) {
if (suppressOutbox > 0) return
val epoch = activeHubEpoch() ?: return
val beforeDoc = before?.let { docOf(kind, serializer, it) }
record(kind, id, SyncPaths.diff(kind, beforeDoc, docOf(kind, serializer, after)), epoch)
}
private fun recordDelete(kind: Int, id: Long) {
if (suppressOutbox > 0) return
val epoch = activeHubEpoch() ?: return
record(kind, id, listOf(SyncPaths.PathChange(SyncPaths.DELETED, JsonPrimitive(true))), epoch)
}
private fun record(kind: Int, id: Long, changes: List<SyncPaths.PathChange>, epoch: Int) {
for (change in changes) {
val op = DbOutboxOp(
kind = kind,
id = id,
path = change.path,
value = change.value?.toString(),
hlc = SyncClock.tick(),
seq = ++outboxSeq,
epoch = epoch,
)
putOutbox(op)
newOutboxOps?.add(op)
}
if (changes.isNotEmpty()) dirtySnapshotParts += SnapshotPart.Outbox
}
/** Wire doc of [value]. The last row's doc is kept, so rewriting a row (or settings) encodes it once. */
private fun <T> docOf(kind: Int, serializer: KSerializer<T>, value: T): JsonObject {
val cached = lastDoc
if (cached != null && lastDocValue === value) return cached
return SyncPaths.doc(kind, serializer, value).also {
lastDocValue = value
lastDoc = it
}
}
private fun putOutbox(op: DbOutboxOp) {
val key = op.key()
outbox.remove(key)
outbox[key] = op
}
private fun resetOutbox(ops: List<DbOutboxOp>) {
outbox.clear()
ops.sortedBy { it.seq }.forEach(::putOutbox)
}
private fun activeHubEpoch(): Int? = SyncPaths.activeHubEpoch(syncPreferences)
private fun <T> localTimestamp(
incoming: T,
previous: T?,
kind: Int,
serializer: KSerializer<T>,
timestamp: (T) -> Long,
copyTimestamp: (T, Long) -> T,
): T {
// Only Mangayomi's whole-row LWW needs this; Hub merges per path and must not see updatedAt churn.
if (suppressOutbox > 0 || syncPreferences.none { it.serverProvider == SyncServerProvider.Mangayomi }) return incoming
return copyTimestamp(incoming, SyncPaths.localUpdatedAt(kind, serializer, previous, incoming, timestamp))
}
private fun recordMangayomiDelete(kind: Int, id: Long, action: DbActionType) {
if (suppressOutbox > 0) return
mangayomiDeleteParts(kind, id, action, syncPreferences.toList(), changedParts.rows.toList(), nowMillis()).forEach(::recordChange)
}
private fun emitSnapshot(part: SnapshotPart) {
dirtySnapshotParts += part
if (batchDepth > 0) {
return
}
publishDirtySnapshot()
}
private fun publishDirtySnapshot() {
if (dirtySnapshotParts.isEmpty()) return
var next = snapshotState.value
dirtySnapshotParts.forEach { part ->
next = when (part) {
SnapshotPart.Settings -> next.copy(settings = settings)
SnapshotPart.Mangas -> next.copy(mangas = mangas.rows.toList())
SnapshotPart.Chapters -> next.copy(chapters = chapters.rows.toList())
SnapshotPart.Categories -> next.copy(categories = categories.rows.toList())
SnapshotPart.Sources -> next.copy(sources = sources.rows.toList())
SnapshotPart.Histories -> next.copy(histories = histories.rows.toList())
SnapshotPart.Updates -> next.copy(updates = updates.rows.toList())
SnapshotPart.Downloads -> next.copy(downloads = downloads.rows.toList())
SnapshotPart.Tracks -> next.copy(tracks = tracks.rows.toList())
SnapshotPart.TrackPreferences -> next.copy(trackPreferences = trackPreferences.toList())
SnapshotPart.TrackSearches -> next.copy(trackSearches = trackSearches.toList())
SnapshotPart.SyncPreferences -> next.copy(syncPreferences = syncPreferences.toList())
SnapshotPart.ChangedParts -> next.copy(changedParts = changedParts.rows.toList())
SnapshotPart.CustomButtons -> next.copy(customButtons = customButtons.rows.toList())
SnapshotPart.PageCache -> next.copy(pageCache = pageCache.toList())
SnapshotPart.Outbox -> next.copy(outbox = outbox.values.toList())
}
}
dirtySnapshotParts.clear()
snapshotState.value = next
}
private enum class SnapshotPart {
Settings,
Mangas,
Chapters,
Categories,
Sources,
Histories,
Updates,
Downloads,
Tracks,
TrackPreferences,
TrackSearches,
SyncPreferences,
ChangedParts,
CustomButtons,
PageCache,
Outbox,
}
private fun <T> upsert(
table: Table<T>,
item: T,
kind: Int = 0,
serializer: KSerializer<T>? = null,
): T {
val normalized = if (table.key(item) == 0L) assignId(item) else item
val id = table.key(normalized)
val index = table.indexOf(id)
val previous = if (index >= 0) table.rows[index] else null
if (index >= 0) {
table.rows[index] = normalized
} else {
table.add(normalized)
}
if (serializer != null && previous != normalized) recordDoc(kind, id, previous, normalized, serializer)
return normalized
}
private fun <T, K : Any> upsertNullableKey(items: MutableList<T>, item: T, key: (T) -> K?): T {
val itemKey = key(item)
val index = if (itemKey == null) -1 else items.indexOfFirst { key(it) == itemKey }
if (index >= 0) {
items[index] = item
} else {
items += item
}
return item
}
/**
* Synced entities get stable ids derived from their natural key ([SyncIds]) so devices agree
* on identity without coordination; local-only tables keep a plain counter.
*/
@Suppress("UNCHECKED_CAST")
private fun <T> assignId(item: T): T = when (item) {
is DbManga -> item.copy(id = SyncIds.forManga(item) ?: SyncIds.random())
is DbChapter -> item.copy(id = SyncIds.forChapter(item) ?: SyncIds.random())
is DbCategory -> item.copy(id = SyncIds.random())
is DbHistory -> item.copy(id = SyncIds.forHistory(item) ?: SyncIds.random())
is DbUpdate -> item.copy(id = SyncIds.forUpdate(item) ?: SyncIds.random())
is DbTrack -> item.copy(id = SyncIds.forTrack(item) ?: SyncIds.random())
is DbSource -> item.copy(id = nextId(sources.rows, DbSource::id))
is DbDownload -> item.copy(id = nextId(downloads.rows, DbDownload::id))
is DbChangedPart -> item.copy(id = nextId(changedParts.rows, DbChangedPart::id))
is DbCustomButton -> item.copy(id = nextId(customButtons.rows, DbCustomButton::id))
else -> item
} as T
private fun <T> nextId(items: List<T>, key: (T) -> Long): Long =
(items.maxOfOrNull(key) ?: 0L) + 1L
}
/** Rows in insertion order plus a lazily rebuilt id → first-row index, so point lookups and upserts are O(1). */
private class Table<T>(initial: List<T>, val key: (T) -> Long) {
val rows = ArrayList(initial)
private var index: HashMap<Long, Int>? = null
fun indexOf(id: Long): Int {
val map = index ?: HashMap<Long, Int>(rows.size).also { built ->
rows.forEachIndexed { position, row -> built.getOrPut(key(row)) { position } }
index = built
}
return map[id] ?: -1
}
operator fun get(id: Long): T? = indexOf(id).let { if (it >= 0) rows[it] else null }
fun add(row: T) {
index?.getOrPut(key(row)) { rows.size }
rows += row
}
// ponytail: a delete shifts the list and drops the index (rebuilt on the next lookup), so bulk deletes stay O(k·n); use replaceAll at restore scale.
fun remove(id: Long): Boolean = rows.removeAll { key(it) == id }.also { removed -> if (removed) index = null }
fun reset(items: List<T>) {
rows.clear()
rows.addAll(items)
index = null
}
}
private data class OutboxKey(val kind: Int, val id: Long, val path: String)
private fun DbOutboxOp.key() = OutboxKey(kind, id, path)
composeApp/src/commonMain/kotlin/eu/friedcutlet/yokan/database/LocalFolders.kt
- Source · implementation · 163 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
29: fun DbSettings.configuredLocalFolders(): List<DbLocalFolder> {
40: fun DbSettings.effectiveLocalFolders(defaultFolder: DbLocalFolder?): List<DbLocalFolder> {
51: fun resolveDownloadFolderName(name: String?, folders: List<DbLocalFolder>): String? {
61: fun getLocalVirtualPath(folder: DbLocalFolder, entityPath: String): String {
75: fun localVirtualPathFromStoredPath(storedPath: String?, folders: List<DbLocalFolder>): String {
104: fun resolveLocalArchivePath(virtualPath: String, folders: List<DbLocalFolder>): String {
120: fun normalizeLocalFolders(folders: List<DbLocalFolder>): List<DbLocalFolder> {
134: internal fun uniqueLocalFolderName(value: String, used: Set<String>): String {
147: internal fun nameFromPath(path: String): String {
152: internal fun normalizePath(path: String): String =
155: private fun relativePath(base: String, target: String): String {
Exact file bytes / download · SHA-256 f6bb21219f2804dce027a5fa072d20efe30458634fec2b785ebc39feb91d7b1e.
Complete file
package eu.friedcutlet.yokan.database
import eu.friedcutlet.yokan.domain.Manga
/**
* Virtual-folder model for the local library.
*
* The original Flutter Mangayomi port stored each local-library root as a bare
* filesystem path. That broke as soon as the user moved their library to a USB
* drive or external disk that mounts at a different path on another machine,
* because every [DbManga.link] and [DbChapter.archivePath] embedded the old
* physical path.
*
* Virtual folders give each root a stable user-chosen *name* and a current
* *path*. The scanner stores entity paths relative to the folder name
* (e.g. `MyUSB/MangaTitle/Chapter1.cbz`), so when the user remounts the drive
* elsewhere they only need to update the folder's path — every stored row keeps
* working without rewrites.
*/
/** The reserved name used for the app's built-in `<downloadRoot>/local` folder. */
const val DefaultLocalFolderName: String = "local"
/**
* Return the named folders the user has configured, migrating from the legacy
* [DbSettings.localFolders] string list if [DbSettings.namedLocalFolders] is
* still null (i.e. the user's persisted snapshot predates the rename).
*/
fun DbSettings.configuredLocalFolders(): List<DbLocalFolder> {
namedLocalFolders?.let { return normalizeLocalFolders(it) }
val legacy = localFolders ?: return emptyList()
return normalizeLocalFolders(legacy.map { path -> DbLocalFolder(name = nameFromPath(path), path = path) })
}
/**
* Configured folders prepended with [defaultFolder]. Callers that want the
* scanner to also walk the app's bundled `<downloadRoot>/local` directory pass
* it in; callers that only want user-configured roots leave it null.
*/
fun DbSettings.effectiveLocalFolders(defaultFolder: DbLocalFolder?): List<DbLocalFolder> {
val configured = configuredLocalFolders()
if (defaultFolder == null) return configured
return listOf(defaultFolder) + configured.filterNot { it.name == defaultFolder.name }
}
/**
* Resolve which configured folder downloads should be written to, given a
* remembered name. Falls back to the first available folder so a stale name
* (e.g. the folder was removed) cannot strand the downloader.
*/
fun resolveDownloadFolderName(name: String?, folders: List<DbLocalFolder>): String? {
if (folders.isEmpty()) return null
if (name != null && folders.any { it.name == name }) return name
return folders.first().name
}
/**
* Build a virtual entity path under [folder]. The path is always returned with
* forward slashes so it round-trips between platforms (Android, JVM, iOS).
*/
fun getLocalVirtualPath(folder: DbLocalFolder, entityPath: String): String {
val folderName = folder.name.trim()
val folderPath = folder.path
if (folderName.isEmpty() || folderPath.isEmpty()) return normalizePath(entityPath)
val relative = relativePath(folderPath, entityPath)
if (relative.isEmpty() || relative == ".") return folderName
return "$folderName/${normalizePath(relative)}"
}
/**
* Map a stored path (either an already-virtual `<name>/...` path, a current
* physical path, or a legacy `Mangayomi/local/...` path) back to the canonical
* virtual representation so scanner output is comparable across runs.
*/
fun localVirtualPathFromStoredPath(storedPath: String?, folders: List<DbLocalFolder>): String {
if (storedPath.isNullOrBlank()) return ""
val normalized = normalizePath(storedPath)
val firstSegment = normalized.substringBefore('/', missingDelimiterValue = normalized)
if (folders.any { it.name == firstSegment }) return normalized
for (folder in folders) {
if (folder.path.isEmpty()) continue
val normalizedFolderPath = normalizePath(folder.path)
if (normalized == normalizedFolderPath || normalized.startsWith("$normalizedFolderPath/")) {
return getLocalVirtualPath(folder, storedPath)
}
}
val legacyMarker = "Mangayomi/local"
val legacyIndex = normalized.indexOf(legacyMarker)
if (legacyIndex != -1) {
val relative = normalized.substring(legacyIndex + legacyMarker.length).trimStart('/')
return if (relative.isEmpty()) DefaultLocalFolderName else "$DefaultLocalFolderName/$relative"
}
return normalized
}
/**
* Resolve a virtual `<name>/<rest>` path back to the absolute physical path,
* using the folder name to look up the current mount path. Returns the input
* unchanged when no matching folder is configured (so callers can still attempt
* a direct filesystem operation, e.g. when the stored path is still legacy).
*/
fun resolveLocalArchivePath(virtualPath: String, folders: List<DbLocalFolder>): String {
if (virtualPath.isBlank()) return virtualPath
val normalized = normalizePath(virtualPath)
val firstSeparator = normalized.indexOf('/')
val (name, rest) = if (firstSeparator < 0) normalized to "" else
normalized.substring(0, firstSeparator) to normalized.substring(firstSeparator + 1)
val folder = folders.firstOrNull { it.name == name } ?: return virtualPath
if (folder.path.isEmpty()) return virtualPath
val base = folder.path.trimEnd('/', '\\')
return if (rest.isEmpty()) base else "$base/$rest"
}
/**
* Strip duplicates and assign collision-free names. The default folder name
* (`local`) is reserved so the user-configured list can never shadow it.
*/
fun normalizeLocalFolders(folders: List<DbLocalFolder>): List<DbLocalFolder> {
val used = mutableSetOf(DefaultLocalFolderName)
val result = mutableListOf<DbLocalFolder>()
for (folder in folders) {
val path = folder.path.trim()
if (path.isEmpty()) continue
val rawName = folder.name.trim().ifEmpty { nameFromPath(path) }
val name = uniqueLocalFolderName(rawName, used)
used.add(name)
result.add(DbLocalFolder(name = name, path = path))
}
return result
}
internal fun uniqueLocalFolderName(value: String, used: Set<String>): String {
val sanitized = value.replace('/', '_').replace('\\', '_').trim()
val base = sanitized.ifEmpty { "Local" }
// The reserved `local` name is exclusively for the bundled default folder.
var candidate = if (base.equals(DefaultLocalFolderName, ignoreCase = true)) "Local" else base
var index = 2
while (used.contains(candidate)) {
candidate = "$base $index"
index++
}
return candidate
}
internal fun nameFromPath(path: String): String {
val parts = path.replace('\\', '/').split('/').filter { it.isNotBlank() }
return if (parts.isEmpty()) "Local" else parts.last()
}
internal fun normalizePath(path: String): String =
path.replace('\\', '/').trimEnd('/')
private fun relativePath(base: String, target: String): String {
val normalizedBase = normalizePath(base)
val normalizedTarget = normalizePath(target)
if (normalizedTarget == normalizedBase) return ""
if (normalizedTarget.startsWith("$normalizedBase/")) {
return normalizedTarget.substring(normalizedBase.length + 1)
}
return normalizedTarget
}
composeApp/src/commonMain/kotlin/eu/friedcutlet/yokan/database/PersistentDatabase.kt
- Source · implementation · 68 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
11: interface DatabaseSnapshotStore {
12: fun load(): YokanDatabaseSnapshot?
13: fun save(snapshot: YokanDatabaseSnapshot)
16: expect fun createDefaultDatabaseSnapshotStore(): DatabaseSnapshotStore
23: expect fun createDefaultDatabase(): YokanDatabase
26: expect fun createProfileDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanDatabase
29: data class PersistedDatabaseSnapshot(
42: fun encodeDatabaseSnapshot(snapshot: YokanDatabaseSnapshot): String =
45: fun decodeDatabaseSnapshot(raw: String): YokanDatabaseSnapshot? = runCatching {
51: private fun normalizeLegacySnapshot(raw: String, snapshot: YokanDatabaseSnapshot): YokanDatabaseSnapshot {
Exact file bytes / download · SHA-256 afa428c03b21582c50cc49b9968ba1fee1c641ee255d3715523cc27b40525220.
Complete file
package eu.friedcutlet.yokan.database
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
/**
* Snapshot storage used by the browser backend and as the one-shot legacy
* loader for Room migration. Non-web runtime persistence is owned by Room;
* the browser uses `save()` for its deferred snapshot persistence.
*/
interface DatabaseSnapshotStore {
fun load(): YokanDatabaseSnapshot?
fun save(snapshot: YokanDatabaseSnapshot)
}
expect fun createDefaultDatabaseSnapshotStore(): DatabaseSnapshotStore
/**
* Pick the persistence backend. Android/desktop/iOS use Room (per-row
* INSERTs, fast); the browser keeps the whole-snapshot JSON store because
* neither Room nor bundled SQLite ship wasm artifacts.
*/
expect fun createDefaultDatabase(): YokanDatabase
/** Low-level storage factory; only a registry/session coordinator may publish an additional profile. */
expect fun createProfileDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanDatabase
@Serializable
data class PersistedDatabaseSnapshot(
val schemaVersion: Int = CurrentDatabaseSchemaVersion,
val snapshot: YokanDatabaseSnapshot,
)
const val CurrentDatabaseSchemaVersion = 1
val DatabaseJson = Json {
encodeDefaults = true
ignoreUnknownKeys = true
prettyPrint = true
}
fun encodeDatabaseSnapshot(snapshot: YokanDatabaseSnapshot): String =
DatabaseJson.encodeToString(PersistedDatabaseSnapshot(snapshot = snapshot))
fun decodeDatabaseSnapshot(raw: String): YokanDatabaseSnapshot? = runCatching {
normalizeLegacySnapshot(raw, DatabaseJson.decodeFromString<PersistedDatabaseSnapshot>(raw).snapshot)
}.recoverCatching {
normalizeLegacySnapshot(raw, DatabaseJson.decodeFromString<YokanDatabaseSnapshot>(raw))
}.getOrNull()
private fun normalizeLegacySnapshot(raw: String, snapshot: YokanDatabaseSnapshot): YokanDatabaseSnapshot {
if (raw.contains("\"hubRecoveryPending\"") && raw.contains("\"hubBootstrapComplete\"")) {
return snapshot
}
return snapshot.copy(
syncPreferences = snapshot.syncPreferences.map { preference ->
if (preference.hubEpoch > 0 ||
preference.hubHead > 0 ||
preference.hubRecoveryPending ||
(!preference.server.isNullOrBlank() && !preference.authToken.isNullOrBlank())
) {
preference.copy(hubBootstrapComplete = true)
} else {
preference
}
},
)
}
composeApp/src/commonMain/kotlin/eu/friedcutlet/yokan/database/SeedDatabase.kt
- Source · implementation · 47 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
10: fun seedDatabaseSnapshot(): YokanDatabaseSnapshot {
Exact file bytes / download · SHA-256 c9c4d9defbb104f05bbd5b92b42009160fb4677c7df699649fb3897513b7c8c0.
Complete file
package eu.friedcutlet.yokan.database
/**
* Initial database state for first-launch users.
*
* No extensions or catalogs are bundled. Repositories must be added by the user
* or restored from a backup; startup refreshes only those saved repositories.
* There are also no sample titles, sources, chapters, tracks, or history.
*/
fun seedDatabaseSnapshot(): YokanDatabaseSnapshot {
val settings = DbSettings(
mangaExtensionsRepo = emptyList(),
animeExtensionsRepo = emptyList(),
novelExtensionsRepo = emptyList(),
navigationOrder = listOf(
"MangaLibrary",
"AnimeLibrary",
"NovelLibrary",
"Updates",
"History",
"Browse",
"More",
"TrackerLibrary",
),
hideItems = emptyList(),
algorithmWeights = DbAlgorithmWeights(),
backupListOptions = listOf(0, 1, 2, 3, 4, 5),
)
return YokanDatabaseSnapshot(
settings = settings,
mangas = emptyList(),
chapters = emptyList(),
categories = emptyList(),
sources = emptyList(),
histories = emptyList(),
updates = emptyList(),
downloads = emptyList(),
tracks = emptyList(),
trackPreferences = emptyList(),
trackSearches = emptyList(),
syncPreferences = emptyList(),
changedParts = emptyList(),
customButtons = emptyList(),
pageCache = emptyList(),
)
}
composeApp/src/commonMain/kotlin/eu/friedcutlet/yokan/database/SnapshotYokanDatabase.kt
- Source · implementation · 111 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
13: internal class SnapshotYokanDatabase(
26: override suspend fun awaitPersistence() {
30: override suspend fun close() = retirementLock.withLock {
39: override fun supportsAtomicSnapshotPersistence(): Boolean = true
41: override fun replaceAll(
49: override suspend fun replaceAllAtomically(
75: override suspend fun replaceAllRemoteAtomically(snapshot: YokanDatabaseSnapshot, expectedSnapshot: YokanDatabaseSnapshot?) {
93: fun persist(): Boolean {
110: fun persistIfDirty(): Boolean = !closed && (memory.snapshots().value === persisted || persist())
Exact file bytes / download · SHA-256 183dc44012639ccbb84e008163efbcf250f6d9dce73947b6b16908eb6eca32b6.
Complete file
package eu.friedcutlet.yokan.database
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext
/** Browser snapshot backend. Calls are serialized by the browser's single thread. */
internal class SnapshotYokanDatabase(
private val store: DatabaseSnapshotStore,
private val memory: InMemoryYokanDatabase = InMemoryYokanDatabase(store.load() ?: seedDatabaseSnapshot()),
private val stopPersistence: suspend () -> Unit = {},
) : YokanDatabase by memory {
private val retirementLock = Mutex()
private var closed = false
private val _saveFailed = MutableStateFlow(false)
val saveFailed = _saveFailed.asStateFlow()
/** The `snapshots()` value last written to [store]; publication keeps it by reference until a write. */
private var persisted: YokanDatabaseSnapshot? = null
override suspend fun awaitPersistence() {
check(persistIfDirty()) { "Browser database persistence failed" }
}
override suspend fun close() = retirementLock.withLock {
if (closed) return@withLock
withContext(NonCancellable) {
stopPersistence()
awaitPersistence()
closed = true
}
}
override fun supportsAtomicSnapshotPersistence(): Boolean = true
override fun replaceAll(
snapshot: YokanDatabaseSnapshot,
expectedSnapshot: YokanDatabaseSnapshot?,
) {
check(!closed) { "Browser database is closed" }
memory.replaceAll(snapshot, expectedSnapshot)
}
override suspend fun replaceAllAtomically(
snapshot: YokanDatabaseSnapshot,
expectedSnapshot: YokanDatabaseSnapshot?,
removedSourceIds: Set<Long>,
) {
check(!closed) { "Browser database is closed" }
memory.batch {
if (expectedSnapshot != null && memory.snapshot() != expectedSnapshot) {
throw SnapshotReplacementConflictException()
}
val preview = InMemoryYokanDatabase(memory.snapshot())
preview.replaceAll(snapshot, expectedSnapshot)
val target = preview.snapshot()
try {
store.save(target)
} catch (error: Throwable) {
if (error is CancellationException) throw error
_saveFailed.update { true }
throw error
}
memory.applyRemote { memory.replaceAll(target) }
persisted = memory.snapshots().value
_saveFailed.update { false }
}
}
override suspend fun replaceAllRemoteAtomically(snapshot: YokanDatabaseSnapshot, expectedSnapshot: YokanDatabaseSnapshot?) {
check(!closed) { "Browser database is closed" }
memory.batch {
if (expectedSnapshot != null && memory.snapshot() != expectedSnapshot) throw SnapshotReplacementConflictException()
try {
store.save(snapshot)
} catch (error: Throwable) {
if (error is CancellationException) throw error
_saveFailed.update { true }
throw error
}
memory.applyRemote { memory.replaceAll(snapshot) }
persisted = memory.snapshots().value
_saveFailed.update { false }
}
}
/** Always save current memory, including on retry after a rejected storage write. */
fun persist(): Boolean {
if (closed) return false
return try {
memory.batch {
store.save(memory.snapshot())
persisted = memory.snapshots().value
}
_saveFailed.update { false }
true
} catch (error: Throwable) {
if (error is CancellationException) throw error
_saveFailed.update { true }
false
}
}
/** Save only when something was published since the last successful write. */
fun persistIfDirty(): Boolean = !closed && (memory.snapshots().value === persisted || persist())
}
composeApp/src/commonMain/kotlin/eu/friedcutlet/yokan/database/YokanDatabase.kt
- Source · implementation · 180 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
8: data class YokanDatabaseSnapshot(
28: class SnapshotReplacementConflictException : IllegalStateException(
32: interface YokanDatabase {
33: fun snapshot(): YokanDatabaseSnapshot
34: fun snapshots(): StateFlow<YokanDatabaseSnapshot>
37: suspend fun awaitPersistence() = Unit
40: suspend fun close() { awaitPersistence() }
43: fun supportsAtomicSnapshotPersistence(): Boolean = false
46: suspend fun replaceAllAtomically(
55: suspend fun replaceAllRemoteAtomically(snapshot: YokanDatabaseSnapshot, expectedSnapshot: YokanDatabaseSnapshot?) {
66: fun replaceAll(
71: fun settings(): DbSettings
72: fun updateSettings(settings: DbSettings)
74: fun mangas(itemType: DbItemType? = null): List<DbManga>
75: fun manga(id: Long): DbManga?
76: fun upsertManga(manga: DbManga): DbManga
77: fun removeManga(id: Long, recordChange: Boolean = true)
79: fun chapters(mangaId: Long? = null): List<DbChapter>
80: fun chapter(id: Long): DbChapter?
81: fun upsertChapter(chapter: DbChapter): DbChapter
82: fun removeChapter(id: Long, recordChange: Boolean = true)
84: fun categories(itemType: DbItemType? = null): List<DbCategory>
85: fun upsertCategory(category: DbCategory): DbCategory
86: fun removeCategory(id: Long, recordChange: Boolean = true)
88: fun sources(itemType: DbItemType? = null): List<DbSource>
89: fun source(id: Long): DbSource?
90: fun upsertSource(source: DbSource): DbSource
91: fun removeSource(id: Long)
93: fun histories(): List<DbHistory>
94: fun upsertHistory(history: DbHistory): DbHistory
95: fun removeHistory(id: Long, recordChange: Boolean = true)
97: fun updates(): List<DbUpdate>
98: fun upsertUpdate(update: DbUpdate): DbUpdate
99: fun removeUpdate(id: Long, recordChange: Boolean = true)
101: fun downloads(): List<DbDownload>
102: fun download(id: Long): DbDownload? = downloads().firstOrNull { it.id == id }
103: fun upsertDownload(download: DbDownload): DbDownload
104: fun removeDownload(id: Long)
106: fun tracks(mangaId: Long? = null): List<DbTrack>
107: fun upsertTrack(track: DbTrack): DbTrack
108: fun removeTrack(id: Long, recordChange: Boolean = true)
110: fun trackPreferences(): List<DbTrackPreference>
111: fun upsertTrackPreference(preference: DbTrackPreference): DbTrackPreference
113: fun trackSearches(syncId: Int? = null): List<DbTrackSearch>
114: fun upsertTrackSearch(search: DbTrackSearch): DbTrackSearch
116: fun syncPreferences(): List<DbSyncPreference>
117: fun upsertSyncPreference(preference: DbSyncPreference): DbSyncPreference
120: suspend fun upsertSyncPreferenceIf(
131: fun changedParts(): List<DbChangedPart>
132: fun recordChange(change: DbChangedPart): DbChangedPart
133: fun clearChangedParts()
135: fun customButtons(): List<DbCustomButton>
136: fun upsertCustomButton(button: DbCustomButton): DbCustomButton
137: fun removeCustomButton(id: Long)
139: fun pageCache(chapterId: Long? = null): List<DbChapterPageUrls>
140: fun upsertPageCache(cache: DbChapterPageUrls): DbChapterPageUrls
141: fun removePageCache(chapterIds: Collection<Long>)
142: fun clearPageCache()
147: fun outbox(): List<DbOutboxOp> = emptyList()
150: fun removeOutbox(ops: List<DbOutboxOp>) {}
153: suspend fun resyncHub(syncId: Long, epoch: Int): DbSyncPreference
156: fun <T> applyRemote(block: () -> T): T = block()
159: fun <T> batch(block: () -> T): T = block()
163: internal fun YokanDatabaseSnapshot.withMangayomiLocalSyncTimestamps(before: YokanDatabaseSnapshot): YokanDatabaseSnapshot {
165: fun <T> update(rows: List<T>, oldRows: List<T>, id: (T) -> Long, kind: Int, serializer: kotlinx.serialization.KSerializer<T>, at: (T) -> Long, copyAt: (T, Long) -> T): List<T> {
Exact file bytes / download · SHA-256 31f7fa457fb2004d971187f9d06f136e427ccd7b850be15c18e63f87a8f66544.
Complete file
package eu.friedcutlet.yokan.database
import eu.friedcutlet.yokan.database.sync.SyncPaths
import kotlinx.coroutines.flow.StateFlow
import kotlinx.serialization.Serializable
@Serializable
data class YokanDatabaseSnapshot(
val settings: DbSettings,
val mangas: List<DbManga>,
val chapters: List<DbChapter>,
val categories: List<DbCategory>,
val sources: List<DbSource>,
val histories: List<DbHistory>,
val updates: List<DbUpdate>,
val downloads: List<DbDownload>,
val tracks: List<DbTrack>,
val trackPreferences: List<DbTrackPreference>,
val trackSearches: List<DbTrackSearch>,
val syncPreferences: List<DbSyncPreference>,
val changedParts: List<DbChangedPart>,
val customButtons: List<DbCustomButton>,
val pageCache: List<DbChapterPageUrls>,
/** Changes not yet pushed to the hub. */
val outbox: List<DbOutboxOp> = emptyList(),
)
class SnapshotReplacementConflictException : IllegalStateException(
"Database changed while preparing replacement. Retry the operation.",
)
interface YokanDatabase {
fun snapshot(): YokanDatabaseSnapshot
fun snapshots(): StateFlow<YokanDatabaseSnapshot>
/** Await writes already queued by a persistent implementation; in-memory backends are immediate. */
suspend fun awaitPersistence() = Unit
/** Owner has stopped producers. Flush and release persistent resources; failure may be retried. */
suspend fun close() { awaitPersistence() }
/** Entry-management apply is enabled only for transactional backends. */
fun supportsAtomicSnapshotPersistence(): Boolean = false
/** Persist and publish a complete snapshot in one backend transaction. */
suspend fun replaceAllAtomically(
snapshot: YokanDatabaseSnapshot,
expectedSnapshot: YokanDatabaseSnapshot? = null,
removedSourceIds: Set<Long> = emptySet(),
) {
error("ATOMIC_SNAPSHOT_PERSISTENCE_UNAVAILABLE")
}
/** Snapshot transaction originating from remote sync; suppresses local delete recording. */
suspend fun replaceAllRemoteAtomically(snapshot: YokanDatabaseSnapshot, expectedSnapshot: YokanDatabaseSnapshot?) {
if (supportsAtomicSnapshotPersistence()) replaceAllAtomically(snapshot, expectedSnapshot)
else applyRemote { replaceAll(snapshot, expectedSnapshot) }
}
/**
* Replace the entire database state in one operation: a single snapshot
* emission and one bulk persistence pass. Restore-scale writes MUST use
* this — per-row upserts emit a full snapshot copy each, which is
* quadratic over the library size.
*/
fun replaceAll(
snapshot: YokanDatabaseSnapshot,
expectedSnapshot: YokanDatabaseSnapshot? = null,
)
fun settings(): DbSettings
fun updateSettings(settings: DbSettings)
fun mangas(itemType: DbItemType? = null): List<DbManga>
fun manga(id: Long): DbManga?
fun upsertManga(manga: DbManga): DbManga
fun removeManga(id: Long, recordChange: Boolean = true)
fun chapters(mangaId: Long? = null): List<DbChapter>
fun chapter(id: Long): DbChapter?
fun upsertChapter(chapter: DbChapter): DbChapter
fun removeChapter(id: Long, recordChange: Boolean = true)
fun categories(itemType: DbItemType? = null): List<DbCategory>
fun upsertCategory(category: DbCategory): DbCategory
fun removeCategory(id: Long, recordChange: Boolean = true)
fun sources(itemType: DbItemType? = null): List<DbSource>
fun source(id: Long): DbSource?
fun upsertSource(source: DbSource): DbSource
fun removeSource(id: Long)
fun histories(): List<DbHistory>
fun upsertHistory(history: DbHistory): DbHistory
fun removeHistory(id: Long, recordChange: Boolean = true)
fun updates(): List<DbUpdate>
fun upsertUpdate(update: DbUpdate): DbUpdate
fun removeUpdate(id: Long, recordChange: Boolean = true)
fun downloads(): List<DbDownload>
fun download(id: Long): DbDownload? = downloads().firstOrNull { it.id == id }
fun upsertDownload(download: DbDownload): DbDownload
fun removeDownload(id: Long)
fun tracks(mangaId: Long? = null): List<DbTrack>
fun upsertTrack(track: DbTrack): DbTrack
fun removeTrack(id: Long, recordChange: Boolean = true)
fun trackPreferences(): List<DbTrackPreference>
fun upsertTrackPreference(preference: DbTrackPreference): DbTrackPreference
fun trackSearches(syncId: Int? = null): List<DbTrackSearch>
fun upsertTrackSearch(search: DbTrackSearch): DbTrackSearch
fun syncPreferences(): List<DbSyncPreference>
fun upsertSyncPreference(preference: DbSyncPreference): DbSyncPreference
/** Atomically guard a sync-preference write against a provider/server/account switch. */
suspend fun upsertSyncPreferenceIf(
syncId: Long,
accepts: (DbSyncPreference?) -> Boolean,
transform: (DbSyncPreference?) -> DbSyncPreference,
): Boolean {
val current = syncPreferences().firstOrNull { it.syncId == syncId }
if (!accepts(current)) return false
upsertSyncPreference(transform(current).copy(syncId = syncId))
return true
}
fun changedParts(): List<DbChangedPart>
fun recordChange(change: DbChangedPart): DbChangedPart
fun clearChangedParts()
fun customButtons(): List<DbCustomButton>
fun upsertCustomButton(button: DbCustomButton): DbCustomButton
fun removeCustomButton(id: Long)
fun pageCache(chapterId: Long? = null): List<DbChapterPageUrls>
fun upsertPageCache(cache: DbChapterPageUrls): DbChapterPageUrls
fun removePageCache(chapterIds: Collection<Long>)
fun clearPageCache()
// ── hub sync ────────────────────────────────────────────────────────────
/** Unpushed hub ops, oldest first. */
fun outbox(): List<DbOutboxOp> = emptyList()
/** Drop ops that were pushed. An op rewritten since (same key, newer seq) is kept. */
fun removeOutbox(ops: List<DbOutboxOp>) {}
/** Reset the hub cursor and discard only operations from older hub epochs (see `hubResync`). */
suspend fun resyncHub(syncId: Long, epoch: Int): DbSyncPreference
/** Writes inside [block] come from the hub and must not be echoed back into the outbox. */
fun <T> applyRemote(block: () -> T): T = block()
/** Coalesce snapshot emissions across many writes into one. */
fun <T> batch(block: () -> T): T = block()
}
/** Apply the same synced-content timestamp rule to surviving rows in local snapshot replacements. */
internal fun YokanDatabaseSnapshot.withMangayomiLocalSyncTimestamps(before: YokanDatabaseSnapshot): YokanDatabaseSnapshot {
if ((before.syncPreferences + syncPreferences).none { it.serverProvider == SyncServerProvider.Mangayomi }) return this
fun <T> update(rows: List<T>, oldRows: List<T>, id: (T) -> Long, kind: Int, serializer: kotlinx.serialization.KSerializer<T>, at: (T) -> Long, copyAt: (T, Long) -> T): List<T> {
val oldById = oldRows.associateBy(id)
return rows.map { row ->
val old = oldById[id(row)] ?: return@map row
copyAt(row, SyncPaths.localUpdatedAt(kind, serializer, old, row, at))
}
}
return copy(
mangas = update(mangas, before.mangas, DbManga::id, SyncPaths.KIND_MANGA, DbManga.serializer(), DbManga::updatedAt) { row, at -> row.copy(updatedAt = at) },
chapters = update(chapters, before.chapters, DbChapter::id, SyncPaths.KIND_CHAPTER, DbChapter.serializer(), DbChapter::updatedAt) { row, at -> row.copy(updatedAt = at) },
categories = update(categories, before.categories, DbCategory::id, SyncPaths.KIND_CATEGORY, DbCategory.serializer(), DbCategory::updatedAt) { row, at -> row.copy(updatedAt = at) },
histories = update(histories, before.histories, DbHistory::id, SyncPaths.KIND_HISTORY, DbHistory.serializer(), DbHistory::updatedAt) { row, at -> row.copy(updatedAt = at) },
updates = update(updates, before.updates, DbUpdate::id, SyncPaths.KIND_UPDATE, DbUpdate.serializer(), DbUpdate::updatedAt) { row, at -> row.copy(updatedAt = at) },
tracks = update(tracks, before.tracks, DbTrack::id, SyncPaths.KIND_TRACK, DbTrack.serializer(), DbTrack::updatedAt) { row, at -> row.copy(updatedAt = at) },
)
}
composeApp/src/commonTest/kotlin/eu/friedcutlet/yokan/database/ChapterProgressMergeTest.kt
- Source · test / fixture · 36 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
6: class ChapterProgressMergeTest {
10: fun furthestPageWinsIncludingPositionsBeyondIntRange() {
18: fun blankOrNonNumericPositionsKeepTheFirstNonBlankOne() {
26: fun marksAreKeptFromEitherSideAndTheNewerUpdatedAtWins() {
Exact file bytes / download · SHA-256 e2a12eb43d4958f391c74e2f1fcb002a1f126d803095ee9b72e4a54770a6ec34.
Complete file
package eu.friedcutlet.yokan.database
import kotlin.test.Test
import kotlin.test.assertEquals
class ChapterProgressMergeTest {
private val chapter = DbChapter(id = 1, mangaId = 2, url = "/c1", lastPageRead = "4", updatedAt = 100)
@Test
fun furthestPageWinsIncludingPositionsBeyondIntRange() {
assertEquals("9", chapter.mergeProgress(chapter.copy(lastPageRead = "9")).lastPageRead)
assertEquals("4", chapter.mergeProgress(chapter.copy(lastPageRead = "2")).lastPageRead)
assertEquals("3000000000", chapter.mergeProgress(chapter.copy(lastPageRead = "3000000000")).lastPageRead)
assertEquals("3000000000", chapter.copy(lastPageRead = "3000000000").mergeProgress(chapter).lastPageRead)
}
@Test
fun blankOrNonNumericPositionsKeepTheFirstNonBlankOne() {
assertEquals("7", chapter.copy(lastPageRead = "").mergeProgress(chapter.copy(lastPageRead = "7")).lastPageRead)
assertEquals("4", chapter.mergeProgress(chapter.copy(lastPageRead = "")).lastPageRead)
assertEquals("0.5", chapter.copy(lastPageRead = "0.5").mergeProgress(chapter.copy(lastPageRead = "9")).lastPageRead)
assertEquals("4", chapter.mergeProgress(chapter.copy(lastPageRead = "end")).lastPageRead)
}
@Test
fun marksAreKeptFromEitherSideAndTheNewerUpdatedAtWins() {
val other = chapter.copy(isRead = true, isBookmarked = true, fillerOverride = true, updatedAt = 300)
val merged = chapter.mergeProgress(other)
val reverse = other.mergeProgress(chapter)
assertEquals(chapter.copy(isRead = true, isBookmarked = true, fillerOverride = true, updatedAt = 300), merged)
assertEquals(other, reverse)
assertEquals(false, chapter.copy(fillerOverride = false).mergeProgress(other).fillerOverride)
}
}
composeApp/src/commonTest/kotlin/eu/friedcutlet/yokan/database/EinkPresetTest.kt
- Source · test / fixture · 30 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
8: class EinkPresetTest {
Exact file bytes / download · SHA-256 6243e25e8ed7c3119acbb6dd3a2a7663e084397a63c3b5feaeca1fa9eef77c62.
Complete file
package eu.friedcutlet.yokan.database
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
class EinkPresetTest {
@Test fun scalingKeepsShortSideWithinPanelWidthForPagesSpreadsAndStrips() {
assertEquals(1264 to 1820, einkScaledSize(2000, 2880, 1264))
// A double spread keeps its height (the short side) at panel width rather than shrinking to fit portrait.
assertEquals(1820 to 1264, einkScaledSize(2880, 2000, 1264))
// Webtoon strips stay readable: only the width is reduced.
assertEquals(1072 to 12864, einkScaledSize(1600, 19200, 1072))
}
@Test fun scalingNeverUpscales() {
assertEquals(800 to 1200, einkScaledSize(800, 1200, 1264))
assertEquals(1264 to 5000, einkScaledSize(1264, 5000, 1264))
}
@Test fun fullRefreshFiresOnEveryNthTurnAndZeroDisablesIt() {
assertFalse(einkFullRefreshDue(5, 6))
assertTrue(einkFullRefreshDue(6, 6))
assertTrue(einkFullRefreshDue(12, 6))
assertTrue(einkFullRefreshDue(1, 1))
assertFalse(einkFullRefreshDue(6, 0))
assertFalse(einkFullRefreshDue(0, 6))
}
}
composeApp/src/commonTest/kotlin/eu/friedcutlet/yokan/database/EmptySnapshot.kt
- Source · test / fixture · 19 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
3: internal fun emptySnapshot(settings: DbSettings = DbSettings()) = YokanDatabaseSnapshot(
Exact file bytes / download · SHA-256 7a888267a9f4b38388c3f1e9d71bea28256260b958e197fe621784386c4f1bc1.
Complete file
package eu.friedcutlet.yokan.database
internal fun emptySnapshot(settings: DbSettings = DbSettings()) = YokanDatabaseSnapshot(
settings = settings,
mangas = emptyList(),
chapters = emptyList(),
categories = emptyList(),
sources = emptyList(),
histories = emptyList(),
updates = emptyList(),
downloads = emptyList(),
tracks = emptyList(),
trackPreferences = emptyList(),
trackSearches = emptyList(),
syncPreferences = emptyList(),
changedParts = emptyList(),
customButtons = emptyList(),
pageCache = emptyList(),
)
composeApp/src/commonTest/kotlin/eu/friedcutlet/yokan/database/FeaturePreferencesCompatibilityTest.kt
- Source · test / fixture · 39 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
7: class FeaturePreferencesCompatibilityTest {
Exact file bytes / download · SHA-256 a994223f06b53dab7cb415d4b304113f77d3b10d21ad0b9df6f6746fe6e9ccb1.
Complete file
package eu.friedcutlet.yokan.database
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.jsonObject
import kotlin.test.*
class FeaturePreferencesCompatibilityTest {
@Test fun releasedSettingsDefaultToDisabledAutomation() {
val settings = DatabaseJson.decodeFromString<DbSettings>("""{"id":227,"downloadOnlyOnWifi":true}""")
assertTrue(settings.downloadOnlyOnWifi)
assertEquals(DbDownloadPolicy(), settings.features.downloads)
assertEquals(DbExternalDownloads(), settings.features.externalDownloads)
assertEquals(DbLibraryPreferences(), settings.features.library)
}
@Test fun homePrereleaseLayoutAndCredentialsSurviveGrouping() {
val settings = DatabaseJson.decodeFromString<DbSettings>("""{"home":{"filter":"Anime","showFeatured":false,"tmdbReadAccessToken":"user-owned","sourceFeeds":[{"sourceId":9}]}}""")
assertEquals(HomeMediaFilter.Anime, settings.home.filter)
assertFalse(settings.home.showFeatured)
assertEquals("user-owned", settings.home.tmdbReadAccessToken)
assertEquals(9L, settings.home.sourceFeeds.single().sourceId)
assertEquals(DbDownloadPolicy(), settings.features.downloads)
}
@Test fun groupedSettingsRoundTripAndOnlyWriteNewShape() {
val settings = DbSettings(features = DbFeaturePreferences(
home = DbHomePreferences(itemsPerShelf = 20),
downloads = DbDownloadPolicy(aheadAnime = 3, includeCategoryIds = setOf(42), consumedChapterIds = setOf(10)),
externalDownloads = DbExternalDownloads(PreferredDownloader.Aria2, "https://aria.example.org/jsonrpc", "device-token", "/downloads"),
library = DbLibraryPreferences(defaultCategoryIds = mapOf(DbItemType.Anime to 42L, DbItemType.Novel to 0L)),
))
val encoded = DatabaseJson.encodeToString(settings)
assertEquals(settings, DatabaseJson.decodeFromString<DbSettings>(encoded))
val obj = DatabaseJson.parseToJsonElement(encoded).jsonObject
assertTrue("features" in obj)
assertFalse("home" in obj)
assertTrue("downloads" in obj.getValue("features").jsonObject)
}
}
composeApp/src/commonTest/kotlin/eu/friedcutlet/yokan/database/LocalFoldersTest.kt
- Source · test / fixture · 19 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
6: class LocalFoldersTest {
8: fun virtualFolderMappingDoesNotInterpretOpaqueConfiguredPath() {
Exact file bytes / download · SHA-256 4be3eb63234cd7ec4134658327083d50fef851dbd9f30e26a54c562b79f54021.
Complete file
package eu.friedcutlet.yokan.database
import kotlin.test.Test
import kotlin.test.assertEquals
class LocalFoldersTest {
@Test
fun virtualFolderMappingDoesNotInterpretOpaqueConfiguredPath() {
val opaquePath = "bookmark://selected-folder/token"
val folder = DbLocalFolder("Library", opaquePath)
assertEquals("Library/Title/book.epub", getLocalVirtualPath(folder, "$opaquePath/Title/book.epub"))
assertEquals(
"Library/Title/book.epub",
localVirtualPathFromStoredPath("$opaquePath/Title/book.epub", listOf(folder)),
)
assertEquals("$opaquePath/Title/book.epub", resolveLocalArchivePath("Library/Title/book.epub", listOf(folder)))
}
}
composeApp/src/commonTest/kotlin/eu/friedcutlet/yokan/database/MangayomiDeletionRecorderTest.kt
- Source · test / fixture · 90 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
13: class MangayomiDeletionRecorderTest {
15: fun recordsAllSyncedEntityDeletionsForExactMappedNamespace() {
39: fun recordChangeFalseAndRemoteApplyDoNotCreateMangayomiDeletions() {
52: fun neverUploadedRowsQueueNoDeletionSoReAddingThemIsNotARecreation() {
65: fun localOnlyChangesRetainWatermarkAndIdZeroLooksUpNaturalIdBeforeTimestamping() {
77: fun snapshotReplacementRestampsOnlyLocalSyncedEditsAndRemoteReplacePreservesTimestamp() = runTest {
Exact file bytes / download · SHA-256 057d119971985cc525f0e81dd468dfce0c4e13360db0a9ec87cd2fa09545f046.
Complete file
package eu.friedcutlet.yokan.database
import eu.friedcutlet.yokan.database.sync.SyncPaths
import eu.friedcutlet.yokan.database.sync.SyncIds
import kotlinx.coroutines.test.runTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
class MangayomiDeletionRecorderTest {
@Test
fun recordsAllSyncedEntityDeletionsForExactMappedNamespace() {
val namespace = "https://sync.test/Case\nuser"
val preference = DbSyncPreference(syncId = 1, server = "HTTPS://SYNC.TEST/Case/", email = "user",
authToken = "session", serverProvider = SyncServerProvider.Mangayomi,
mangayomiIdMappings = """{"version":1,"namespaces":{"${namespace.replace("\n", "\\n")}":{${(1..6).joinToString(",") { """"$it":{"$it":{"canonical":${it * 100},"aliases":[]}}""" }}}}}""")
val db = InMemoryYokanDatabase(emptySnapshot().copy(
syncPreferences = listOf(preference),
categories = listOf(DbCategory(id = 1, name = "c", forItemType = DbItemType.Manga)),
mangas = listOf(DbManga(id = 2, name = "m")),
chapters = listOf(DbChapter(id = 3, mangaId = 2)),
tracks = listOf(DbTrack(id = 4, mangaId = 2, status = DbTrackStatus.Reading)),
histories = listOf(DbHistory(id = 5, mangaId = 2, chapterId = 3, itemType = DbItemType.Manga)),
updates = listOf(DbUpdate(id = 6, mangaId = 2)),
))
db.removeCategory(1); db.removeManga(2); db.removeChapter(3); db.removeTrack(4); db.removeHistory(5); db.removeUpdate(6)
val changes = db.changedParts().map { Json.parseToJsonElement(it.data).jsonObject }
.filter { it["provider"]?.jsonPrimitive?.content == "mangayomi" }
assertEquals(setOf(1, 2, 3, 4, 5, 6), changes.map { it["kind"]!!.jsonPrimitive.content.toInt() }.toSet())
assertTrue(changes.all { it["namespace"]?.jsonPrimitive?.content == namespace })
assertEquals(setOf("1", "2", "3", "4", "5", "6"), changes.map { it["localId"]!!.jsonPrimitive.content }.toSet())
assertTrue(changes.none { it["kind"]!!.jsonPrimitive.content.toInt() == SyncPaths.KIND_SETTINGS })
}
@Test
fun recordChangeFalseAndRemoteApplyDoNotCreateMangayomiDeletions() {
val db = InMemoryYokanDatabase(emptySnapshot().copy(
syncPreferences = listOf(DbSyncPreference(syncId = 1, server = "https://sync.test", email = "u", serverProvider = SyncServerProvider.Mangayomi,
mangayomiIdMappings = """{"version":1,"namespaces":{"https://sync.test\nu":{"2":{"8":{"canonical":80,"aliases":[]},"9":{"canonical":90,"aliases":[]}}}}}""")),
mangas = listOf(DbManga(id = 8, name = "remote")),
))
db.removeManga(8, recordChange = false)
db.upsertManga(DbManga(id = 9, name = "remote"))
db.applyRemote { db.removeManga(9) }
assertTrue(db.changedParts().isEmpty())
}
@Test
fun neverUploadedRowsQueueNoDeletionSoReAddingThemIsNotARecreation() {
val db = InMemoryYokanDatabase(emptySnapshot().copy(
syncPreferences = listOf(DbSyncPreference(syncId = 1, server = "https://sync.test", email = "u", serverProvider = SyncServerProvider.Mangayomi,
mangayomiIdMappings = """{"version":1,"namespaces":{"https://sync.test\nu":{"2":{"8":{"canonical":80,"aliases":[]}}}}}""")),
mangas = listOf(DbManga(id = 8, name = "uploaded"), DbManga(id = 9, name = "local only")),
))
db.removeManga(9)
assertTrue(db.changedParts().isEmpty())
db.removeManga(8)
assertEquals(listOf("8"), db.changedParts().map { Json.parseToJsonElement(it.data).jsonObject["localId"]!!.jsonPrimitive.content })
}
@Test
fun localOnlyChangesRetainWatermarkAndIdZeroLooksUpNaturalIdBeforeTimestamping() {
val base = DbManga(sourceId = 71, link = "https://source/title", name = "same", updatedAt = 100)
val id = SyncIds.forManga(base)!!
val preference = DbSyncPreference(syncId = 1, server = "https://sync.test", email = "user", serverProvider = SyncServerProvider.Mangayomi)
val db = InMemoryYokanDatabase(emptySnapshot().copy(syncPreferences = listOf(preference), mangas = listOf(base.copy(id = id))))
db.upsertManga(DbManga(sourceId = 71, link = base.link, name = "same", customCoverImage = byteArrayOf(1)))
assertEquals(100L, db.manga(id)?.updatedAt)
db.upsertManga(DbManga(sourceId = 71, link = base.link, name = "edited", updatedAt = 1))
assertTrue(db.manga(id)!!.updatedAt > 100L)
}
@Test
fun snapshotReplacementRestampsOnlyLocalSyncedEditsAndRemoteReplacePreservesTimestamp() = runTest {
val preference = DbSyncPreference(syncId = 1, server = "https://sync.test", email = "user", serverProvider = SyncServerProvider.Mangayomi)
val original = emptySnapshot().copy(syncPreferences = listOf(preference), mangas = listOf(DbManga(id = 15, name = "old", updatedAt = 20)))
val db = InMemoryYokanDatabase(original)
val localReplacement = db.snapshot().copy(mangas = listOf(DbManga(id = 15, name = "local edit", updatedAt = 1)))
db.replaceAll(localReplacement, db.snapshot())
val localAt = db.manga(15)!!.updatedAt
assertTrue(localAt > 20)
val remote = db.snapshot().copy(mangas = listOf(DbManga(id = 15, name = "remote", updatedAt = 10)))
db.replaceAllRemoteAtomically(remote, db.snapshot())
assertEquals(10L, db.manga(15)?.updatedAt)
}
}
composeApp/src/commonTest/kotlin/eu/friedcutlet/yokan/database/PageCacheTest.kt
- Source · test / fixture · 36 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
7: class PageCacheTest {
9: fun keepsTheMostRecentlyWrittenListsAndDropsADeletedChaptersList() {
25: fun removingAndClearingDropListsAndPublishTheSnapshot() {
Exact file bytes / download · SHA-256 0a84260e039b238a417e379ff35e10fb2e729ef8a0352841c0960d60b579ee4e.
Complete file
package eu.friedcutlet.yokan.database
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
class PageCacheTest {
@Test
fun keepsTheMostRecentlyWrittenListsAndDropsADeletedChaptersList() {
val db = InMemoryYokanDatabase(emptySnapshot())
(1L..MAX_PAGE_CACHE + 1L).forEach { db.upsertPageCache(DbChapterPageUrls(chapterId = it, urls = listOf("p$it"))) }
assertTrue(db.pageCache(1L).isEmpty(), "the oldest list is evicted")
db.upsertPageCache(DbChapterPageUrls(chapterId = 2L, urls = listOf("p2 again"))) // a rewrite makes it the newest
db.upsertPageCache(DbChapterPageUrls(chapterId = 1_000L, urls = listOf("new")))
assertEquals(listOf("p2 again"), db.pageCache(2L).single().urls)
assertTrue(db.pageCache(3L).isEmpty())
assertEquals(MAX_PAGE_CACHE, db.pageCache().size)
db.removeChapter(1_000L)
assertTrue(db.pageCache(1_000L).isEmpty(), "a deleted chapter's page list goes with it")
}
@Test
fun removingAndClearingDropListsAndPublishTheSnapshot() {
val db = InMemoryYokanDatabase(emptySnapshot())
(1L..3L).forEach { db.upsertPageCache(DbChapterPageUrls(chapterId = it, urls = listOf("p$it"))) }
db.removePageCache(listOf(1L, 3L, 99L))
assertEquals(listOf(2L), db.snapshots().value.pageCache.map { it.chapterId })
db.clearPageCache()
assertTrue(db.pageCache().isEmpty())
assertTrue(db.snapshots().value.pageCache.isEmpty(), "persistence observes the snapshot")
}
}
composeApp/src/commonTest/kotlin/eu/friedcutlet/yokan/database/PrivacyPreferencesTest.kt
- Source · test / fixture · 60 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
15: class PrivacyPreferencesTest {
16: private fun settings(privacy: DbPrivacyPreferences, incognito: Boolean = false) =
47: override fun supported() = true
48: override fun notify(payload: NotificationPayload) { sent += payload }
49: override fun cancel(channel: NotificationChannel, tag: String?) = Unit
Exact file bytes / download · SHA-256 287fac7f3d4452e13a082505c808b485563ed79d3e2d8c7a4e2b0f6c938a0adc.
Complete file
package eu.friedcutlet.yokan.database
import eu.friedcutlet.yokan.domain.ProfileId
import eu.friedcutlet.yokan.services.discord.DiscordPresenceRequest
import eu.friedcutlet.yokan.services.discord.discordActivity
import eu.friedcutlet.yokan.services.notifications.NotificationChannel
import eu.friedcutlet.yokan.services.notifications.NotificationPayload
import eu.friedcutlet.yokan.services.notifications.NotificationService
import eu.friedcutlet.yokan.services.notifications.ProfileNotificationService
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
class PrivacyPreferencesTest {
private fun settings(privacy: DbPrivacyPreferences, incognito: Boolean = false) =
DbSettings(incognitoMode = incognito, features = DbSettings().features.copy(privacy = privacy))
@Test fun incognitoSourcesAreIncognitoOnlyForTheirTitles() {
val s = settings(DbPrivacyPreferences(incognitoSourceIds = setOf(7)))
assertTrue(s.isIncognitoFor(7))
assertFalse(s.isIncognitoFor(8))
assertFalse(s.isIncognitoFor(null))
assertTrue(settings(DbPrivacyPreferences(), incognito = true).isIncognitoFor(8))
// Discord shows only the idle activity for an incognito source.
assertEquals("Idle", discordActivity(s, DiscordPresenceRequest("T", "Ch 1", null, false, sourceId = 7), 0)!!.details)
assertEquals("Reading T", discordActivity(s, DiscordPresenceRequest("T", "Ch 1", null, false, sourceId = 8), 0)!!.details)
}
@Test fun secureScreenFollowsMode() {
assertFalse(settings(DbPrivacyPreferences()).secureScreenActive())
assertFalse(settings(DbPrivacyPreferences(secureScreen = DbSecureScreen.Incognito)).secureScreenActive())
assertTrue(settings(DbPrivacyPreferences(secureScreen = DbSecureScreen.Incognito), incognito = true).secureScreenActive())
assertTrue(settings(DbPrivacyPreferences(secureScreen = DbSecureScreen.Always)).secureScreenActive())
}
@Test fun lockTimeoutBoundaries() {
assertTrue(appLockDue(0, 1_000, 1_000))
assertFalse(appLockDue(1, 0, 59_999))
assertTrue(appLockDue(1, 0, 60_000))
assertFalse(appLockDue(-1, 0, Long.MAX_VALUE))
}
@Test fun hiddenNotificationContentDropsTitlesButKeepsTag() {
val sent = mutableListOf<NotificationPayload>()
val delegate = object : NotificationService {
override fun supported() = true
override fun notify(payload: NotificationPayload) { sent += payload }
override fun cancel(channel: NotificationChannel, tag: String?) = Unit
}
var hide = true
val service = ProfileNotificationService(ProfileId.Default, delegate, hideContent = { hide }) { true }
service.notify(NotificationPayload(NotificationChannel.Downloads, "One Piece", "Chapter 1000", tag = "t"))
hide = false
service.notify(NotificationPayload(NotificationChannel.Downloads, "One Piece", "Chapter 1000", tag = "t"))
assertEquals(listOf("Yokan", "One Piece"), sent.map { it.title })
assertEquals("Download activity", sent[0].message)
assertEquals("t", sent[0].tag)
}
}
composeApp/src/commonTest/kotlin/eu/friedcutlet/yokan/database/SnapshotYokanDatabaseTest.kt
- Source · test / fixture · 113 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
6: class SnapshotYokanDatabaseTest {
7: private class Store : DatabaseSnapshotStore {
12: override fun load() = saved
13: override fun save(snapshot: YokanDatabaseSnapshot) {
22: fun inMemoryReplacementRejectsStaleExpectedSnapshotWithoutPublication() {
35: fun snapshotReplacementRejectsStaleExpectedSnapshot() {
48: fun failedSaveRetainsLatestChangesForRetry() {
63: fun replacementCommitsBeforePublishingAndFailureCannotBeRetriedAccidentally() = runTest {
83: fun failedNonExceptionSaveRetainsCurrentMemoryForRetry() {
96: fun persistIfDirtySkipsUnchangedStateButKeepsRetryingAfterFailure() = runTest {
Exact file bytes / download · SHA-256 70156cec1ec207ad09106361853d6e88869475b2de01886fb300284051fc0239.
Complete file
package eu.friedcutlet.yokan.database
import kotlinx.coroutines.test.runTest
import kotlin.test.*
class SnapshotYokanDatabaseTest {
private class Store : DatabaseSnapshotStore {
var saved = seedDatabaseSnapshot()
var reject = false
var failure: Throwable? = null
var saves = 0
override fun load() = saved
override fun save(snapshot: YokanDatabaseSnapshot) {
check(!reject) { "Storage full" }
failure?.let { throw it }
saved = snapshot
saves++
}
}
@Test
fun inMemoryReplacementRejectsStaleExpectedSnapshotWithoutPublication() {
val database = InMemoryYokanDatabase()
val expected = database.snapshot()
val before = database.snapshots().value
database.upsertManga(DbManga(id = 1, name = "changed"))
assertFailsWith<SnapshotReplacementConflictException> {
database.replaceAll(seedDatabaseSnapshot(), expected)
}
assertEquals("changed", database.manga(1)?.name)
assertNotEquals(before, database.snapshots().value)
}
@Test
fun snapshotReplacementRejectsStaleExpectedSnapshot() {
val store = Store()
val database = SnapshotYokanDatabase(store)
val expected = database.snapshot()
database.upsertManga(DbManga(id = 1, name = "changed"))
assertFailsWith<SnapshotReplacementConflictException> {
database.replaceAll(seedDatabaseSnapshot(), expected)
}
assertEquals("changed", database.manga(1)?.name)
assertEquals(expected, store.saved)
}
@Test
fun failedSaveRetainsLatestChangesForRetry() {
val store = Store()
val database = SnapshotYokanDatabase(store)
store.reject = true
database.upsertManga(DbManga(id = 1, name = "Unsaved"))
assertFalse(database.persist())
assertTrue(database.saveFailed.value)
database.upsertManga(DbManga(id = 1, name = "Latest"))
store.reject = false
assertTrue(database.persist())
assertFalse(database.saveFailed.value)
assertEquals("Latest", SnapshotYokanDatabase(store).manga(1)?.name)
}
@Test
fun replacementCommitsBeforePublishingAndFailureCannotBeRetriedAccidentally() = runTest {
val store = Store()
val database = SnapshotYokanDatabase(store)
val replacement = store.saved.copy(mangas = listOf(DbManga(id = 5, name = "Restored")))
val before = database.snapshots().value
store.reject = true
assertFailsWith<IllegalStateException> { database.replaceAllAtomically(replacement, null) }
assertNull(database.manga(5))
assertEquals(before, database.snapshots().value)
store.reject = false
database.persist()
assertNull(SnapshotYokanDatabase(store).manga(5))
database.replaceAllAtomically(replacement, null)
assertEquals(replacement, database.snapshot())
assertEquals(replacement, SnapshotYokanDatabase(store).snapshot())
database.persist() // A delayed pre-restore emission must only save current state.
assertEquals(replacement, store.saved)
}
@Test
fun failedNonExceptionSaveRetainsCurrentMemoryForRetry() {
val store = Store()
val database = SnapshotYokanDatabase(store)
database.upsertManga(DbManga(id = 2, name = "retry"))
store.failure = object : Error("storage failure") {}
assertFalse(database.persist())
assertTrue(database.saveFailed.value)
store.failure = null
assertTrue(database.persist())
assertEquals("retry", SnapshotYokanDatabase(store).manga(2)?.name)
}
@Test
fun persistIfDirtySkipsUnchangedStateButKeepsRetryingAfterFailure() = runTest {
val store = Store()
val database = SnapshotYokanDatabase(store)
assertTrue(database.persistIfDirty())
assertTrue(database.persistIfDirty())
assertEquals(1, store.saves)
store.reject = true
database.upsertManga(DbManga(id = 3, name = "pending"))
assertFalse(database.persistIfDirty())
store.reject = false
assertTrue(database.persistIfDirty())
assertEquals(2, store.saves)
assertEquals("pending", SnapshotYokanDatabase(store).manga(3)?.name)
database.replaceAllAtomically(store.saved.copy(mangas = emptyList()), null)
assertTrue(database.persistIfDirty()) // The restore already wrote this state.
assertEquals(3, store.saves)
}
}
composeApp/src/desktopMain/kotlin/eu/friedcutlet/yokan/database/PersistentDatabase.desktop.kt
- Source · implementation · 20 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
6: actual fun createDefaultDatabaseSnapshotStore(): DatabaseSnapshotStore = DesktopDatabaseSnapshotStore()
8: private class DesktopDatabaseSnapshotStore : DatabaseSnapshotStore {
11: override fun load(): YokanDatabaseSnapshot? = file
16: override fun save(snapshot: YokanDatabaseSnapshot) {
Exact file bytes / download · SHA-256 3c36e141b3b8b21c15e15c17bbdad0acffd83f5526c7f4465c2fc123c5824e6c.
Complete file
package eu.friedcutlet.yokan.database
import eu.friedcutlet.yokan.services.files.desktopDataRoot
import java.io.File
actual fun createDefaultDatabaseSnapshotStore(): DatabaseSnapshotStore = DesktopDatabaseSnapshotStore()
private class DesktopDatabaseSnapshotStore : DatabaseSnapshotStore {
private val file: File by lazy { File(desktopDataRoot, "yokan-database-v1.json") }
override fun load(): YokanDatabaseSnapshot? = file
.takeIf { it.exists() }
?.readText()
?.let(::decodeDatabaseSnapshot)
override fun save(snapshot: YokanDatabaseSnapshot) {
file.parentFile?.mkdirs()
file.writeText(encodeDatabaseSnapshot(snapshot))
}
}
composeApp/src/desktopMain/kotlin/eu/friedcutlet/yokan/database/room/YokanRoomDatabase.desktop.kt
- Source · implementation · 15 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
7: actual fun createYokanRoomDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanRoomDatabase {
11: internal fun createDesktopProfileRoomDatabase(dataRoot: File, profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanRoomDatabase {
Exact file bytes / download · SHA-256 bcb3e710ad4f44edf4048c3cea34851296d3a9e6344f02262c475f5383e2ff0d.
Complete file
package eu.friedcutlet.yokan.database.room
import androidx.room.Room
import eu.friedcutlet.yokan.services.files.desktopDataRoot
import java.io.File
actual fun createYokanRoomDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanRoomDatabase {
return createDesktopProfileRoomDatabase(desktopDataRoot, profileId)
}
internal fun createDesktopProfileRoomDatabase(dataRoot: File, profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanRoomDatabase {
val dbFile = File(dataRoot, eu.friedcutlet.yokan.domain.ProfileStorageNamespace(profileId).databaseRelativePath)
check(dbFile.parentFile.isDirectory || dbFile.parentFile.mkdirs()) { "Database directory unavailable" }
return Room.databaseBuilder<YokanRoomDatabase>(name = dbFile.absolutePath).buildYokanRoom()
}
composeApp/src/desktopTest/kotlin/eu/friedcutlet/yokan/database/room/CastStorageTest.kt
- Source · test / fixture · 78 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
14: class CastStorageTest {
18: fun open() = RoomYokanDatabase(Room.databaseBuilder<YokanRoomDatabase>(name = path).buildYokanRoom())
19: fun writes(): Long = BundledSQLiteDriver().open(path).use { connection ->
Exact file bytes / download · SHA-256 1e18acf749920cd44db1151ebaa13ffbc828a4b43e4e7bd8807159055be0e49d.
Complete file
package eu.friedcutlet.yokan.database.room
import androidx.room.Room
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
import androidx.sqlite.execSQL
import eu.friedcutlet.yokan.database.*
import eu.friedcutlet.yokan.domain.TitleCredit
import java.io.File
import java.nio.file.Files
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.json.*
import kotlin.test.*
class CastStorageTest {
@Test fun version14UpgradeKeepsProgressAndNormalizedCreditsAvoidProgressWriteAmplification() = runBlocking {
val directory = Files.createTempDirectory("yokan-cast-storage")
val path = directory.resolve("yokan.db").toString()
fun open() = RoomYokanDatabase(Room.databaseBuilder<YokanRoomDatabase>(name = path).buildYokanRoom())
fun writes(): Long = BundledSQLiteDriver().open(path).use { connection ->
connection.prepare("SELECT count FROM test_credit_writes").use { statement ->
check(statement.step()); statement.getLong(0)
}
}
try {
val schema = DatabaseJson.parseToJsonElement(File("schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/14.json").readText())
.jsonObject.getValue("database").jsonObject
BundledSQLiteDriver().open(path).use { connection ->
for (entity in schema.getValue("entities").jsonArray) {
val row = entity.jsonObject
val table = row.getValue("tableName").jsonPrimitive.content
connection.execSQL(row.getValue("createSql").jsonPrimitive.content.replace("\${TABLE_NAME}", table))
row["indices"]?.jsonArray.orEmpty().forEach { connection.execSQL(it.jsonObject.getValue("createSql").jsonPrimitive.content.replace("\${TABLE_NAME}", table)) }
}
schema.getValue("setupQueries").jsonArray.forEach { connection.execSQL(it.jsonPrimitive.content) }
connection.execSQL("INSERT INTO manga(id,name,link,status,itemType,favorite,lastRead,isLocalArchive,updatedAt,privateNote) VALUES(1,'Show','/show','Licensed','Anime',1,123,1,1,'Saved note')")
connection.execSQL("INSERT INTO chapter(id,mangaId,name,url,dateUpload,scanlator,isBookmarked,isRead,lastPageRead,archivePath,isFiller,updatedAt,fetchedAt) VALUES(2,1,'Episode 1','/episode','','',1,1,'2345','/offline/file',0,1,1)")
connection.execSQL("PRAGMA user_version = 14")
}
val cast = List(500) { TitleCredit("Actor $it", "Voice actor", "Character $it") }
val first = open()
try {
val original = requireNotNull(first.manga(1))
assertEquals(emptyList(), original.cast)
assertEquals(DbStatus.Licensed, original.status)
first.upsertManga(original.copy(cast = cast))
first.awaitPersistence()
BundledSQLiteDriver().open(path).use { connection ->
connection.execSQL("CREATE TABLE test_credit_writes(count INTEGER NOT NULL)")
connection.execSQL("INSERT INTO test_credit_writes VALUES(0)")
connection.execSQL("CREATE TRIGGER test_credit_insert AFTER INSERT ON manga_credit BEGIN UPDATE test_credit_writes SET count=count+1; END")
connection.execSQL("CREATE TRIGGER test_credit_delete AFTER DELETE ON manga_credit BEGIN UPDATE test_credit_writes SET count=count+1; END")
}
repeat(3) { first.upsertManga(requireNotNull(first.manga(1)).copy(lastRead = 200L + it)) }
first.awaitPersistence()
assertEquals(0L, writes(), "Reading progress must not delete/reinsert 500 credits")
first.upsertManga(requireNotNull(first.manga(1)).copy(cast = cast.drop(1)))
first.awaitPersistence()
assertTrue(writes() > 0)
} finally { first.close() }
val second = open()
try {
assertEquals(cast.drop(1), second.manga(1)?.cast)
assertEquals("Saved note", second.manga(1)?.privateNote)
assertEquals(202L, second.manga(1)?.lastRead)
assertEquals("2345", second.chapter(2)?.lastPageRead)
val snapshot = second.snapshot()
second.replaceAllAtomically(snapshot.copy(mangas = listOf(requireNotNull(second.manga(1)).copy(cast = cast.reversed()))), snapshot)
} finally { second.close() }
val third = open()
try {
assertEquals(cast.reversed(), third.manga(1)?.cast)
third.removeManga(1)
third.awaitPersistence()
assertEquals(emptyList(), third.room.mangaCreditDao().all(), "Deleting a title removes its owned credits")
} finally { third.close() }
} finally { directory.toFile().deleteRecursively() }
}
}
composeApp/src/desktopTest/kotlin/eu/friedcutlet/yokan/database/room/EpisodeNumberMigrationTest.kt
- Source · test / fixture · 65 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
13: class EpisodeNumberMigrationTest {
Exact file bytes / download · SHA-256 288747228486ac3c805dad1b3f57e5626b1f56374e01834f4ecf76899d1070a8.
Complete file
package eu.friedcutlet.yokan.database.room
import androidx.room.Room
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
import androidx.sqlite.execSQL
import eu.friedcutlet.yokan.database.*
import java.io.File
import java.nio.file.Files
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.json.*
import kotlin.test.*
class EpisodeNumberMigrationTest {
@Test fun version13UpgradeKeepsProgressAndNullableNumberingSurvivesReopen() {
val directory = Files.createTempDirectory("yokan-episode-number-migration")
val path = directory.resolve("yokan.db").toString()
try {
val schema = DatabaseJson.parseToJsonElement(File("schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/13.json").readText())
.jsonObject.getValue("database").jsonObject
BundledSQLiteDriver().open(path).use { connection ->
schema.getValue("entities").jsonArray.forEach { value ->
val entity = value.jsonObject
val table = entity.getValue("tableName").jsonPrimitive.content
connection.execSQL(entity.getValue("createSql").jsonPrimitive.content.replace("\${TABLE_NAME}", table))
entity["indices"]?.jsonArray.orEmpty().forEach { index ->
connection.execSQL(index.jsonObject.getValue("createSql").jsonPrimitive.content.replace("\${TABLE_NAME}", table))
}
}
schema.getValue("setupQueries").jsonArray.forEach { connection.execSQL(it.jsonPrimitive.content) }
connection.execSQL("INSERT INTO manga(id,name,link,status,itemType,favorite,lastRead,isLocalArchive,updatedAt,privateNote) VALUES(1,'Show','/title','Ongoing','Anime',1,123,1,321,'Saved note')")
connection.execSQL("INSERT INTO chapter(id,mangaId,name,url,dateUpload,scanlator,isBookmarked,isRead,lastPageRead,archivePath,isFiller,updatedAt,fetchedAt) VALUES(2,1,'Episode 12.5','/episode','2026-01-01','Group',1,1,'1200','/offline/file',1,456,789)")
connection.execSQL("INSERT INTO settings(id,json) VALUES(1,'{\"mangaGridSize\":4}')")
connection.execSQL("PRAGMA user_version = 13")
}
val room = Room.databaseBuilder<YokanRoomDatabase>(name = path).buildYokanRoom()
try {
runBlocking(roomPersistenceDispatcher) {
val chapter = room.chapterDao().all().single().toDb()
assertNull(chapter.number)
assertNull(chapter.season)
assertNull(chapter.numberingName)
assertEquals("1200", chapter.lastPageRead)
assertTrue(chapter.isRead && chapter.isBookmarked && chapter.isFiller)
assertEquals("/offline/file", chapter.archivePath)
assertEquals(789L, chapter.fetchedAt)
assertEquals("Saved note", room.mangaDao().all().single().toDb().privateNote)
assertEquals(4, room.settingsDao().get()?.toDb()?.mangaGridSize)
room.chapterDao().upsert(chapter.copy(name = "A custom title", number = 12.5, season = 2, numberingName = "Episode 12.5 [en]").toRow())
}
} finally { room.close() }
val reopened = Room.databaseBuilder<YokanRoomDatabase>(name = path).buildYokanRoom()
try {
runBlocking(roomPersistenceDispatcher) {
val chapter = reopened.chapterDao().all().single().toDb()
assertEquals(12.5, chapter.number)
assertEquals(2, chapter.season)
assertEquals("Episode 12.5 [en]", chapter.numberingName)
assertEquals("A custom title", chapter.name)
assertEquals("1200", chapter.lastPageRead)
assertTrue(chapter.isRead && chapter.isBookmarked && chapter.isFiller)
}
} finally { reopened.close() }
} finally { directory.toFile().deleteRecursively() }
}
}
composeApp/src/desktopTest/kotlin/eu/friedcutlet/yokan/database/room/LibraryDatesMigrationTest.kt
- Source · test / fixture · 67 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
13: class LibraryDatesMigrationTest {
Exact file bytes / download · SHA-256 7c0ff10eb2943fa76bae626efc5e96056a7fbc9872c0590dd77f42d4722fbbbe.
Complete file
package eu.friedcutlet.yokan.database.room
import androidx.room.Room
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
import androidx.sqlite.execSQL
import eu.friedcutlet.yokan.database.*
import java.io.File
import java.nio.file.Files
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.json.*
import kotlin.test.*
class LibraryDatesMigrationTest {
@Test fun version12UpgradesWithoutChangingProgressAndNewDatesSurviveReopen() {
val directory = Files.createTempDirectory("yokan-library-dates-migration")
val path = directory.resolve("yokan.db").toString()
try {
val schema = DatabaseJson.parseToJsonElement(File("schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/12.json").readText())
.jsonObject.getValue("database").jsonObject
BundledSQLiteDriver().open(path).use { connection ->
schema.getValue("entities").jsonArray.forEach { value ->
val entity = value.jsonObject
val table = entity.getValue("tableName").jsonPrimitive.content
connection.execSQL(entity.getValue("createSql").jsonPrimitive.content.replace("\${TABLE_NAME}", table))
entity["indices"]?.jsonArray.orEmpty().forEach { index ->
connection.execSQL(index.jsonObject.getValue("createSql").jsonPrimitive.content.replace("\${TABLE_NAME}", table))
}
}
schema.getValue("setupQueries").jsonArray.forEach { connection.execSQL(it.jsonPrimitive.content) }
connection.execSQL("INSERT INTO manga(id,name,link,status,itemType,favorite,lastRead,isLocalArchive,updatedAt,privateNote) VALUES(1,'Saved title','/title','Ongoing','Anime',1,123,0,321,'Saved note')")
connection.execSQL("INSERT INTO chapter(id,mangaId,name,url,dateUpload,scanlator,isBookmarked,isRead,lastPageRead,archivePath,isFiller,updatedAt) VALUES(2,1,'Episode 1','/episode','2026-01-01','Group',1,1,'7','/offline/file',0,456)")
connection.execSQL("INSERT INTO settings(id,json) VALUES(1,'{\"mangaGridSize\":4}')")
connection.execSQL("PRAGMA user_version = 12")
}
val room = Room.databaseBuilder<YokanRoomDatabase>(name = path).buildYokanRoom()
try {
runBlocking(roomPersistenceDispatcher) {
val chapter = room.chapterDao().all().single().toDb()
val title = room.mangaDao().all().single().toDb()
assertEquals(0L, chapter.fetchedAt)
assertEquals(0L, title.nextEpisodeAiringAt)
assertNull(title.nextEpisodeNumber)
assertEquals("7", chapter.lastPageRead)
assertTrue(chapter.isRead)
assertTrue(chapter.isBookmarked)
assertEquals("/offline/file", chapter.archivePath)
assertEquals("Saved note", title.privateNote)
assertEquals(4, room.settingsDao().get()?.toDb()?.mangaGridSize)
room.chapterDao().upsert(chapter.copy(fetchedAt = 1_800_000_000_000).toRow())
room.mangaDao().upsert(title.copy(nextEpisodeAiringAt = 1_800_000_100_000,
nextEpisodeNumber = 12, airingScheduleUpdatedAt = 1_800_000_000_000).toRow())
}
} finally { room.close() }
val reopened = Room.databaseBuilder<YokanRoomDatabase>(name = path).buildYokanRoom()
try {
runBlocking(roomPersistenceDispatcher) {
assertEquals(1_800_000_000_000, reopened.chapterDao().all().single().toDb().fetchedAt)
val title = reopened.mangaDao().all().single().toDb()
assertEquals(1_800_000_100_000, title.nextEpisodeAiringAt)
assertEquals(12, title.nextEpisodeNumber)
assertEquals(1_800_000_000_000, title.airingScheduleUpdatedAt)
assertEquals("Saved note", title.privateNote)
}
} finally { reopened.close() }
} finally { directory.toFile().deleteRecursively() }
}
}
composeApp/src/desktopTest/kotlin/eu/friedcutlet/yokan/database/room/RoomRecipeInstallationStoreTest.kt
- Source · test / fixture · 268 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
35: class RoomRecipeInstallationStoreTest {
40: fun v5FixtureMigratesAndRecipeSourcePersistsAcrossReopen() = runBlocking {
91: fun casClockQuotaAndCorruptionFailClosed() = runBlocking {
120: fun explicitSourceRemovalAtomicallyRemovesOnlySelectedInstallAndPreservesTrustAndReplay() = runBlocking {
157: fun explicitSourceRemovalRollsBackInstallAndDelegateOnReplacementFailure() = runBlocking {
182: fun explicitSourceRemovalRejectsConcurrentRecipeSourceInventoryChange() = runBlocking {
204: private fun policy(validUntil: Long? = null): CatalogTrustPolicy = CatalogTrustPolicy(
209: private fun candidate(
228: private fun openRoom(path: String): YokanRoomDatabase = Room.databaseBuilder<YokanRoomDatabase>(name = path).buildYokanRoom()
230: private suspend fun primeYokanDatabase(room: YokanRoomDatabase) {
234: private fun createV5Fixture(path: String) {
256: private suspend fun withRoom(block: suspend (String, YokanRoomDatabase) -> Unit) {
Exact file bytes / download · SHA-256 477d7def9270f0c8faf79fbc29e3945dc6b8b1e9d62717325d7fffeaff85b983.
Complete file
package eu.friedcutlet.yokan.database.room
import androidx.room.Room
import eu.friedcutlet.yokan.services.extensions.recipe.TestClock
import androidx.room.useWriterConnection
import androidx.sqlite.execSQL
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
import eu.friedcutlet.yokan.services.extensions.recipe.CatalogAcceptanceState
import eu.friedcutlet.yokan.services.extensions.recipe.CatalogSnapshotGeneration
import eu.friedcutlet.yokan.services.extensions.recipe.CatalogTrustPolicy
import eu.friedcutlet.yokan.services.extensions.recipe.InstalledRecipeRecord
import eu.friedcutlet.yokan.services.extensions.recipe.RecipeCatalogEnrollmentResult
import eu.friedcutlet.yokan.services.extensions.recipe.RecipeInstallCandidate
import eu.friedcutlet.yokan.services.extensions.recipe.RecipeInstallCommitResult
import eu.friedcutlet.yokan.services.extensions.recipe.RecipeInstallationClock
import eu.friedcutlet.yokan.services.extensions.recipe.RecipeInstallationStoreLimits
import eu.friedcutlet.yokan.services.extensions.recipe.TrustedCatalogKey
import eu.friedcutlet.yokan.services.extensions.recipe.TrustedCatalogKeyState
import eu.friedcutlet.yokan.services.extensions.recipe.recipeSourceId
import eu.friedcutlet.yokan.services.extensions.recipe.recipeSourceReference
import eu.friedcutlet.yokan.database.SnapshotReplacementConflictException
import eu.friedcutlet.yokan.database.seedDatabaseSnapshot
import java.io.File
import java.nio.file.Files
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertNull
import kotlinx.coroutines.runBlocking
class RoomRecipeInstallationStoreTest {
private val catalogId = "catalog.primary"
private val now = 1_700_000_000L
@Test
fun v5FixtureMigratesAndRecipeSourcePersistsAcrossReopen() = runBlocking {
val migrationDirectory = Files.createTempDirectory("yokan-recipe-v5")
val migrationPath = migrationDirectory.resolve("yokan.db").toString()
try {
createV5Fixture(migrationPath)
val migrated = openRoom(migrationPath)
try {
assertEquals(listOf(77L), migrated.mangaDao().all().map { it.id })
assertEquals(emptyList(), migrated.recipeInstallationDao().allCheckpoints())
assertEquals(emptyList(), migrated.recipeInstallationDao().trustKeys("catalog.primary"))
assertEquals(emptyList(), migrated.recipeInstallationDao().installed("catalog.primary"))
} finally {
migrated.close()
}
} finally {
migrationDirectory.toFile().deleteRecursively()
}
withRoom { path, room ->
val clock = TestClock(now)
val store = RoomRecipeInstallationStore(room, clock)
val policy = policy()
assertEquals(RecipeCatalogEnrollmentResult.Created, store.enrollIfAbsent(catalogId, policy))
assertEquals(RecipeCatalogEnrollmentResult.AlreadyExists, store.enrollIfAbsent(catalogId, policy.copy(trustedKeys = listOf(policy.trustedKeys.single().copy(keyId = "replacement")))))
val before = store.readCatalog(catalogId)!!
val stale = candidate(before, 11)
assertEquals(RecipeInstallCommitResult.Applied, store.commitInstall(before.generation, candidate(before, 10, release = "a".repeat(80), digest = "a".repeat(64))))
assertEquals(RecipeInstallCommitResult.Conflict, store.commitInstall(before.generation, stale))
room.close()
val reopened = openRoom(path)
try {
val restored = RoomRecipeInstallationStore(reopened, clock).readCatalog(catalogId)!!
assertEquals(1, restored.generation.value)
assertEquals(10, restored.acceptanceState!!.highestRevision)
assertEquals(listOf("recipe.one"), restored.installedRecords.keys.toList())
val sourceId = recipeSourceId(catalogId, "recipe.one")
assertEquals(sourceId, restored.installedRecords.getValue("recipe.one").sourceId)
assertEquals("Recipe", reopened.sourceDao().source(sourceId)?.typeSource)
assertEquals(recipeSourceReference(catalogId, "recipe.one"), reopened.sourceDao().source(sourceId)?.additionalParams)
assertEquals(true, reopened.sourceDao().source(sourceId)?.isAdded, "installed recipes must be listed in Browse")
assertEquals("a".repeat(80), restored.installedRecords.getValue("recipe.one").releaseVersion)
assertEquals("a".repeat(64), restored.installedRecords.getValue("recipe.one").sha256)
assertEquals(policy.trustedKeys.single().rawEd25519PublicKey.toList(), restored.trustPolicy.trustedKeys.single().rawEd25519PublicKey.toList())
} finally {
reopened.close()
}
}
}
@Test
fun casClockQuotaAndCorruptionFailClosed() = runBlocking {
withRoom { _, room ->
val clock = TestClock(now)
val store = RoomRecipeInstallationStore(room, clock, RecipeInstallationStoreLimits(2, 2, 1, 1))
assertEquals(RecipeCatalogEnrollmentResult.Created, store.enrollIfAbsent(catalogId, policy(validUntil = now)))
val initial = store.readCatalog(catalogId)!!
clock.value = now + 1
assertEquals(RecipeInstallCommitResult.Rejected, store.commitInstall(initial.generation, candidate(initial, 10, artifact = byteArrayOf(1))))
assertNull(store.readCatalog(catalogId)!!.acceptanceState)
assertEquals(0, store.readCatalog(catalogId)!!.generation.value)
}
withRoom { _, room ->
val quotaStore = RoomRecipeInstallationStore(room, TestClock(now), RecipeInstallationStoreLimits(2, 2, 1, 1))
assertEquals(RecipeCatalogEnrollmentResult.Created, quotaStore.enrollIfAbsent(catalogId, policy()))
val quotaInitial = quotaStore.readCatalog(catalogId)!!
assertEquals(RecipeInstallCommitResult.Rejected, quotaStore.commitInstall(quotaInitial.generation, candidate(quotaInitial, 10, artifact = byteArrayOf(1, 2))))
assertNull(quotaStore.readCatalog(catalogId)!!.acceptanceState)
assertEquals(0, quotaStore.readCatalog(catalogId)!!.generation.value)
}
withRoom { _, room ->
room.recipeInstallationDao().insertCheckpoint(RecipeCatalogCheckpointRow("corrupt.catalog", 0))
assertFailsWith<IllegalStateException> { RoomRecipeInstallationStore(room, TestClock(now)).readCatalog("corrupt.catalog") }
}
}
@Test
fun explicitSourceRemovalAtomicallyRemovesOnlySelectedInstallAndPreservesTrustAndReplay() = runBlocking {
withRoom { path, room ->
val clock = TestClock(now)
val store = RoomRecipeInstallationStore(room, clock)
store.enrollIfAbsent(catalogId, policy())
val first = store.readCatalog(catalogId)!!
store.commitInstall(first.generation, candidate(first, 10, stableId = "selected"))
val second = store.readCatalog(catalogId)!!
store.commitInstall(second.generation, candidate(second, 11, stableId = "retained"))
val before = store.readCatalog(catalogId)!!
val selectedId = recipeSourceId(catalogId, "selected")
val retainedId = recipeSourceId(catalogId, "retained")
primeYokanDatabase(room)
val database = RoomYokanDatabase(room)
val replacement = database.snapshot().copy(sources = database.sources().filterNot { it.id == selectedId })
database.replaceAllAtomically(replacement, database.snapshot(), setOf(selectedId))
assertEquals(listOf("retained"), store.readCatalog(catalogId)!!.installedRecords.keys.toList())
room.close()
val reopened = openRoom(path)
try {
val restored = RoomRecipeInstallationStore(reopened, clock).readCatalog(catalogId)!!
assertEquals(before.generation.value + 1, restored.generation.value)
assertEquals(11, restored.acceptanceState!!.highestRevision)
assertEquals(listOf("retained"), restored.installedRecords.keys.toList())
assertEquals(before.trustPolicy.trustedKeys.single().rawEd25519PublicKey.toList(), restored.trustPolicy.trustedKeys.single().rawEd25519PublicKey.toList())
assertNull(reopened.sourceDao().source(selectedId))
assertEquals(retainedId, reopened.sourceDao().source(retainedId)?.id)
assertEquals(seedDatabaseSnapshot().sources.map { it.id }.toSet() + retainedId, reopened.sourceDao().all().map { it.id }.toSet())
} finally {
reopened.close()
}
}
}
@Test
fun explicitSourceRemovalRollsBackInstallAndDelegateOnReplacementFailure() = runBlocking {
withRoom { _, room ->
val store = RoomRecipeInstallationStore(room, TestClock(now))
store.enrollIfAbsent(catalogId, policy())
val initial = store.readCatalog(catalogId)!!
store.commitInstall(initial.generation, candidate(initial, 10))
primeYokanDatabase(room)
val database = RoomYokanDatabase(room)
val before = database.snapshot()
val sourceId = recipeSourceId(catalogId, "recipe.one")
val replacement = before.copy(sources = before.sources.filterNot { it.id == sourceId })
room.useWriterConnection { connection ->
connection.usePrepared("CREATE TRIGGER fail_recipe_delete BEFORE DELETE ON recipe_catalog_installed BEGIN SELECT RAISE(ABORT, 'injected failure'); END") { it.step() }
}
assertFailsWith<Exception> {
database.replaceAllAtomically(replacement, before, setOf(sourceId))
}
assertEquals(before, database.snapshot())
assertEquals(sourceId, room.sourceDao().source(sourceId)?.id)
assertEquals(listOf("recipe.one"), store.readCatalog(catalogId)!!.installedRecords.keys.toList())
}
}
@Test
fun explicitSourceRemovalRejectsConcurrentRecipeSourceInventoryChange() = runBlocking {
withRoom { _, room ->
val clock = TestClock(now)
val store = RoomRecipeInstallationStore(room, clock)
store.enrollIfAbsent(catalogId, policy())
val initial = store.readCatalog(catalogId)!!
store.commitInstall(initial.generation, candidate(initial, 10))
primeYokanDatabase(room)
val database = RoomYokanDatabase(room)
val before = database.snapshot()
val selectedId = recipeSourceId(catalogId, "recipe.one")
val newer = store.readCatalog(catalogId)!!
store.commitInstall(newer.generation, candidate(newer, 11, stableId = "concurrent"))
assertFailsWith<SnapshotReplacementConflictException> {
database.replaceAllAtomically(before.copy(sources = before.sources.filterNot { it.id == selectedId }), before, setOf(selectedId))
}
assertEquals(before, database.snapshot())
assertEquals(setOf("recipe.one", "concurrent"), store.readCatalog(catalogId)!!.installedRecords.keys)
}
}
private fun policy(validUntil: Long? = null): CatalogTrustPolicy = CatalogTrustPolicy(
catalogId,
listOf(TrustedCatalogKey(catalogId, "catalog-key", ByteArray(32) { 7 }, TrustedCatalogKeyState.Active, validUntilEpochSeconds = validUntil)),
)
private fun candidate(
snapshot: eu.friedcutlet.yokan.services.extensions.recipe.CatalogInstallationSnapshot,
revision: Long,
stableId: String = "recipe.one",
artifact: ByteArray = byteArrayOf(1),
release: String = "1",
digest: String = "0".repeat(64),
): RecipeInstallCandidate = RecipeInstallCandidate(
catalogId = catalogId,
expectedTrustPolicy = snapshot.trustPolicy,
expectedAcceptanceState = snapshot.acceptanceState,
acceptedAcceptanceState = CatalogAcceptanceState(catalogId, revision, ByteArray(32) { revision.toByte() }),
expiresAtEpochSeconds = now + 600,
signingKeyId = "catalog-key",
signingKeyValidFromEpochSeconds = null,
signingKeyValidUntilEpochSeconds = snapshot.trustPolicy.trustedKeys.single().validUntilEpochSeconds,
record = InstalledRecipeRecord(catalogId, stableId, revision, release, digest, artifact.size.toLong(), artifact),
)
private fun openRoom(path: String): YokanRoomDatabase = Room.databaseBuilder<YokanRoomDatabase>(name = path).buildYokanRoom()
private suspend fun primeYokanDatabase(room: YokanRoomDatabase) {
room.settingsDao().upsert(seedDatabaseSnapshot().settings.toRow())
}
private fun createV5Fixture(path: String) {
val schemaFile = listOf(
File("schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/5.json"),
File("composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/5.json"),
).firstOrNull(File::isFile) ?: error("Missing checked-in Room v5 schema fixture")
val schema = Json.parseToJsonElement(schemaFile.readText())
val connection = BundledSQLiteDriver().open(path)
try {
val database = schema.jsonObject.getValue("database").jsonObject
database.getValue("entities").jsonArray.forEach { entity ->
val fields = entity.jsonObject
connection.execSQL(fields.getValue("createSql").jsonPrimitive.content.replace("${'$'}{TABLE_NAME}", fields.getValue("tableName").jsonPrimitive.content))
}
connection.execSQL("CREATE TABLE room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)")
connection.execSQL("INSERT INTO room_master_table (id,identity_hash) VALUES(42, 'c33259b810d394a8cdb715a794e18a5b')")
connection.execSQL("PRAGMA user_version = 5")
connection.execSQL("INSERT INTO manga (id, status, itemType, favorite, lastRead, isLocalArchive, updatedAt) VALUES(77, 'unknown', 'manga', 0, 0, 0, 0)")
} finally {
connection.close()
}
}
private suspend fun withRoom(block: suspend (String, YokanRoomDatabase) -> Unit) {
val directory = Files.createTempDirectory("yokan-recipe-room")
val path = directory.resolve("yokan.db").toString()
val room = openRoom(path)
try {
block(path, room)
} finally {
runCatching { room.close() }
directory.toFile().deleteRecursively()
}
}
}
composeApp/src/desktopTest/kotlin/eu/friedcutlet/yokan/database/room/RoomYokanDatabaseContractTest.kt
- Source · test / fixture · 531 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
48: class RoomYokanDatabaseContractTest {
53: fun settingsUpsertWorksAfterDesktopIntegrationInitialization() = runBlocking {
69: fun v10UpgradeDefaultsNotesAndTheySurviveRoomReopen() {
127: fun mangayomiDeletionQueueSurvivesRoomReopen() {
151: fun outboxEpochPersistsAcrossReopen() {
184: fun incompleteBootstrapPersistsAcrossReopen() {
211: fun syncReplacementAndUpdatePreserveOrderAcrossLiveAndReopen() {
235: fun staleGuardRaceOnDedicatedThreadsDoesNotReplaceLiveUpdate() {
305: fun nestedBatchAndRemoteApplyRejectReplacementPromptly() {
320: fun isolatedCallerExecutorDoesNotStarveRoomReplacement() {
356: fun writesDoNotWaitForABusyDatabase() {
386: fun evictedAndDeletedChapterPageListsLeaveRoom() {
405: fun pageListFreshnessPersistsAndRemovalAndClearingReachRoom() {
427: fun v7PageListsSurviveTheMigrationAsStale() {
462: fun unsendableOutboxRowsAreDeletedWithoutAHub() {
485: fun snapshotReplacementQueuesTheSameMangayomiDeletesAsInMemory() {
497: fun YokanDatabase.deletes() = changedParts().map { Triple(it.actionType, it.isarId, it.data) }
519: private fun openRoom(path: String): YokanRoomDatabase =
Exact file bytes / download · SHA-256 c67cb5d78621b4167da25b32484facf6e1b1fb51db021dc9909f4f6ae3ed219b.
Complete file
package eu.friedcutlet.yokan.database.room
import androidx.room.Room
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
import androidx.sqlite.execSQL
import eu.friedcutlet.yokan.database.DbActionType
import eu.friedcutlet.yokan.database.DbCategory
import eu.friedcutlet.yokan.database.DbChangedPart
import eu.friedcutlet.yokan.database.DbChapterPageUrls
import eu.friedcutlet.yokan.database.DbItemType
import eu.friedcutlet.yokan.database.InMemoryYokanDatabase
import eu.friedcutlet.yokan.database.YokanDatabase
import eu.friedcutlet.yokan.database.DbChapterReleasePreference
import eu.friedcutlet.yokan.database.DbAutomaticReaderLayout
import eu.friedcutlet.yokan.database.DbReaderMode
import eu.friedcutlet.yokan.database.DbManga
import eu.friedcutlet.yokan.database.DbSavedSearch
import eu.friedcutlet.yokan.database.DbPresetFilter
import eu.friedcutlet.yokan.database.DbPresetSelection
import eu.friedcutlet.yokan.database.DbOutboxOp
import eu.friedcutlet.yokan.database.MAX_PAGE_CACHE
import eu.friedcutlet.yokan.database.sync.SyncPaths
import eu.friedcutlet.yokan.database.SnapshotReplacementConflictException
import eu.friedcutlet.yokan.database.DbSyncPreference
import eu.friedcutlet.yokan.database.SyncServerProvider
import eu.friedcutlet.yokan.database.seedDatabaseSnapshot
import org.junit.Rule
import org.junit.rules.TemporaryFolder
import java.io.File
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import java.util.concurrent.CountDownLatch
import java.util.concurrent.Executors
import java.util.concurrent.Future
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicReference
import kotlin.concurrent.thread
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertFalse
import kotlin.test.assertTrue
import kotlinx.coroutines.asCoroutineDispatcher
import kotlinx.coroutines.runBlocking
class RoomYokanDatabaseContractTest {
@get:Rule
val tmp = TemporaryFolder()
@Test
fun settingsUpsertWorksAfterDesktopIntegrationInitialization() = runBlocking {
// Linux's desktop/GTK initialization exposed a native error-formatting issue in
// sqlite-bundled 2.5.0: Room could no longer recognize a duplicate-key insert.
java.awt.Desktop.isDesktopSupported()
val directory = tmp.newFolder().toPath()
val room = openRoom(directory.resolve("yokan.db").toString())
try {
room.settingsDao().upsert(SettingsRow(id = 1, json = "initial"))
room.settingsDao().upsert(SettingsRow(id = 1, json = "updated"))
assertEquals("updated", room.settingsDao().get()?.json)
} finally {
room.close()
}
}
@Test
fun v10UpgradeDefaultsNotesAndTheySurviveRoomReopen() {
val directory = tmp.newFolder().toPath()
val path = directory.resolve("yokan.db").toString()
val schemaFile = listOf(
File("schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/10.json"),
File("composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/10.json"),
).first(File::isFile)
val schema = Json.parseToJsonElement(schemaFile.readText()).jsonObject.getValue("database").jsonObject
val connection = BundledSQLiteDriver().open(path)
try {
schema.getValue("entities").jsonArray.forEach { entity ->
val fields = entity.jsonObject
connection.execSQL(fields.getValue("createSql").jsonPrimitive.content
.replace("${'$'}{TABLE_NAME}", fields.getValue("tableName").jsonPrimitive.content))
}
schema.getValue("setupQueries").jsonArray.forEach { connection.execSQL(it.jsonPrimitive.content) }
connection.execSQL("PRAGMA user_version = 10")
connection.execSQL("INSERT INTO download (id, chapterId, isStartDownload) VALUES(99, 42, 1)")
connection.execSQL("INSERT INTO manga (id, name, status, itemType, favorite, lastRead, isLocalArchive, updatedAt) VALUES(42, 'Existing', 'Unknown', 'Manga', 1, 0, 0, 0)")
} finally {
connection.close()
}
val note = "第一行 🌙\nSecond line\n spaces "
val preset = DbSavedSearch(42, "Private preset", "", id = "room-preset", filterSchemaRecorded = true,
filters = listOf(DbPresetFilter("check", "Check", "Toggle", "Toggle", true, emptyList(), null,
selection = DbPresetSelection.Toggle(true))))
val releasePreference = DbChapterReleasePreference(42, listOf("preferred", ""), true)
val automaticLayout = DbAutomaticReaderLayout(42, fallback = DbReaderMode.Rtl)
val room = openRoom(path)
try {
val db = RoomYokanDatabase(room)
val oldDownload = checkNotNull(db.download(99))
assertFalse(oldDownload.isPaused)
assertEquals(null, oldDownload.storageLocation)
db.upsertDownload(oldDownload.copy(isPaused = true, storageLocation = "/custom/chapter", requestJson = "request-options"))
val old = checkNotNull(db.manga(42))
assertEquals("", old.privateNote)
db.upsertManga(old.copy(privateNote = note))
db.updateSettings(db.settings().copy(savedSearches = listOf(preset), chapterReleasePreferences = listOf(releasePreference),
automaticReaderLayout = true, readerHoldToScroll = true, automaticReaderLayouts = listOf(automaticLayout)))
runBlocking { db.awaitPersistence() }
} finally { room.close() }
val reopenedRoom = openRoom(path)
try {
val reopened = RoomYokanDatabase(reopenedRoom)
assertEquals(note, reopened.manga(42)?.privateNote)
assertEquals(true, reopened.download(99)?.isPaused)
assertEquals("/custom/chapter", reopened.download(99)?.storageLocation)
assertEquals("request-options", reopened.download(99)?.requestJson)
assertEquals(listOf(preset), reopened.settings().savedSearches)
assertEquals(listOf(releasePreference), reopened.settings().chapterReleasePreferences)
assertTrue(reopened.settings().automaticReaderLayout)
assertTrue(reopened.settings().readerHoldToScroll)
assertEquals(listOf(automaticLayout), reopened.settings().automaticReaderLayouts)
} finally { reopenedRoom.close() }
}
@Test
fun mangayomiDeletionQueueSurvivesRoomReopen() {
val directory = tmp.newFolder().toPath()
val path = directory.resolve("yokan.db").toString()
val room = openRoom(path)
val database = RoomYokanDatabase(room, legacySnapshotProvider = { seedDatabaseSnapshot() })
database.upsertSyncPreference(DbSyncPreference(syncId = 1, server = "HTTPS://SYNC.TEST/Case/", email = "u",
serverProvider = SyncServerProvider.Mangayomi, mangayomiIdMappings = """{"version":1,"namespaces":{"https://sync.test/Case\nu":{"2":{"9":{"canonical":90,"aliases":[]}}}}}"""))
database.upsertManga(DbManga(id = 9, name = "remove me"))
database.removeManga(9)
runBlocking { database.awaitPersistence() }
room.close()
val reopenedRoom = openRoom(path)
try {
val reopened = RoomYokanDatabase(reopenedRoom)
val deletion = reopened.changedParts().single { it.data.contains("mangayomi") }
assertTrue(deletion.data.contains("\"localId\":\"9\""))
assertTrue(deletion.data.contains("https://sync.test/Case\\nu"))
} finally {
reopenedRoom.close()
}
}
@Test
fun outboxEpochPersistsAcrossReopen() {
val directory = tmp.newFolder().toPath()
val path = directory.resolve("yokan.db").toString()
val room = openRoom(path)
val database = RoomYokanDatabase(room, legacySnapshotProvider = { seedDatabaseSnapshot() })
database.upsertSyncPreference(
DbSyncPreference(
syncId = 1,
server = "https://hub.test",
authToken = "tok",
syncOn = true,
hubEpoch = 4,
hubRecoveryPending = true,
hubBootstrapComplete = true,
),
)
database.upsertManga(DbManga(id = 10, name = "epoch"))
database.replaceAll(database.snapshot(), null)
room.close()
val reopenedRoom = openRoom(path)
try {
val reopened = RoomYokanDatabase(reopenedRoom)
assertTrue(reopened.outbox().isNotEmpty())
assertTrue(reopened.outbox().all { it.epoch == 4 })
assertTrue(reopened.syncPreferences().single().hubRecoveryPending)
assertTrue(reopened.syncPreferences().single().hubBootstrapComplete)
} finally {
reopenedRoom.close()
}
}
@Test
fun incompleteBootstrapPersistsAcrossReopen() {
val directory = tmp.newFolder().toPath()
val path = directory.resolve("yokan.db").toString()
val room = openRoom(path)
val database = RoomYokanDatabase(room, legacySnapshotProvider = { seedDatabaseSnapshot() })
database.upsertSyncPreference(
DbSyncPreference(
syncId = 1,
server = "https://hub.test",
authToken = "tok",
syncOn = true,
hubBootstrapComplete = false,
),
)
database.replaceAll(database.snapshot(), null)
room.close()
val reopenedRoom = openRoom(path)
try {
val reopened = RoomYokanDatabase(reopenedRoom)
assertFalse(reopened.syncPreferences().single().hubBootstrapComplete)
} finally {
reopenedRoom.close()
}
}
@Test
fun syncReplacementAndUpdatePreserveOrderAcrossLiveAndReopen() {
val directory = tmp.newFolder().toPath()
val path = directory.resolve("yokan.db").toString()
val room = openRoom(path)
val database = RoomYokanDatabase(room, legacySnapshotProvider = { seedDatabaseSnapshot() })
val replacement = database.snapshot().copy(
mangas = listOf(DbManga(id = 10, name = "replacement")),
)
database.replaceAll(replacement, null)
database.upsertManga(DbManga(id = 11, name = "update"))
database.replaceAll(database.snapshot(), null)
assertEquals(setOf(10L, 11L), database.mangas().map { it.id }.toSet())
room.close()
val reopenedRoom = openRoom(path)
try {
val reopened = RoomYokanDatabase(reopenedRoom)
assertEquals(setOf(10L, 11L), reopened.mangas().map { it.id }.toSet())
} finally {
reopenedRoom.close()
}
}
@Test
fun staleGuardRaceOnDedicatedThreadsDoesNotReplaceLiveUpdate() {
val directory = tmp.newFolder().toPath()
val path = directory.resolve("yokan.db").toString()
var room: YokanRoomDatabase? = null
try {
val firstRoom = openRoom(path)
room = firstRoom
val database = RoomYokanDatabase(firstRoom, legacySnapshotProvider = { seedDatabaseSnapshot() })
val expected = database.snapshot()
val updated = DbManga(id = 21, name = "live")
val updateApplied = CountDownLatch(1)
val releaseUpdate = CountDownLatch(1)
val replacementStarted = CountDownLatch(1)
val replaceDone = CountDownLatch(1)
val failure = AtomicReference<Throwable?>(null)
val updater = thread {
try {
database.batch {
database.upsertManga(updated)
updateApplied.countDown()
check(releaseUpdate.await(WATCHDOG_MS, TimeUnit.MILLISECONDS)) {
"Timed out waiting to release the live mutation"
}
}
} catch (error: Throwable) {
failure.compareAndSet(null, error)
}
}
var replacer: Thread? = null
try {
assertTrue(updateApplied.await(WATCHDOG_MS, TimeUnit.MILLISECONDS))
replacer = thread {
try {
replacementStarted.countDown()
assertFailsWith<SnapshotReplacementConflictException> {
database.replaceAll(expected.copy(mangas = emptyList()), expected)
}
} catch (error: Throwable) {
failure.set(error)
} finally {
replaceDone.countDown()
}
}
assertTrue(replacementStarted.await(WATCHDOG_MS, TimeUnit.MILLISECONDS))
releaseUpdate.countDown()
assertTrue(replaceDone.await(WATCHDOG_MS, TimeUnit.MILLISECONDS))
} finally {
releaseUpdate.countDown()
updater.join(WATCHDOG_MS)
replacer?.join(WATCHDOG_MS)
}
failure.get()?.let { throw it }
assertEquals("live", database.manga(updated.id)?.name)
database.replaceAll(database.snapshot(), null)
firstRoom.close()
room = null
val reopenedRoom = openRoom(path)
try {
val reopened = RoomYokanDatabase(reopenedRoom)
assertEquals("live", reopened.manga(updated.id)?.name)
} finally {
reopenedRoom.close()
}
} finally {
room?.close()
}
}
@Test
fun nestedBatchAndRemoteApplyRejectReplacementPromptly() {
val directory = tmp.newFolder().toPath()
val path = directory.resolve("yokan.db").toString()
val room = openRoom(path)
val database = RoomYokanDatabase(room, legacySnapshotProvider = { seedDatabaseSnapshot() })
assertFailsWith<IllegalStateException> {
database.batch { database.replaceAll(database.snapshot(), null) }
}
assertFailsWith<IllegalStateException> {
database.applyRemote { database.replaceAll(database.snapshot(), null) }
}
room.close()
}
@Test
fun isolatedCallerExecutorDoesNotStarveRoomReplacement() {
val directory = tmp.newFolder().toPath()
val path = directory.resolve("yokan.db").toString()
var room: YokanRoomDatabase? = null
val callerExecutor = Executors.newSingleThreadExecutor()
val callerDispatcher = callerExecutor.asCoroutineDispatcher()
val watchdogExecutor = Executors.newSingleThreadExecutor()
var replacement: Future<*>? = null
try {
val firstRoom = openRoom(path)
room = firstRoom
val database = RoomYokanDatabase(firstRoom, legacySnapshotProvider = { seedDatabaseSnapshot() })
val replacementSnapshot = database.snapshot().copy(
mangas = listOf(DbManga(id = 31, name = "dispatcher")),
)
// Keep the caller constrained without occupying the process-wide Default scheduler.
val replacementFuture = watchdogExecutor.submit {
runBlocking(callerDispatcher) {
database.replaceAllAtomically(replacementSnapshot, null)
}
}
replacement = replacementFuture
replacementFuture.get(WATCHDOG_MS, TimeUnit.MILLISECONDS)
assertEquals(listOf(31L), database.mangas().map { it.id })
} finally {
replacement?.cancel(true)
callerDispatcher.close()
callerExecutor.shutdownNow()
callerExecutor.awaitTermination(WATCHDOG_MS, TimeUnit.MILLISECONDS)
watchdogExecutor.shutdownNow()
watchdogExecutor.awaitTermination(WATCHDOG_MS, TimeUnit.MILLISECONDS)
room?.close()
}
}
@Test
fun writesDoNotWaitForABusyDatabase() {
val directory = tmp.newFolder().toPath()
val path = directory.resolve("yokan.db").toString()
val writer = Executors.newSingleThreadExecutor()
var room: YokanRoomDatabase? = null
try {
val openedRoom = openRoom(path)
room = openedRoom
val database = RoomYokanDatabase(openedRoom, legacySnapshotProvider = { seedDatabaseSnapshot() })
// Another connection holds the write lock, so the worker cannot drain the queue meanwhile.
val lock = BundledSQLiteDriver().open(path)
try {
lock.execSQL("BEGIN IMMEDIATE")
writer.submit {
(1L..500L).forEach { database.upsertManga(DbManga(id = it, name = "m$it")) }
}.get(WATCHDOG_MS, TimeUnit.MILLISECONDS)
} finally {
lock.execSQL("ROLLBACK")
lock.close()
}
runBlocking { database.awaitPersistence() } // waits for everything queued before it
assertEquals(500, runBlocking(roomPersistenceDispatcher) { openedRoom.mangaDao().all() }.size)
} finally {
writer.shutdownNow()
room?.close()
}
}
@Test
fun evictedAndDeletedChapterPageListsLeaveRoom() {
val directory = tmp.newFolder().toPath()
val path = directory.resolve("yokan.db").toString()
val room = openRoom(path)
try {
val database = RoomYokanDatabase(room, legacySnapshotProvider = { seedDatabaseSnapshot() })
(1L..MAX_PAGE_CACHE + 1L).forEach { database.upsertPageCache(DbChapterPageUrls(chapterId = it, urls = listOf("p$it"))) }
database.removeChapter(2L)
// Waits for everything queued before it without rewriting the tables (replaceAll would).
runBlocking { database.awaitPersistence() }
val persisted = runBlocking(roomPersistenceDispatcher) { room.pageCacheDao().all() }.map { it.chapterId }
assertEquals((3L..MAX_PAGE_CACHE + 1L).toSet(), persisted.toSet())
} finally {
room.close()
}
}
@Test
fun pageListFreshnessPersistsAndRemovalAndClearingReachRoom() {
val directory = tmp.newFolder().toPath()
val path = directory.resolve("yokan.db").toString()
val room = openRoom(path)
try {
val database = RoomYokanDatabase(room, legacySnapshotProvider = { seedDatabaseSnapshot() })
val fresh = DbChapterPageUrls(chapterId = 1, urls = listOf("p1"), fetchedAt = 42, sourceId = 7, sourceVersion = "1.2.0")
database.upsertPageCache(fresh)
database.upsertPageCache(DbChapterPageUrls(chapterId = 2, urls = listOf("p2")))
database.removePageCache(listOf(2L))
runBlocking { database.awaitPersistence() } // waits for everything queued before it
assertEquals(listOf(fresh), runBlocking(roomPersistenceDispatcher) { room.pageCacheDao().all() }.map { it.toDb() })
database.clearPageCache()
runBlocking { database.awaitPersistence() }
assertTrue(runBlocking(roomPersistenceDispatcher) { room.pageCacheDao().all() }.isEmpty())
} finally {
room.close()
}
}
@Test
fun v7PageListsSurviveTheMigrationAsStale() {
val directory = tmp.newFolder().toPath()
val path = directory.resolve("yokan.db").toString()
val schemaFile = listOf(
File("schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/7.json"),
File("composeApp/schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/7.json"),
).first(File::isFile)
val schema = Json.parseToJsonElement(schemaFile.readText()).jsonObject.getValue("database").jsonObject
val connection = BundledSQLiteDriver().open(path)
try {
schema.getValue("entities").jsonArray.forEach { entity ->
val fields = entity.jsonObject
connection.execSQL(
fields.getValue("createSql").jsonPrimitive.content
.replace("${'$'}{TABLE_NAME}", fields.getValue("tableName").jsonPrimitive.content),
)
}
schema.getValue("setupQueries").jsonArray.forEach { connection.execSQL(it.jsonPrimitive.content) }
connection.execSQL("PRAGMA user_version = 7")
connection.execSQL("INSERT INTO page_cache (chapterId, chapterUrl, urls) VALUES(5, '/c5', '[\"https://img/1.jpg\"]')")
} finally {
connection.close()
}
val room = Room.databaseBuilder<YokanRoomDatabase>(name = path).buildYokanRoom()
try {
val migrated = runBlocking(roomPersistenceDispatcher) { room.pageCacheDao().all() }.single().toDb()
assertEquals(listOf("https://img/1.jpg"), migrated.urls)
assertEquals(null, migrated.fetchedAt, "pre-v8 lists are stale, so they are refetched once")
} finally {
room.close()
}
}
@Test
fun unsendableOutboxRowsAreDeletedWithoutAHub() {
val directory = tmp.newFolder().toPath()
val path = directory.resolve("yokan.db").toString()
val room = openRoom(path)
val database = RoomYokanDatabase(room, legacySnapshotProvider = { seedDatabaseSnapshot() })
database.replaceAll(
database.snapshot().copy(outbox = listOf(DbOutboxOp(SyncPaths.KIND_MANGA, 1, "name", "\"x\"", hlc = 1, seq = 1))),
null,
)
room.close()
val reopenedRoom = openRoom(path)
try {
val reopened = RoomYokanDatabase(reopenedRoom)
assertTrue(reopened.outbox().isEmpty())
runBlocking { reopened.awaitPersistence() } // flush the queued cleanup
assertTrue(runBlocking(roomPersistenceDispatcher) { reopenedRoom.outboxDao().all() }.isEmpty())
} finally {
reopenedRoom.close()
}
}
@Test
fun snapshotReplacementQueuesTheSameMangayomiDeletesAsInMemory() {
val queued = DbChangedPart(id = 7, actionType = DbActionType.RemoveItem, isarId = 9,
data = """{"provider":"mangayomi","namespace":"https://sync.test\nu","kind":2,"localId":"9"}""", clientDate = 1)
val seed = seedDatabaseSnapshot().copy(
syncPreferences = listOf(DbSyncPreference(syncId = 1, server = "https://sync.test", email = "u", serverProvider = SyncServerProvider.Mangayomi,
mangayomiIdMappings = """{"version":1,"namespaces":{"https://sync.test\nu":{"1":{"1":{"canonical":10,"aliases":[]}},"2":{"8":{"canonical":80,"aliases":[]},"9":{"canonical":90,"aliases":[]}}}}}""")),
categories = listOf(DbCategory(id = 1, name = "c", forItemType = DbItemType.Manga)),
mangas = listOf(DbManga(id = 8, name = "bound"), DbManga(id = 9, name = "already queued"), DbManga(id = 10, name = "never uploaded")),
chapters = emptyList(), tracks = emptyList(), histories = emptyList(), updates = emptyList(),
changedParts = listOf(queued),
)
val target = seed.copy(categories = emptyList(), mangas = emptyList())
fun YokanDatabase.deletes() = changedParts().map { Triple(it.actionType, it.isarId, it.data) }
val memory = InMemoryYokanDatabase(seed).apply { replaceAll(target, null) }
val room = openRoom(tmp.newFolder().toPath().resolve("yokan.db").toString())
try {
val database = RoomYokanDatabase(room).apply { replaceAll(seed, null) }
database.replaceAll(target, null)
assertEquals(memory.deletes().sortedBy { it.second }, database.deletes().sortedBy { it.second })
assertEquals(
listOf(DbActionType.RemoveCategory to 1L, DbActionType.RemoveItem to 8L, DbActionType.RemoveItem to 9L),
database.deletes().map { it.first to it.second }.sortedBy { it.second },
)
} finally {
room.close()
}
}
private companion object {
const val WATCHDOG_MS = 2_000L
}
private fun openRoom(path: String): YokanRoomDatabase =
Room.databaseBuilder<YokanRoomDatabase>(name = path)
.buildYokanRoom()
.also { room ->
// Keep the contract tests on the hydrated path. The cold-room import logs through
// YokanRuntime, whose lazy database can recursively construct another Room facade.
runBlocking(roomPersistenceDispatcher) {
if (room.settingsDao().get() == null) {
room.settingsDao().upsert(seedDatabaseSnapshot().settings.toRow())
}
}
}
}
composeApp/src/desktopTest/kotlin/eu/friedcutlet/yokan/database/room/SeasonRecordsMigrationTest.kt
- Source · test / fixture · 68 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
13: class SeasonRecordsMigrationTest {
Exact file bytes / download · SHA-256 b8e9d567831a531930dd577725bc0fabb21c361c9294b18eec0f25d11c15a01d.
Complete file
package eu.friedcutlet.yokan.database.room
import androidx.room.Room
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
import androidx.sqlite.execSQL
import eu.friedcutlet.yokan.database.*
import java.io.File
import java.nio.file.Files
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.json.*
import kotlin.test.*
class SeasonRecordsMigrationTest {
@Test fun version15UpgradeDefaultsToEpisodeTitlesAndSeasonLinksAndFillerMarksSurviveReopen() {
val directory = Files.createTempDirectory("yokan-season-migration")
val path = directory.resolve("yokan.db").toString()
try {
val schema = DatabaseJson.parseToJsonElement(File("schemas/eu.friedcutlet.yokan.database.room.YokanRoomDatabase/15.json").readText())
.jsonObject.getValue("database").jsonObject
BundledSQLiteDriver().open(path).use { connection ->
schema.getValue("entities").jsonArray.forEach { value ->
val entity = value.jsonObject
val table = entity.getValue("tableName").jsonPrimitive.content
connection.execSQL(entity.getValue("createSql").jsonPrimitive.content.replace("\${TABLE_NAME}", table))
entity["indices"]?.jsonArray.orEmpty().forEach { index ->
connection.execSQL(index.jsonObject.getValue("createSql").jsonPrimitive.content.replace("\${TABLE_NAME}", table))
}
}
schema.getValue("setupQueries").jsonArray.forEach { connection.execSQL(it.jsonPrimitive.content) }
connection.execSQL("INSERT INTO manga(id,name,link,status,itemType,favorite,lastRead,isLocalArchive,updatedAt,privateNote) VALUES(1,'Show','/show','Ongoing','Anime',1,123,0,321,'Saved note')")
connection.execSQL("INSERT INTO manga(id,name,link,status,itemType,favorite,lastRead,isLocalArchive,updatedAt) VALUES(2,'Season 2','/show/2','Ongoing','Anime',0,0,0,322)")
connection.execSQL("INSERT INTO manga_credit(mangaId,position,name) VALUES(1,0,'Actor')")
connection.execSQL("INSERT INTO chapter(id,mangaId,name,url,dateUpload,scanlator,isBookmarked,isRead,lastPageRead,archivePath,isFiller,updatedAt,fetchedAt) VALUES(3,2,'Episode 1','/ep','2026-01-01','',1,1,'900','',1,456,789)")
connection.execSQL("PRAGMA user_version = 15")
}
val room = Room.databaseBuilder<YokanRoomDatabase>(name = path).buildYokanRoom()
try {
runBlocking(roomPersistenceDispatcher) {
val titles = room.mangaDao().all().map { it.toDb() }.associateBy { it.id }
assertTrue(titles.values.all { it.parentId == null && it.fetchType == DbFetchType.Episodes && it.seasonNumber == null })
assertEquals("Saved note", titles.getValue(1).privateNote)
val chapter = room.chapterDao().all().single().toDb()
assertNull(chapter.fillerOverride)
assertTrue(chapter.effectiveFiller && chapter.isRead && chapter.isBookmarked)
assertEquals("900", chapter.lastPageRead)
room.mangaDao().upsert(titles.getValue(1).copy(fetchType = DbFetchType.Seasons).toRow())
room.mangaDao().upsert(titles.getValue(2).copy(parentId = 1, seasonNumber = 2.0).toRow())
room.chapterDao().upsert(chapter.copy(fillerOverride = false).toRow())
}
} finally { room.close() }
val reopened = Room.databaseBuilder<YokanRoomDatabase>(name = path).buildYokanRoom()
try {
runBlocking(roomPersistenceDispatcher) {
val titles = reopened.mangaDao().all().map { it.toDb() }.associateBy { it.id }
assertEquals(DbFetchType.Seasons, titles.getValue(1).fetchType)
assertEquals(1L, titles.getValue(2).parentId)
assertEquals(2.0, titles.getValue(2).seasonNumber)
assertEquals(listOf(1L), titles.values.filter { it.favorite && it.parentId == null }.map { it.id })
val chapter = reopened.chapterDao().all().single().toDb()
assertEquals(false, chapter.fillerOverride)
assertTrue(chapter.isFiller)
assertFalse(chapter.effectiveFiller)
assertEquals("900", chapter.lastPageRead)
}
} finally { reopened.close() }
} finally { directory.toFile().deleteRecursively() }
}
}
composeApp/src/desktopTest/kotlin/eu/friedcutlet/yokan/database/room/TitleStatusPersistenceTest.kt
- Source · test / fixture · 37 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
13: class TitleStatusPersistenceTest {
Exact file bytes / download · SHA-256 bdbc5e1a792fc3959da458076b0293fd36f841ce043b030d3abd100f4406f84a.
Complete file
package eu.friedcutlet.yokan.database.room
import androidx.room.Room
import eu.friedcutlet.yokan.database.DbManga
import eu.friedcutlet.yokan.database.DbSettings
import eu.friedcutlet.yokan.database.DbStatus
import eu.friedcutlet.yokan.data.toDomain
import java.nio.file.Files
import kotlinx.coroutines.runBlocking
import kotlin.test.Test
import kotlin.test.assertEquals
class TitleStatusPersistenceTest {
@Test fun originalAndNewStatusNamesSurviveSqliteReopenAndDomainMapping() {
val directory = Files.createTempDirectory("yokan-title-status")
val path = directory.resolve("yokan.db").toString()
try {
val room = Room.databaseBuilder<YokanRoomDatabase>(name = path).buildYokanRoom()
try {
runBlocking(roomPersistenceDispatcher) {
for ((index, status) in DbStatus.entries.withIndex()) {
room.mangaDao().upsert(DbManga(id = index + 1L, status = status, favorite = true, privateNote = "Saved").toRow())
}
}
} finally { room.close() }
val reopened = Room.databaseBuilder<YokanRoomDatabase>(name = path).buildYokanRoom()
try {
runBlocking(roomPersistenceDispatcher) {
val titles = reopened.mangaDao().all().map { it.toDb() }.sortedBy { it.id }
assertEquals(DbStatus.entries, titles.map { it.status })
assertEquals(DbStatus.entries.map { it.name }, titles.map { it.toDomain(DbSettings()).status.name })
assertEquals(List(8) { "Saved" }, titles.map { it.privateNote })
}
} finally { reopened.close() }
} finally { directory.toFile().deleteRecursively() }
}
}
composeApp/src/iosMain/kotlin/eu/friedcutlet/yokan/database/PersistentDatabase.ios.kt
- Source · implementation · 44 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
13: actual fun createDefaultDatabaseSnapshotStore(): DatabaseSnapshotStore = IosDatabaseSnapshotStore
16: private object IosDatabaseSnapshotStore : DatabaseSnapshotStore {
31: override fun load(): YokanDatabaseSnapshot? {
36: override fun save(snapshot: YokanDatabaseSnapshot) {
Exact file bytes / download · SHA-256 e3cffc59cc46bf12ddd65cc87fe601793cce9bd39146a09df20982e52d1dd93d.
Complete file
package eu.friedcutlet.yokan.database
import platform.Foundation.NSDocumentDirectory
import platform.Foundation.NSFileManager
import platform.Foundation.NSSearchPathForDirectoriesInDomains
import platform.Foundation.NSString
import platform.Foundation.NSUTF8StringEncoding
import platform.Foundation.NSUserDomainMask
import platform.Foundation.create
import platform.Foundation.stringWithContentsOfFile
import platform.Foundation.writeToFile
actual fun createDefaultDatabaseSnapshotStore(): DatabaseSnapshotStore = IosDatabaseSnapshotStore
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, kotlinx.cinterop.BetaInteropApi::class)
private object IosDatabaseSnapshotStore : DatabaseSnapshotStore {
private val filePath: String by lazy {
val documents = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)
.firstOrNull() as? String
?: ""
val directory = "$documents/yokan"
NSFileManager.defaultManager.createDirectoryAtPath(
path = directory,
withIntermediateDirectories = true,
attributes = null,
error = null,
)
"$directory/yokan-database-v1.json"
}
override fun load(): YokanDatabaseSnapshot? {
val raw = NSString.stringWithContentsOfFile(filePath, NSUTF8StringEncoding, null) ?: return null
return decodeDatabaseSnapshot(raw)
}
override fun save(snapshot: YokanDatabaseSnapshot) {
NSString.create(string = encodeDatabaseSnapshot(snapshot)).writeToFile(
path = filePath,
atomically = true,
encoding = NSUTF8StringEncoding,
error = null,
)
}
}
composeApp/src/iosMain/kotlin/eu/friedcutlet/yokan/database/room/YokanRoomDatabase.ios.kt
- Source · implementation · 23 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
11: actual fun createYokanRoomDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanRoomDatabase {
Exact file bytes / download · SHA-256 8fa4ad3b884d0752047af8e36e668c6adb045ccf66f4ff62ddf4992639272501.
Complete file
package eu.friedcutlet.yokan.database.room
import androidx.room.Room
import kotlinx.cinterop.ExperimentalForeignApi
import platform.Foundation.NSDocumentDirectory
import platform.Foundation.NSFileManager
import platform.Foundation.NSURL
import platform.Foundation.NSUserDomainMask
@OptIn(ExperimentalForeignApi::class)
actual fun createYokanRoomDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanRoomDatabase {
val documents = NSFileManager.defaultManager.URLForDirectory(
directory = NSDocumentDirectory,
inDomain = NSUserDomainMask,
appropriateForURL = null,
create = true,
error = null,
) ?: error("Could not resolve NSDocumentDirectory for Room database.")
val dbUrl = documents.URLByAppendingPathComponent(eu.friedcutlet.yokan.domain.ProfileStorageNamespace(profileId).databaseRelativePath)
?: error("Could not append database path.")
check(NSFileManager.defaultManager.createDirectoryAtPath(checkNotNull(dbUrl.path).substringBeforeLast('/'), true, null, null))
return Room.databaseBuilder<YokanRoomDatabase>(name = dbUrl.path ?: "yokan-room.db").buildYokanRoom()
}
composeApp/src/nonWebMain/kotlin/eu/friedcutlet/yokan/database/PersistentDatabase.nonWeb.kt
- Source · implementation · 15 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
9: actual fun createDefaultDatabase(): YokanDatabase = createProfileDatabase(eu.friedcutlet.yokan.domain.ProfileId.Default)
11: actual fun createProfileDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanDatabase =
Exact file bytes / download · SHA-256 34f1691e87c60916a18bad3a826681cf74b8fbe17ca1334aabc6807021916af0.
Complete file
package eu.friedcutlet.yokan.database
/**
* Room-backed persistence. A pre-existing JSON snapshot is only consulted on
* the cold path where Room is empty — passing a `() -> YokanDatabaseSnapshot?`
* instead of a fully loaded one avoids paying the JSON read on every
* subsequent boot.
*/
actual fun createDefaultDatabase(): YokanDatabase = createProfileDatabase(eu.friedcutlet.yokan.domain.ProfileId.Default)
actual fun createProfileDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanDatabase =
eu.friedcutlet.yokan.database.room.RoomYokanDatabase(
room = eu.friedcutlet.yokan.database.room.createYokanRoomDatabase(profileId),
legacySnapshotProvider = { if (profileId == eu.friedcutlet.yokan.domain.ProfileId.Default) createDefaultDatabaseSnapshotStore().load() else null },
)
composeApp/src/nonWebMain/kotlin/eu/friedcutlet/yokan/database/room/RoomDispatchers.kt
- Source · implementation · 15 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Exact file bytes / download · SHA-256 ee13cf8ea01d2f978cfe91add78c1691d043b89937dcbef596878db768247816.
Complete file
package eu.friedcutlet.yokan.database.room
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO
/**
* The serialized lane used by Room. Views of [Dispatchers.IO] are elastic on JVM and Native
* (a private pool, never Darwin's GCD-backed Default), so callers blocked in
* [RoomYokanDatabase]'s `runBlocking` bridges cannot starve it of a thread.
*/
internal val roomPersistenceDispatcher: CoroutineDispatcher = Dispatchers.IO.limitedParallelism(1)
/** The separate lane a synchronous replacement blocks on while it waits for [roomPersistenceDispatcher]. */
internal val roomReplacementDispatcher: CoroutineDispatcher = Dispatchers.IO
composeApp/src/nonWebMain/kotlin/eu/friedcutlet/yokan/database/room/RoomRecipeInstallationStore.kt
- Source · implementation · 191 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
32: class RoomRecipeInstallationStore(
37: override suspend fun enrollIfAbsent(catalogId: String, trustPolicy: CatalogTrustPolicy): RecipeCatalogEnrollmentResult = try {
54: override suspend fun readCatalog(catalogId: String): CatalogInstallationSnapshot? = immediateTransaction {
58: override suspend fun commitInstall(expectedGeneration: CatalogSnapshotGeneration, candidate: RecipeInstallCandidate): RecipeInstallCommitResult = immediateTransaction {
73: suspend fun uninstall(catalogId: String, expectedGeneration: CatalogSnapshotGeneration, stableId: String): RecipeInstallCommitResult = immediateTransaction {
84: suspend fun replaceTrustPolicy(
104: private suspend fun loadCatalog(dao: RecipeInstallationDao, catalogId: String): CatalogInstallationSnapshot? {
136: private fun fitsTotalArtifactQuota(records: Collection<InstalledRecipeRecord>): Boolean {
145: private suspend fun ensureRecipeSource(sourceId: Long, catalogId: String, stableId: String) {
169: private suspend fun <T> immediateTransaction(block: suspend () -> T): T = room.useWriterConnection { connection ->
174: private fun TrustedCatalogKey.toRow(): RecipeCatalogTrustKeyRow = RecipeCatalogTrustKeyRow(
178: private fun CatalogTrustPolicy.copyForStore(): CatalogTrustPolicy = CatalogTrustPolicy(
185: private fun InstalledRecipeRecord.toRow(): RecipeCatalogInstalledRow = RecipeCatalogInstalledRow(
189: private fun String.toCheckpoint(generation: Long, replay: CatalogAcceptanceState?): RecipeCatalogCheckpointRow = RecipeCatalogCheckpointRow(
Exact file bytes / download · SHA-256 c55f0c2433ee4dc73524040a983a2c04ee3c6f2b4b59e372d1d07d18d430c545.
Complete file
package eu.friedcutlet.yokan.database.room
import androidx.room.Transactor
import androidx.room.useWriterConnection
import eu.friedcutlet.yokan.services.extensions.recipe.CatalogAcceptanceState
import eu.friedcutlet.yokan.services.extensions.recipe.CatalogInstallationSnapshot
import eu.friedcutlet.yokan.services.extensions.recipe.CatalogSnapshotGeneration
import eu.friedcutlet.yokan.services.extensions.recipe.CatalogTrustPolicy
import eu.friedcutlet.yokan.services.extensions.recipe.InstalledRecipeRecord
import eu.friedcutlet.yokan.services.extensions.recipe.RecipeCatalogEnrollmentResult
import eu.friedcutlet.yokan.services.extensions.recipe.RecipeInstallCandidate
import eu.friedcutlet.yokan.services.extensions.recipe.RecipeInstallCommitResult
import eu.friedcutlet.yokan.services.extensions.recipe.RecipeInstallationClock
import eu.friedcutlet.yokan.services.extensions.recipe.RecipeInstallationStore
import eu.friedcutlet.yokan.services.extensions.recipe.RecipeInstallationStoreLimits
import eu.friedcutlet.yokan.services.extensions.recipe.RecipeSourceDiscriminator
import eu.friedcutlet.yokan.services.extensions.recipe.TrustedCatalogKey
import eu.friedcutlet.yokan.services.extensions.recipe.TrustedCatalogKeyState
import eu.friedcutlet.yokan.services.extensions.recipe.decideRecipeInstallationCommit
import eu.friedcutlet.yokan.services.extensions.recipe.parseRecipeSourceReference
import eu.friedcutlet.yokan.services.extensions.recipe.recipeSourceId
import eu.friedcutlet.yokan.services.extensions.recipe.recipeSourceReference
import eu.friedcutlet.yokan.services.extensions.recipe.validRecipeInstallationCatalogId
import eu.friedcutlet.yokan.services.extensions.recipe.validRecipeInstallationArtifactRecord
import eu.friedcutlet.yokan.services.extensions.recipe.validRecipeInstallationTrustPolicy
import kotlinx.coroutines.CancellationException
/**
* Durable, host-owned recipe installation state. It deliberately has no relationship to legacy snapshots,
* backup, or sync tables: trust and replay state are never imported, replaced, or remotely merged.
*/
class RoomRecipeInstallationStore(
private val room: YokanRoomDatabase,
private val clock: RecipeInstallationClock,
private val limits: RecipeInstallationStoreLimits = RecipeInstallationStoreLimits(),
) : RecipeInstallationStore {
override suspend fun enrollIfAbsent(catalogId: String, trustPolicy: CatalogTrustPolicy): RecipeCatalogEnrollmentResult = try {
val ownedTrustPolicy = trustPolicy.copyForStore()
immediateTransaction {
val dao = room.recipeInstallationDao()
if (dao.checkpoint(catalogId) != null) return@immediateTransaction RecipeCatalogEnrollmentResult.AlreadyExists
if (!validRecipeInstallationTrustPolicy(catalogId, ownedTrustPolicy, limits, requireActiveKey = true) || dao.allCheckpoints().size >= limits.maxEnrolledCatalogs) {
return@immediateTransaction RecipeCatalogEnrollmentResult.Rejected
}
if (dao.insertCheckpoint(RecipeCatalogCheckpointRow(catalogId, 0)) == -1L) return@immediateTransaction RecipeCatalogEnrollmentResult.AlreadyExists
dao.insertTrustKeys(ownedTrustPolicy.trustedKeys.map { it.toRow() })
RecipeCatalogEnrollmentResult.Created
}
} catch (error: Throwable) {
if (error is CancellationException) throw error
RecipeCatalogEnrollmentResult.StoreFailure
}
override suspend fun readCatalog(catalogId: String): CatalogInstallationSnapshot? = immediateTransaction {
loadCatalog(room.recipeInstallationDao(), catalogId)
}
override suspend fun commitInstall(expectedGeneration: CatalogSnapshotGeneration, candidate: RecipeInstallCandidate): RecipeInstallCommitResult = immediateTransaction {
val dao = room.recipeInstallationDao()
val current = loadCatalog(dao, candidate.catalogId) ?: return@immediateTransaction RecipeInstallCommitResult.Rejected
when (val decision = decideRecipeInstallationCommit(current, expectedGeneration, candidate, clock.nowEpochSeconds(), limits)) {
RecipeInstallCommitResult.Applied -> {
ensureRecipeSource(candidate.record.sourceId, candidate.catalogId, candidate.record.stableId)
dao.upsertInstalled(candidate.record.toRow())
dao.upsertCheckpoint(candidate.catalogId.toCheckpoint(current.generation.value + 1, candidate.acceptedAcceptanceState))
RecipeInstallCommitResult.Applied
}
else -> decision
}
}
/** Explicit host uninstall; absence still advances the opaque generation and preserves replay. */
suspend fun uninstall(catalogId: String, expectedGeneration: CatalogSnapshotGeneration, stableId: String): RecipeInstallCommitResult = immediateTransaction {
val dao = room.recipeInstallationDao()
val current = loadCatalog(dao, catalogId) ?: return@immediateTransaction RecipeInstallCommitResult.Rejected
if (current.generation.value != expectedGeneration.value) return@immediateTransaction RecipeInstallCommitResult.Conflict
if (current.generation.value == Long.MAX_VALUE) return@immediateTransaction RecipeInstallCommitResult.Rejected
dao.deleteInstalled(catalogId, stableId)
dao.upsertCheckpoint(catalogId.toCheckpoint(current.generation.value + 1, current.acceptanceState))
RecipeInstallCommitResult.Applied
}
/** Explicit host trust replacement; all-revoked policy is permitted for emergency revocation. */
suspend fun replaceTrustPolicy(
catalogId: String,
expectedGeneration: CatalogSnapshotGeneration,
trustPolicy: CatalogTrustPolicy,
): RecipeInstallCommitResult {
val ownedTrustPolicy = trustPolicy.copyForStore()
return immediateTransaction {
val dao = room.recipeInstallationDao()
val current = loadCatalog(dao, catalogId) ?: return@immediateTransaction RecipeInstallCommitResult.Rejected
if (current.generation.value != expectedGeneration.value) return@immediateTransaction RecipeInstallCommitResult.Conflict
if (!validRecipeInstallationTrustPolicy(catalogId, ownedTrustPolicy, limits, requireActiveKey = false) || current.generation.value == Long.MAX_VALUE) {
return@immediateTransaction RecipeInstallCommitResult.Rejected
}
dao.deleteTrustKeys(catalogId)
dao.insertTrustKeys(ownedTrustPolicy.trustedKeys.map { it.toRow() })
dao.upsertCheckpoint(catalogId.toCheckpoint(current.generation.value + 1, current.acceptanceState))
RecipeInstallCommitResult.Applied
}
}
private suspend fun loadCatalog(dao: RecipeInstallationDao, catalogId: String): CatalogInstallationSnapshot? {
val checkpoint = dao.checkpoint(catalogId) ?: return null
if (checkpoint.catalogId != catalogId || !validRecipeInstallationCatalogId(catalogId) || checkpoint.generation < 0) {
throw IllegalStateException("Corrupt recipe catalog checkpoint")
}
val trust = CatalogTrustPolicy(catalogId, dao.trustKeys(catalogId).map { row ->
val state = TrustedCatalogKeyState.entries.firstOrNull { it.name == row.state }
?: throw IllegalStateException("Corrupt recipe trust-key state")
TrustedCatalogKey(catalogId, row.keyId, row.rawEd25519PublicKey, state, row.validFromEpochSeconds, row.validUntilEpochSeconds)
})
if (!validRecipeInstallationTrustPolicy(catalogId, trust, limits, requireActiveKey = false)) throw IllegalStateException("Corrupt recipe trust policy")
val replay = when {
checkpoint.replayRevision == null && checkpoint.replayPayloadHash == null -> null
checkpoint.replayRevision != null && checkpoint.replayRevision >= 0 && checkpoint.replayPayloadHash?.size == 32 ->
CatalogAcceptanceState(catalogId, checkpoint.replayRevision, checkpoint.replayPayloadHash)
else -> throw IllegalStateException("Corrupt recipe replay checkpoint")
}
val installed = dao.installed(catalogId).associate { row ->
if (row.catalogId != catalogId || row.catalogRevision < 0) throw IllegalStateException("Corrupt recipe installation")
val expectedSourceId = recipeSourceId(catalogId, row.stableId)
val sourceId = row.sourceId ?: expectedSourceId
if (sourceId != expectedSourceId) throw IllegalStateException("Corrupt recipe source association")
if (row.sourceId == null) dao.upsertInstalled(row.copy(sourceId = sourceId))
ensureRecipeSource(sourceId, catalogId, row.stableId)
val record = InstalledRecipeRecord(catalogId, row.stableId, row.catalogRevision, row.releaseVersion, row.sha256, row.sizeBytes, row.artifactBytes, sourceId)
if (!validRecipeInstallationArtifactRecord(record)) throw IllegalStateException("Corrupt recipe installation")
row.stableId to record
}
if (installed.size > limits.maxInstalledRecipesPerCatalog || !fitsTotalArtifactQuota(installed.values)) throw IllegalStateException("Corrupt recipe quota")
return CatalogInstallationSnapshot(catalogId, CatalogSnapshotGeneration(checkpoint.generation), trust, replay, installed)
}
private fun fitsTotalArtifactQuota(records: Collection<InstalledRecipeRecord>): Boolean {
var total = 0L
for (record in records) {
if (total > limits.maxArtifactBytesPerCatalog - record.sizeBytes) return false
total += record.sizeBytes
}
return true
}
private suspend fun ensureRecipeSource(sourceId: Long, catalogId: String, stableId: String) {
val sourceDao = room.sourceDao()
val existing = sourceDao.source(sourceId)
if (existing == null) {
sourceDao.upsert(
SourceRow(
id = sourceId,
name = stableId,
itemType = "Manga",
// Installing the recipe is the install: without this it never reaches Browse (which lists added sources).
isAdded = true,
typeSource = RecipeSourceDiscriminator,
sourceCodeLanguage = "JavaScript",
additionalParams = recipeSourceReference(catalogId, stableId),
),
)
return
}
val reference = parseRecipeSourceReference(existing.additionalParams)
if (existing.typeSource != RecipeSourceDiscriminator || reference?.catalogId != catalogId || reference.stableId != stableId) {
throw IllegalStateException("Corrupt recipe source association")
}
}
private suspend fun <T> immediateTransaction(block: suspend () -> T): T = room.useWriterConnection { connection ->
connection.withTransaction(Transactor.SQLiteTransactionType.IMMEDIATE) { block() }
}
}
private fun TrustedCatalogKey.toRow(): RecipeCatalogTrustKeyRow = RecipeCatalogTrustKeyRow(
catalogId, keyId, rawEd25519PublicKey.copyOf(), state.name, validFromEpochSeconds, validUntilEpochSeconds,
)
private fun CatalogTrustPolicy.copyForStore(): CatalogTrustPolicy = CatalogTrustPolicy(
catalogId,
trustedKeys.map { key ->
TrustedCatalogKey(key.catalogId, key.keyId, key.rawEd25519PublicKey.copyOf(), key.state, key.validFromEpochSeconds, key.validUntilEpochSeconds)
},
)
private fun InstalledRecipeRecord.toRow(): RecipeCatalogInstalledRow = RecipeCatalogInstalledRow(
catalogId, stableId, catalogRevision, releaseVersion, sha256, sizeBytes, artifactBytes, sourceId,
)
private fun String.toCheckpoint(generation: Long, replay: CatalogAcceptanceState?): RecipeCatalogCheckpointRow = RecipeCatalogCheckpointRow(
this, generation, replay?.highestRevision, replay?.payloadHash,
)
composeApp/src/nonWebMain/kotlin/eu/friedcutlet/yokan/database/room/RoomYokanDatabase.kt
- Source · implementation · 740 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
84: class RoomYokanDatabase(
163: override fun snapshot(): YokanDatabaseSnapshot = delegate.snapshot()
164: override fun snapshots(): StateFlow<YokanDatabaseSnapshot> = delegate.snapshots()
166: override fun supportsAtomicSnapshotPersistence(): Boolean = true
168: override suspend fun awaitPersistence() {
182: override suspend fun close() = retirementLock.withLock {
205: override suspend fun replaceAllAtomically(
223: override suspend fun replaceAllRemoteAtomically(snapshot: YokanDatabaseSnapshot, expectedSnapshot: YokanDatabaseSnapshot?) {
233: override fun settings(): DbSettings = delegate.settings()
234: override fun mangas(itemType: DbItemType?) = delegate.mangas(itemType)
235: override fun manga(id: Long) = delegate.manga(id)
236: override fun chapters(mangaId: Long?) = delegate.chapters(mangaId)
237: override fun chapter(id: Long) = delegate.chapter(id)
238: override fun categories(itemType: DbItemType?) = delegate.categories(itemType)
239: override fun sources(itemType: DbItemType?) = delegate.sources(itemType)
240: override fun source(id: Long) = delegate.source(id)
241: override fun histories() = delegate.histories()
242: override fun updates() = delegate.updates()
243: override fun downloads() = delegate.downloads()
244: override fun download(id: Long) = delegate.download(id)
245: override fun tracks(mangaId: Long?) = delegate.tracks(mangaId)
246: override fun trackPreferences() = delegate.trackPreferences()
247: override fun trackSearches(syncId: Int?) = delegate.trackSearches(syncId)
248: override fun syncPreferences() = delegate.syncPreferences()
249: override fun changedParts() = delegate.changedParts()
250: override fun customButtons() = delegate.customButtons()
251: override fun pageCache(chapterId: Long?) = delegate.pageCache(chapterId)
252: override fun outbox() = delegate.outbox()
255: override fun updateSettings(settings: DbSettings) = tracked({ delegate.updateSettings(settings) }) {
259: override fun replaceAll(
264: override fun upsertManga(manga: DbManga): DbManga = batchLock.withLock {
275: override fun removeManga(id: Long, recordChange: Boolean) = tracked({ delegate.removeManga(id, recordChange) }) {
279: override fun upsertChapter(chapter: DbChapter): DbChapter = tracked({ delegate.upsertChapter(chapter) }) { saved ->
283: override fun removeChapter(id: Long, recordChange: Boolean) = tracked({ delegate.removeChapter(id, recordChange) }) {
288: override fun upsertCategory(category: DbCategory): DbCategory = tracked({ delegate.upsertCategory(category) }) { saved ->
292: override fun removeCategory(id: Long, recordChange: Boolean) = tracked({ delegate.removeCategory(id, recordChange) }) {
296: override fun upsertSource(source: DbSource): DbSource {
302: override fun removeSource(id: Long) {
306: override fun upsertHistory(history: DbHistory): DbHistory = tracked({ delegate.upsertHistory(history) }) { saved ->
310: override fun removeHistory(id: Long, recordChange: Boolean) = tracked({ delegate.removeHistory(id, recordChange) }) {
314: override fun upsertUpdate(update: DbUpdate): DbUpdate = tracked({ delegate.upsertUpdate(update) }) { saved ->
318: override fun removeUpdate(id: Long, recordChange: Boolean) = tracked({ delegate.removeUpdate(id, recordChange) }) {
322: override fun upsertDownload(download: DbDownload): DbDownload {
328: override fun removeDownload(id: Long) {
332: override fun upsertTrack(track: DbTrack): DbTrack = tracked({ delegate.upsertTrack(track) }) { saved ->
336: override fun removeTrack(id: Long, recordChange: Boolean) = tracked({ delegate.removeTrack(id, recordChange) }) {
340: override fun upsertTrackPreference(preference: DbTrackPreference): DbTrackPreference {
346: override fun upsertTrackSearch(search: DbTrackSearch): DbTrackSearch {
352: override fun upsertSyncPreference(preference: DbSyncPreference): DbSyncPreference {
358: override suspend fun upsertSyncPreferenceIf(
375: override fun recordChange(change: DbChangedPart): DbChangedPart {
381: override fun clearChangedParts() {
385: override fun upsertCustomButton(button: DbCustomButton): DbCustomButton {
391: override fun removeCustomButton(id: Long) {
395: override fun upsertPageCache(cache: DbChapterPageUrls): DbChapterPageUrls = batchLock.withLock {
407: override fun removePageCache(chapterIds: Collection<Long>) {
413: override fun clearPageCache() {
418: override fun removeOutbox(ops: List<DbOutboxOp>) {
424: override suspend fun resyncHub(syncId: Long, epoch: Int): DbSyncPreference {
446: override fun <T> applyRemote(block: () -> T): T = batchLock.withLock {
456: override fun <T> batch(block: () -> T): T = batchLock.withLock {
476: private inline fun <T> tracked(crossinline mutation: () -> T, crossinline persist: suspend (T) -> Unit): T =
491: private inline fun <T> mutate(crossinline mutation: () -> T, crossinline persist: suspend (T) -> Unit): T =
499: private fun queueWrite(action: suspend () -> Unit) {
506: private fun enqueue(coalesce: Boolean = true, action: suspend () -> Unit) {
511: private suspend fun enqueueAndAwait(action: suspend () -> Unit) {
526: private suspend fun commit(pending: MutableList<suspend () -> Unit>) {
533: private suspend fun retrying(write: suspend () -> Unit) {
548: private suspend fun inTransaction(block: suspend () -> Unit) {
554: private fun replaceAllSynchronously(
588: private suspend fun removeRecipeInstallations(removedSourceIds: Set<Long>, expectedSourceIds: Set<Long>) {
618: private suspend fun readAllFromRoom(): YokanDatabaseSnapshot? = coroutineScope {
677: private suspend fun writeAllTables(snapshot: YokanDatabaseSnapshot, clearFirst: Boolean) {
715: private suspend fun importSnapshot(snapshot: YokanDatabaseSnapshot) {
730: private class QueuedWrite(val coalesce: Boolean, val action: suspend () -> Unit)
737: private fun YokanDatabaseSnapshot.withMangayomiDeletes(before: YokanDatabaseSnapshot): YokanDatabaseSnapshot {
Exact file bytes / download · SHA-256 55360458f593a6158dbb2fce682118026d650d0f3b3ec0468212c932cbbfb944.
Complete file
package eu.friedcutlet.yokan.database.room
import androidx.room.Transactor
import androidx.room.useWriterConnection
import eu.friedcutlet.yokan.database.DbCategory
import eu.friedcutlet.yokan.database.DbChangedPart
import eu.friedcutlet.yokan.database.DbChapter
import eu.friedcutlet.yokan.database.DbChapterPageUrls
import eu.friedcutlet.yokan.database.DbCustomButton
import eu.friedcutlet.yokan.database.DbDownload
import eu.friedcutlet.yokan.database.DbHistory
import eu.friedcutlet.yokan.database.DbItemType
import eu.friedcutlet.yokan.database.DbManga
import eu.friedcutlet.yokan.database.DbOutboxOp
import eu.friedcutlet.yokan.database.DbSettings
import eu.friedcutlet.yokan.database.DbSource
import eu.friedcutlet.yokan.database.DbSyncPreference
import eu.friedcutlet.yokan.database.SyncServerProvider
import eu.friedcutlet.yokan.database.DbTrack
import eu.friedcutlet.yokan.database.DbTrackPreference
import eu.friedcutlet.yokan.database.DbTrackSearch
import eu.friedcutlet.yokan.database.DbUpdate
import eu.friedcutlet.yokan.database.InMemoryYokanDatabase
import eu.friedcutlet.yokan.database.SnapshotReplacementConflictException
import eu.friedcutlet.yokan.database.YokanDatabase
import eu.friedcutlet.yokan.database.YokanDatabaseSnapshot
import eu.friedcutlet.yokan.database.seedDatabaseSnapshot
import eu.friedcutlet.yokan.database.withMangayomiLocalSyncTimestamps
import eu.friedcutlet.yokan.database.sync.hubResync
import eu.friedcutlet.yokan.database.sync.mangayomiDeleteParts
import eu.friedcutlet.yokan.services.extensions.recipe.recipeSourceId
import eu.friedcutlet.yokan.services.catchingNonCancellation
import eu.friedcutlet.yokan.services.logging.AppLogger
import eu.friedcutlet.yokan.util.PlatformLock
import eu.friedcutlet.yokan.util.nowMillis
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.delay
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import kotlinx.coroutines.withTimeout
import kotlinx.coroutines.cancelAndJoin
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
/**
* Persists every `YokanDatabase` mutation through Room while keeping
* `InMemoryYokanDatabase` as the synchronous read surface. This preserves
* the existing `YokanDatabase` contract (synchronous, non-suspend methods)
* across every call site in the app while replacing the old write-through
* "serialize the whole JSON snapshot on every change" with "INSERT … ON
* CONFLICT one row".
*
* Lifecycle:
* • Construction (synchronous) — block once on a Room load, hydrate the
* in-memory delegate from it. If Room is empty and a legacy JSON snapshot
* was provided, seed Room from that snapshot in the background.
* • Mutations — apply to the in-memory delegate first (so reads see the
* change immediately), then enqueue a Room write on a dedicated scope.
* The queue is ordered so deletes/updates are applied serially, and the
* worker commits everything queued since its last commit in one
* transaction instead of one per row. Enqueueing never blocks.
* • Hub outbox — every synced write may append ops to the delegate's
* outbox; the rows added by one mutation are persisted in the same
* queued action as the row itself.
*
* Why a write queue instead of suspending API: every existing call site of
* `YokanDatabase` is non-suspend. Threading suspend through the codebase is
* a much larger change; queueing keeps Room writes off the calling thread
* without changing the contract.
*/
class RoomYokanDatabase(
internal val room: YokanRoomDatabase,
legacySnapshotProvider: () -> YokanDatabaseSnapshot? = { null },
private val closeTimeoutMillis: Long = 15_000,
) : YokanDatabase {
private val scope = CoroutineScope(roomPersistenceDispatcher + SupervisorJob())
// ponytail: unbounded, so no caller (the UI thread included) ever blocks on a full queue; the
// backlog only grows while Room keeps failing. Bound it once the API can suspend.
private val writes = Channel<QueuedWrite>(Channel.UNLIMITED)
private val batchLock = PlatformLock()
private val batchedWrites = mutableListOf<suspend () -> Unit>()
private var persistenceBatchDepth = 0
private var remoteApplyDepth = 0
private val startupReady = CompletableDeferred<Unit>()
private val delegate: InMemoryYokanDatabase
private val retirementLock = Mutex()
private var acceptingWrites = true // guarded by batchLock
private var queueClosed = false
private var closed = false
private val worker: Job
init {
require(closeTimeoutMillis > 0)
// Synchronous hydrate so YokanDatabase callers see a fully-formed
// snapshot on the first call. Blocks the bootstrap thread once, off
// the UI thread, on the same dedicated dispatcher used by Room.
val hydrated = runBlocking(roomPersistenceDispatcher) { readAllFromRoom() }
val initial = when {
hydrated != null -> hydrated
else -> {
// Cold Room — invoke the legacy JSON provider only now. On
// every subsequent boot Room has data so this allocator
// never runs and the JSON file is never read.
val legacy = legacySnapshotProvider()
if (legacy != null) {
legacy
} else {
seedDatabaseSnapshot()
}
}
}
delegate = InMemoryYokanDatabase(initial)
// Persist the initial seed or imported legacy snapshot when Room is empty.
if (hydrated == null) {
val seed = delegate.snapshot()
scope.launch {
// A failed first import must not make a later flush look successful.
retrying { importSnapshot(seed) }
startupReady.complete(Unit)
}
} else {
// The delegate dropped the epoch-0 ops no hub accepts; drop them from Room as well.
if (delegate.outbox().size < hydrated.outbox.size) enqueue { room.outboxDao().clearUnnegotiated() }
startupReady.complete(Unit)
}
// Write worker — serial execution preserves causal ordering so a
// delete that follows an upsert can't race ahead.
worker = scope.launch {
startupReady.await()
val pending = ArrayList<suspend () -> Unit>()
for (first in writes) {
var write: QueuedWrite? = first
while (write != null) {
if (write.coalesce) {
pending += write.action
} else {
commit(pending)
retrying(write.action)
}
write = writes.tryReceive().getOrNull()
}
commit(pending)
}
}
}
// ── reads (pass-through) ────────────────────────────────────────────────
override fun snapshot(): YokanDatabaseSnapshot = delegate.snapshot()
override fun snapshots(): StateFlow<YokanDatabaseSnapshot> = delegate.snapshots()
override fun supportsAtomicSnapshotPersistence(): Boolean = true
override suspend fun awaitPersistence() {
val completion = CompletableDeferred<Unit>()
batchLock.withLock {
check(!queueClosed) { "Room write queue is closed" }
enqueue(coalesce = false) {
inTransaction { }
completion.complete(Unit)
}
}
// A flush is cancellable, unlike a mutation whose transaction must be joined.
// Its harmless queued barrier remains ordered if the caller times out.
completion.await()
}
override suspend fun close() = retirementLock.withLock {
if (closed) return@withLock
withContext(NonCancellable) {
batchLock.withLock { acceptingWrites = false }
try {
if (!queueClosed) {
withTimeout(closeTimeoutMillis) {
awaitPersistence()
batchLock.withLock { writes.close(); queueClosed = true }
worker.join()
}
}
scope.coroutineContext[Job]?.cancelAndJoin()
room.close()
closed = true
} catch (error: Throwable) {
// Before channel closure, leave both pending writes and the live database usable.
if (!queueClosed) batchLock.withLock { acceptingWrites = true }
throw error
}
}
}
override suspend fun replaceAllAtomically(
snapshot: YokanDatabaseSnapshot,
expectedSnapshot: YokanDatabaseSnapshot?,
removedSourceIds: Set<Long>,
) {
val callerJob = currentCoroutineContext()[Job]
batchLock.withLock {
check(persistenceBatchDepth == 0) { "Snapshot replacement cannot run inside a mutation batch" }
check(remoteApplyDepth == 0) { "Snapshot replacement cannot run inside remote apply" }
callerJob?.ensureActive()
}
// Do not block the serialized Room lane while waiting for its queued
// transaction to complete.
withContext(roomReplacementDispatcher) {
replaceAllSynchronously(snapshot, expectedSnapshot, callerJob, removedSourceIds)
}
}
override suspend fun replaceAllRemoteAtomically(snapshot: YokanDatabaseSnapshot, expectedSnapshot: YokanDatabaseSnapshot?) {
val callerJob = currentCoroutineContext()[Job]
batchLock.withLock {
check(persistenceBatchDepth == 0) { "Snapshot replacement cannot run inside a mutation batch" }
callerJob?.ensureActive()
}
withContext(roomReplacementDispatcher) {
replaceAllSynchronously(snapshot, expectedSnapshot, callerJob, remoteApply = true)
}
}
override fun settings(): DbSettings = delegate.settings()
override fun mangas(itemType: DbItemType?) = delegate.mangas(itemType)
override fun manga(id: Long) = delegate.manga(id)
override fun chapters(mangaId: Long?) = delegate.chapters(mangaId)
override fun chapter(id: Long) = delegate.chapter(id)
override fun categories(itemType: DbItemType?) = delegate.categories(itemType)
override fun sources(itemType: DbItemType?) = delegate.sources(itemType)
override fun source(id: Long) = delegate.source(id)
override fun histories() = delegate.histories()
override fun updates() = delegate.updates()
override fun downloads() = delegate.downloads()
override fun download(id: Long) = delegate.download(id)
override fun tracks(mangaId: Long?) = delegate.tracks(mangaId)
override fun trackPreferences() = delegate.trackPreferences()
override fun trackSearches(syncId: Int?) = delegate.trackSearches(syncId)
override fun syncPreferences() = delegate.syncPreferences()
override fun changedParts() = delegate.changedParts()
override fun customButtons() = delegate.customButtons()
override fun pageCache(chapterId: Long?) = delegate.pageCache(chapterId)
override fun outbox() = delegate.outbox()
// ── writes (in-memory + Room queue) ─────────────────────────────────────
override fun updateSettings(settings: DbSettings) = tracked({ delegate.updateSettings(settings) }) {
room.settingsDao().upsert(settings.toRow())
}
override fun replaceAll(
snapshot: YokanDatabaseSnapshot,
expectedSnapshot: YokanDatabaseSnapshot?,
) = replaceAllSynchronously(snapshot, expectedSnapshot, null)
override fun upsertManga(manga: DbManga): DbManga = batchLock.withLock {
val previousCast = delegate.manga(manga.id)?.cast
tracked({ delegate.upsertManga(manga) }) { saved ->
room.mangaDao().upsert(saved.toRow())
if (previousCast != saved.cast) {
room.mangaCreditDao().deleteForManga(saved.id)
if (saved.cast.isNotEmpty()) room.mangaCreditDao().upsertAll(saved.toCreditRows())
}
}
}
override fun removeManga(id: Long, recordChange: Boolean) = tracked({ delegate.removeManga(id, recordChange) }) {
room.mangaDao().delete(id)
}
override fun upsertChapter(chapter: DbChapter): DbChapter = tracked({ delegate.upsertChapter(chapter) }) { saved ->
room.chapterDao().upsert(saved.toRow())
}
override fun removeChapter(id: Long, recordChange: Boolean) = tracked({ delegate.removeChapter(id, recordChange) }) {
room.chapterDao().delete(id)
room.pageCacheDao().delete(id)
}
override fun upsertCategory(category: DbCategory): DbCategory = tracked({ delegate.upsertCategory(category) }) { saved ->
room.categoryDao().upsert(saved.toRow())
}
override fun removeCategory(id: Long, recordChange: Boolean) = tracked({ delegate.removeCategory(id, recordChange) }) {
room.categoryDao().delete(id)
}
override fun upsertSource(source: DbSource): DbSource {
return mutate({ delegate.upsertSource(source) }) { saved ->
room.sourceDao().upsert(saved.toRow())
}
}
override fun removeSource(id: Long) {
mutate({ delegate.removeSource(id) }) { room.sourceDao().delete(id) }
}
override fun upsertHistory(history: DbHistory): DbHistory = tracked({ delegate.upsertHistory(history) }) { saved ->
room.historyDao().upsert(saved.toRow())
}
override fun removeHistory(id: Long, recordChange: Boolean) = tracked({ delegate.removeHistory(id, recordChange) }) {
room.historyDao().delete(id)
}
override fun upsertUpdate(update: DbUpdate): DbUpdate = tracked({ delegate.upsertUpdate(update) }) { saved ->
room.updateDao().upsert(saved.toRow())
}
override fun removeUpdate(id: Long, recordChange: Boolean) = tracked({ delegate.removeUpdate(id, recordChange) }) {
room.updateDao().delete(id)
}
override fun upsertDownload(download: DbDownload): DbDownload {
return mutate({ delegate.upsertDownload(download) }) { saved ->
room.downloadDao().upsert(saved.toRow())
}
}
override fun removeDownload(id: Long) {
mutate({ delegate.removeDownload(id) }) { room.downloadDao().delete(id) }
}
override fun upsertTrack(track: DbTrack): DbTrack = tracked({ delegate.upsertTrack(track) }) { saved ->
room.trackDao().upsert(saved.toRow())
}
override fun removeTrack(id: Long, recordChange: Boolean) = tracked({ delegate.removeTrack(id, recordChange) }) {
room.trackDao().delete(id)
}
override fun upsertTrackPreference(preference: DbTrackPreference): DbTrackPreference {
return mutate({ delegate.upsertTrackPreference(preference) }) { saved ->
room.trackPreferenceDao().upsert(saved.toRow())
}
}
override fun upsertTrackSearch(search: DbTrackSearch): DbTrackSearch {
return mutate({ delegate.upsertTrackSearch(search) }) { saved ->
room.trackSearchDao().upsert(saved.toRow())
}
}
override fun upsertSyncPreference(preference: DbSyncPreference): DbSyncPreference {
return mutate({ delegate.upsertSyncPreference(preference) }) { saved ->
room.syncPreferenceDao().upsert(saved.toRow())
}
}
override suspend fun upsertSyncPreferenceIf(
syncId: Long,
accepts: (DbSyncPreference?) -> Boolean,
transform: (DbSyncPreference?) -> DbSyncPreference,
): Boolean {
val accepted = batchLock.withLock {
check(acceptingWrites) { "Room database is retiring or closed" }
val current = delegate.syncPreferences().firstOrNull { it.syncId == syncId }
if (!accepts(current)) return@withLock false
val updated = delegate.upsertSyncPreference(transform(current).copy(syncId = syncId))
queueWrite { room.syncPreferenceDao().upsert(updated.toRow()) }
true
}
if (accepted) withContext(NonCancellable) { awaitPersistence() }
return accepted
}
override fun recordChange(change: DbChangedPart): DbChangedPart {
return mutate({ delegate.recordChange(change) }) { saved ->
room.changedPartDao().upsert(saved.toRow())
}
}
override fun clearChangedParts() {
mutate({ delegate.clearChangedParts() }) { room.changedPartDao().clear() }
}
override fun upsertCustomButton(button: DbCustomButton): DbCustomButton {
return mutate({ delegate.upsertCustomButton(button) }) { saved ->
room.customButtonDao().upsert(saved.toRow())
}
}
override fun removeCustomButton(id: Long) {
mutate({ delegate.removeCustomButton(id) }) { room.customButtonDao().delete(id) }
}
override fun upsertPageCache(cache: DbChapterPageUrls): DbChapterPageUrls = batchLock.withLock {
check(acceptingWrites) { "Room database is retiring or closed" }
val before = delegate.pageCache().mapNotNullTo(HashSet()) { it.chapterId }
val saved = delegate.upsertPageCache(cache)
val evicted = before - delegate.pageCache().mapNotNullTo(HashSet()) { it.chapterId }
queueWrite {
room.pageCacheDao().upsert(saved.toRow())
evicted.forEach { room.pageCacheDao().delete(it) }
}
saved
}
override fun removePageCache(chapterIds: Collection<Long>) {
val ids = chapterIds.toList()
if (ids.isEmpty()) return
mutate({ delegate.removePageCache(ids) }) { ids.forEach { room.pageCacheDao().delete(it) } }
}
override fun clearPageCache() {
mutate({ delegate.clearPageCache() }) { room.pageCacheDao().clear() }
}
// ── hub sync ────────────────────────────────────────────────────────────
override fun removeOutbox(ops: List<DbOutboxOp>) {
mutate({ delegate.removeOutbox(ops) }) {
ops.forEach { room.outboxDao().deleteIfUnchanged(it.kind, it.id, it.path, it.seq) }
}
}
override suspend fun resyncHub(syncId: Long, epoch: Int): DbSyncPreference {
val updated = batchLock.withLock {
check(acceptingWrites) { "Room database is retiring or closed" }
val current = delegate.syncPreferences().firstOrNull { it.syncId == syncId }
?: DbSyncPreference(syncId = syncId)
val (resynced, dropBefore) = current.hubResync(epoch)
val stale = dropBefore?.let { floor -> delegate.outbox().filter { it.epoch < floor } }.orEmpty()
val updated = delegate.batch {
delegate.removeOutbox(stale)
delegate.upsertSyncPreference(resynced)
}
// Queued under the lock so no later write to the same rows can overtake it.
queueWrite {
room.syncPreferenceDao().upsert(updated.toRow())
stale.forEach { room.outboxDao().deleteIfUnchanged(it.kind, it.id, it.path, it.seq) }
}
updated
}
withContext(NonCancellable) { awaitPersistence() }
return updated
}
override fun <T> applyRemote(block: () -> T): T = batchLock.withLock {
check(acceptingWrites) { "Room database is retiring or closed" }
remoteApplyDepth++
try {
delegate.applyRemote(block)
} finally {
remoteApplyDepth--
}
}
override fun <T> batch(block: () -> T): T = batchLock.withLock {
check(acceptingWrites) { "Room database is retiring or closed" }
persistenceBatchDepth++
try {
delegate.batch(block)
} finally {
persistenceBatchDepth--
if (persistenceBatchDepth == 0 && batchedWrites.isNotEmpty()) {
val batched = batchedWrites.toList()
batchedWrites.clear()
// One queued action, so the whole batch always lands in the same transaction.
enqueue { batched.forEach { it() } }
}
}
}
/**
* Run a synced mutation on the delegate, then queue its Room row write together with
* whatever outbox ops the mutation appended.
*/
private inline fun <T> tracked(crossinline mutation: () -> T, crossinline persist: suspend (T) -> Unit): T =
batchLock.withLock {
check(acceptingWrites) { "Room database is retiring or closed" }
val oldChangedIds = delegate.changedParts().mapTo(HashSet(), DbChangedPart::id)
val (result, ops) = delegate.recordingOutbox { mutation() }
val rows = ops.map { it.toRow() }
val changedRows = delegate.changedParts().filter { it.id !in oldChangedIds }.map { it.toRow() }
queueWrite {
persist(result)
if (rows.isNotEmpty()) room.outboxDao().upsertAll(rows)
if (changedRows.isNotEmpty()) room.changedPartDao().upsertAll(changedRows)
}
result
}
private inline fun <T> mutate(crossinline mutation: () -> T, crossinline persist: suspend (T) -> Unit): T =
batchLock.withLock {
check(acceptingWrites) { "Room database is retiring or closed" }
val result = mutation()
queueWrite { persist(result) }
result
}
private fun queueWrite(action: suspend () -> Unit) {
batchLock.withLock {
if (persistenceBatchDepth > 0) batchedWrites += action else enqueue(action = action)
}
}
/** [coalesce]d writes share the worker's next transaction; others bring their own. */
private fun enqueue(coalesce: Boolean = true, action: suspend () -> Unit) {
check(writes.trySend(QueuedWrite(coalesce, action)).isSuccess) { "Room write queue is closed" }
}
/** Run [action] in its own transaction once everything queued before it is committed. */
private suspend fun enqueueAndAwait(action: suspend () -> Unit) {
val completion = CompletableDeferred<Unit>()
enqueue(coalesce = false) {
try {
inTransaction(action)
completion.complete(Unit)
} catch (error: Throwable) {
// Always release the blocked caller, but let cancellation keep propagating.
completion.completeExceptionally(error)
if (error is CancellationException) throw error
}
}
withContext(NonCancellable) { completion.await() }
}
private suspend fun commit(pending: MutableList<suspend () -> Unit>) {
if (pending.isEmpty()) return
val actions = pending.toList()
pending.clear()
retrying { inTransaction { actions.forEach { it() } } }
}
private suspend fun retrying(write: suspend () -> Unit) {
var attempt = 0
while (true) {
try {
write()
return
} catch (error: Throwable) {
if (error is CancellationException) throw error
attempt++
AppLogger.error("[room] write failed (attempt $attempt; retrying): ${error.message.orEmpty()}")
delay((50L shl attempt.coerceAtMost(6)).coerceAtMost(MAX_WRITE_RETRY_DELAY_MS))
}
}
}
private suspend fun inTransaction(block: suspend () -> Unit) {
room.useWriterConnection { connection ->
connection.withTransaction(Transactor.SQLiteTransactionType.IMMEDIATE) { block() }
}
}
private fun replaceAllSynchronously(
snapshot: YokanDatabaseSnapshot,
expectedSnapshot: YokanDatabaseSnapshot?,
callerJob: Job?,
removedSourceIds: Set<Long> = emptySet(),
remoteApply: Boolean = false,
) = batchLock.withLock {
check(acceptingWrites) { "Room database is retiring or closed" }
check(persistenceBatchDepth == 0) { "Snapshot replacement cannot run inside a mutation batch" }
check(remoteApplyDepth == 0) { "Snapshot replacement cannot run inside remote apply" }
callerJob?.ensureActive()
if (expectedSnapshot != null && delegate.snapshot() != expectedSnapshot) {
throw SnapshotReplacementConflictException()
}
val expectedSourceIds = delegate.sources().mapTo(HashSet(), DbSource::id)
if (removedSourceIds.isNotEmpty() &&
(!expectedSourceIds.containsAll(removedSourceIds) || snapshot.sources.any { it.id in removedSourceIds })
) {
throw SnapshotReplacementConflictException()
}
val target = if (remoteApply) snapshot else snapshot.withMangayomiLocalSyncTimestamps(delegate.snapshot()).withMangayomiDeletes(delegate.snapshot())
// Blocks by contract: the snapshot is published only after Room committed it. The
// suspending replaceAllAtomically runs this on roomReplacementDispatcher instead.
runBlocking {
enqueueAndAwait {
if (removedSourceIds.isNotEmpty()) {
removeRecipeInstallations(removedSourceIds, expectedSourceIds)
}
writeAllTables(target, clearFirst = true)
}
}
delegate.applyRemote { delegate.replaceAll(target) }
}
private suspend fun removeRecipeInstallations(removedSourceIds: Set<Long>, expectedSourceIds: Set<Long>) {
val actualSourceIds = room.sourceDao().all().mapTo(HashSet()) { it.id }
if (actualSourceIds != expectedSourceIds) throw SnapshotReplacementConflictException()
val installationDao = room.recipeInstallationDao()
val affected = installationDao.allInstalled().filter { row ->
if (row.catalogId.isBlank() || row.stableId.isBlank() || row.catalogRevision < 0) {
throw IllegalStateException("Corrupt recipe installation")
}
val expectedId = recipeSourceId(row.catalogId, row.stableId)
if (row.sourceId != null && row.sourceId != expectedId) {
throw IllegalStateException("Corrupt recipe source association")
}
(row.sourceId ?: expectedId) in removedSourceIds
}
val byCatalog = affected.groupBy { it.catalogId }
for ((catalogId, rows) in byCatalog) {
val checkpoint = installationDao.checkpoint(catalogId)
?: throw IllegalStateException("Corrupt recipe catalog checkpoint")
if (checkpoint.catalogId != catalogId || checkpoint.generation < 0) {
throw IllegalStateException("Corrupt recipe catalog checkpoint")
}
if (checkpoint.generation == Long.MAX_VALUE) {
throw IllegalStateException("Recipe catalog generation overflow")
}
rows.forEach { installationDao.deleteInstalled(it.catalogId, it.stableId) }
installationDao.upsertCheckpoint(checkpoint.copy(generation = checkpoint.generation + 1))
}
}
private suspend fun readAllFromRoom(): YokanDatabaseSnapshot? = coroutineScope {
// Fan-out every table read on the dedicated Room dispatcher. SQLite
// serializes statements internally, and this view also orders the
// worker's writes, hydration, and startup import.
val mangasJob = async {
val credits = room.mangaCreditDao().all().groupBy({ it.mangaId }, { it.toCredit() })
room.mangaDao().all().map { it.toDb().copy(cast = credits[it.id].orEmpty()) }
}
val chaptersJob = async { room.chapterDao().all().map(ChapterRow::toDb) }
val categoriesJob = async { room.categoryDao().all().map(CategoryRow::toDb) }
val sourcesJob = async { room.sourceDao().all().map(SourceRow::toDb) }
val historiesJob = async { room.historyDao().all().map(HistoryRow::toDb) }
val updatesJob = async { room.updateDao().all().map(UpdateRow::toDb) }
val downloadsJob = async { room.downloadDao().all().map(DownloadRow::toDb) }
val tracksJob = async { room.trackDao().all().map(TrackRow::toDb) }
val trackPrefsJob = async { room.trackPreferenceDao().all().map(TrackPreferenceRow::toDb) }
val trackSearchesJob = async { room.trackSearchDao().all().map(TrackSearchRow::toDb) }
val syncPrefsJob = async { room.syncPreferenceDao().all().map(SyncPreferenceRow::toDb) }
val changedPartsJob = async { room.changedPartDao().all().map(ChangedPartRow::toDb) }
val customButtonsJob = async { room.customButtonDao().all().map(CustomButtonRow::toDb) }
val pageCacheJob = async { room.pageCacheDao().all().map(PageCacheRow::toDb) }
val outboxJob = async { room.outboxDao().all().map(OutboxRow::toDb) }
val settingsJob = async { room.settingsDao().get() }
// awaitAll on each list one at a time to keep the structured-concurrency
// surface tidy and let the JIT cache the Db* mappers.
val mangas = mangasJob.await()
val chapters = chaptersJob.await()
val settingsRow = settingsJob.await()
// Treat an empty Room (no rows AND no settings blob) as "first
// launch" so the caller can seed from the legacy JSON snapshot.
if (settingsRow == null && mangas.isEmpty() && chapters.isEmpty()) {
awaitAll(
categoriesJob, sourcesJob, historiesJob, updatesJob, downloadsJob,
tracksJob, trackPrefsJob, trackSearchesJob, syncPrefsJob,
changedPartsJob, customButtonsJob, pageCacheJob, outboxJob,
)
return@coroutineScope null
}
YokanDatabaseSnapshot(
settings = settingsRow?.toDb() ?: DbSettings(),
mangas = mangas,
chapters = chapters,
categories = categoriesJob.await(),
sources = sourcesJob.await(),
histories = historiesJob.await(),
updates = updatesJob.await(),
downloads = downloadsJob.await(),
tracks = tracksJob.await(),
trackPreferences = trackPrefsJob.await(),
trackSearches = trackSearchesJob.await(),
syncPreferences = syncPrefsJob.await(),
changedParts = changedPartsJob.await(),
customButtons = customButtonsJob.await(),
pageCache = pageCacheJob.await(),
outbox = outboxJob.await(),
)
}
private suspend fun writeAllTables(snapshot: YokanDatabaseSnapshot, clearFirst: Boolean) {
room.settingsDao().upsert(snapshot.settings.toRow())
if (clearFirst) {
room.mangaCreditDao().clear()
room.mangaDao().clear()
room.chapterDao().clear()
room.categoryDao().clear()
room.sourceDao().clear()
room.historyDao().clear()
room.updateDao().clear()
room.downloadDao().clear()
room.trackDao().clear()
room.trackPreferenceDao().clear()
room.trackSearchDao().clear()
room.syncPreferenceDao().clear()
room.changedPartDao().clear()
room.customButtonDao().clear()
room.pageCacheDao().clear()
room.outboxDao().clear()
}
room.mangaDao().upsertAll(snapshot.mangas.map { it.toRow() })
room.mangaCreditDao().upsertAll(snapshot.mangas.flatMap { it.toCreditRows() })
room.chapterDao().upsertAll(snapshot.chapters.map { it.toRow() })
room.categoryDao().upsertAll(snapshot.categories.map { it.toRow() })
room.sourceDao().upsertAll(snapshot.sources.map { it.toRow() })
room.historyDao().upsertAll(snapshot.histories.map { it.toRow() })
room.updateDao().upsertAll(snapshot.updates.map { it.toRow() })
room.downloadDao().upsertAll(snapshot.downloads.map { it.toRow() })
room.trackDao().upsertAll(snapshot.tracks.map { it.toRow() })
room.trackPreferenceDao().upsertAll(snapshot.trackPreferences.map { it.toRow() })
room.trackSearchDao().upsertAll(snapshot.trackSearches.map { it.toRow() })
room.syncPreferenceDao().upsertAll(snapshot.syncPreferences.map { it.toRow() })
room.changedPartDao().upsertAll(snapshot.changedParts.map { it.toRow() })
room.customButtonDao().upsertAll(snapshot.customButtons.map { it.toRow() })
room.pageCacheDao().upsertAll(snapshot.pageCache.map { it.toRow() })
room.outboxDao().upsertAll(snapshot.outbox.map { it.toRow() })
}
private suspend fun importSnapshot(snapshot: YokanDatabaseSnapshot) {
// Only runs against a cold (empty) Room, so no clears needed.
room.useWriterConnection { connection ->
connection.withTransaction(Transactor.SQLiteTransactionType.IMMEDIATE) {
writeAllTables(snapshot, clearFirst = false)
}
}
AppLogger.info(
"[room] hydrated initial snapshot: " +
"mangas=${snapshot.mangas.size} chapters=${snapshot.chapters.size} " +
"histories=${snapshot.histories.size}",
)
}
/** A queued Room write; [coalesce]d writes run inside one shared transaction. */
private class QueuedWrite(val coalesce: Boolean, val action: suspend () -> Unit)
private companion object {
const val MAX_WRITE_RETRY_DELAY_MS = 5_000L
}
}
private fun YokanDatabaseSnapshot.withMangayomiDeletes(before: YokanDatabaseSnapshot): YokanDatabaseSnapshot {
val additions = mangayomiDeleteParts(before, this, changedParts, nowMillis())
return if (additions.isEmpty()) this else copy(changedParts = changedParts + additions)
}
composeApp/src/nonWebMain/kotlin/eu/friedcutlet/yokan/database/room/RowAdapters.kt
- Source · implementation · 308 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
34: private inline fun <reified E : Enum<E>> enumOrDefault(name: String?, default: E): E =
39: internal fun DbManga.toCreditRows(): List<MangaCreditRow> = cast.mapIndexed { index, credit ->
43: internal fun MangaCreditRow.toCredit() = eu.friedcutlet.yokan.domain.TitleCredit(name, role, character, imageUrl)
45: fun DbManga.toRow(): MangaRow = MangaRow(
78: fun MangaRow.toDb(): DbManga = DbManga(
113: fun DbChapter.toRow(): ChapterRow = ChapterRow(
122: fun ChapterRow.toDb(): DbChapter = DbChapter(
133: fun DbCategory.toRow(): CategoryRow = CategoryRow(
138: fun CategoryRow.toDb(): DbCategory = DbCategory(
145: fun DbSource.toRow(): SourceRow = SourceRow(
159: fun SourceRow.toDb(): DbSource = DbSource(
177: fun DbHistory.toRow(): HistoryRow = HistoryRow(
182: fun HistoryRow.toDb(): DbHistory = DbHistory(
190: fun DbUpdate.toRow() = UpdateRow(id, mangaId, chapterId, chapterName, date, updatedAt)
191: fun UpdateRow.toDb() = DbUpdate(id, mangaId, chapterId, chapterName, date, updatedAt)
193: fun DbDownload.toRow() = DownloadRow(id, chapterId, succeeded, failed, total, isDownload, isStartDownload, isPaused, storageLocation, requestJson)
194: fun DownloadRow.toDb() = DbDownload(id, chapterId, succeeded, failed, total, isDownload, isStartDownload, isPaused, storageLocation, requestJson)
196: fun DbCustomButton.toRow() = CustomButtonRow(
199: fun CustomButtonRow.toDb() = DbCustomButton(
203: fun DbTrack.toRow(): TrackRow = TrackRow(
211: fun TrackRow.toDb(): DbTrack = DbTrack(
220: fun DbTrackPreference.toRow() = TrackPreferenceRow(
223: fun TrackPreferenceRow.toDb() = DbTrackPreference(
228: fun DbTrackSearch.toRow() = TrackSearchRow(
235: fun TrackSearchRow.toDb() = DbTrackSearch(
243: fun DbSyncPreference.toRow() = SyncPreferenceRow(
253: fun SyncPreferenceRow.toDb() = DbSyncPreference(
264: fun DbOutboxOp.toRow() = OutboxRow(kind = kind, id = id, path = path, value = value, hlc = hlc, seq = seq, epoch = epoch)
265: fun OutboxRow.toDb() = DbOutboxOp(kind = kind, id = id, path = path, value = value, hlc = hlc, seq = seq, epoch = epoch)
267: fun DbChangedPart.toRow() = ChangedPartRow(
270: fun ChangedPartRow.toDb() = DbChangedPart(
277: fun DbChapterPageUrls.toRow(): PageCacheRow = PageCacheRow(
287: fun PageCacheRow.toDb(): DbChapterPageUrls = DbChapterPageUrls(
302: fun DbSettings.toRow(): SettingsRow = SettingsRow(
307: fun SettingsRow.toDb(): DbSettings? =
Exact file bytes / download · SHA-256 471066d216ebc111e8453b11c31141553534f5701849a9e164b3b5f0a1997ad4.
Complete file
package eu.friedcutlet.yokan.database.room
import eu.friedcutlet.yokan.database.DbActionType
import eu.friedcutlet.yokan.database.DbCategory
import eu.friedcutlet.yokan.database.DbChangedPart
import eu.friedcutlet.yokan.database.DbChapter
import eu.friedcutlet.yokan.database.DbChapterPageUrls
import eu.friedcutlet.yokan.database.DbFetchType
import eu.friedcutlet.yokan.database.DbCustomButton
import eu.friedcutlet.yokan.database.DbDownload
import eu.friedcutlet.yokan.database.DbHistory
import eu.friedcutlet.yokan.database.DbItemType
import eu.friedcutlet.yokan.database.DbManga
import eu.friedcutlet.yokan.database.DbOutboxOp
import eu.friedcutlet.yokan.database.DbRepo
import eu.friedcutlet.yokan.database.DbSettings
import eu.friedcutlet.yokan.database.DbSource
import eu.friedcutlet.yokan.database.DbSourceCodeLanguage
import eu.friedcutlet.yokan.database.DbStatus
import eu.friedcutlet.yokan.database.DbSyncPreference
import eu.friedcutlet.yokan.database.SyncServerProvider
import eu.friedcutlet.yokan.database.DbTrack
import eu.friedcutlet.yokan.database.DbTrackPreference
import eu.friedcutlet.yokan.database.DbTrackSearch
import eu.friedcutlet.yokan.database.DbTrackStatus
import eu.friedcutlet.yokan.database.DbUpdate
import kotlinx.serialization.json.Json
internal val RowJson = Json {
ignoreUnknownKeys = true
encodeDefaults = true
}
private inline fun <reified E : Enum<E>> enumOrDefault(name: String?, default: E): E =
name?.let { runCatching { enumValueOf<E>(it) }.getOrNull() } ?: default
// ─── Manga ──────────────────────────────────────────────────────────────────
internal fun DbManga.toCreditRows(): List<MangaCreditRow> = cast.mapIndexed { index, credit ->
MangaCreditRow(id, index, credit.name, credit.role, credit.character, credit.imageUrl)
}
internal fun MangaCreditRow.toCredit() = eu.friedcutlet.yokan.domain.TitleCredit(name, role, character, imageUrl)
fun DbManga.toRow(): MangaRow = MangaRow(
id = id,
name = name,
link = link,
imageUrl = imageUrl,
description = description,
author = author,
artist = artist,
status = status.name,
itemType = itemType.name,
genre = genre?.let { RowJson.encodeToString(it) },
favorite = favorite,
source = source,
lang = lang,
dateAdded = dateAdded,
lastUpdate = lastUpdate,
lastRead = lastRead,
categories = categories?.let { RowJson.encodeToString(it) },
isLocalArchive = isLocalArchive,
customCoverImage = customCoverImage,
customCoverFromTracker = customCoverFromTracker,
smartUpdateDays = smartUpdateDays,
updatedAt = updatedAt,
sourceId = sourceId,
privateNote = privateNote,
nextEpisodeAiringAt = nextEpisodeAiringAt,
nextEpisodeNumber = nextEpisodeNumber,
airingScheduleUpdatedAt = airingScheduleUpdatedAt,
parentId = parentId,
fetchType = fetchType.name,
seasonNumber = seasonNumber,
)
fun MangaRow.toDb(): DbManga = DbManga(
id = id,
name = name,
link = link,
imageUrl = imageUrl,
description = description,
author = author,
artist = artist,
status = enumOrDefault(status, DbStatus.Unknown),
itemType = enumOrDefault(itemType, DbItemType.Manga),
genre = genre?.let { runCatching { RowJson.decodeFromString<List<String>>(it) }.getOrNull() },
favorite = favorite,
source = source,
lang = lang,
dateAdded = dateAdded,
lastUpdate = lastUpdate,
lastRead = lastRead,
categories = categories?.let { runCatching { RowJson.decodeFromString<List<Long>>(it) }.getOrNull() },
isLocalArchive = isLocalArchive,
customCoverImage = customCoverImage,
customCoverFromTracker = customCoverFromTracker,
smartUpdateDays = smartUpdateDays,
updatedAt = updatedAt,
sourceId = sourceId,
privateNote = privateNote,
nextEpisodeAiringAt = nextEpisodeAiringAt,
nextEpisodeNumber = nextEpisodeNumber,
airingScheduleUpdatedAt = airingScheduleUpdatedAt,
parentId = parentId,
fetchType = enumOrDefault(fetchType, DbFetchType.Episodes),
seasonNumber = seasonNumber,
)
// ─── Chapter ────────────────────────────────────────────────────────────────
fun DbChapter.toRow(): ChapterRow = ChapterRow(
id = id, mangaId = mangaId, name = name, url = url, dateUpload = dateUpload,
scanlator = scanlator, isBookmarked = isBookmarked, isRead = isRead,
lastPageRead = lastPageRead, archivePath = archivePath, isFiller = isFiller,
thumbnailUrl = thumbnailUrl, description = description, downloadSize = downloadSize,
duration = duration, updatedAt = updatedAt, fetchedAt = fetchedAt,
number = number, season = season, numberingName = numberingName, fillerOverride = fillerOverride,
)
fun ChapterRow.toDb(): DbChapter = DbChapter(
id = id, mangaId = mangaId, name = name, url = url, dateUpload = dateUpload,
scanlator = scanlator, isBookmarked = isBookmarked, isRead = isRead,
lastPageRead = lastPageRead, archivePath = archivePath, isFiller = isFiller,
thumbnailUrl = thumbnailUrl, description = description, downloadSize = downloadSize,
duration = duration, updatedAt = updatedAt, fetchedAt = fetchedAt,
number = number, season = season, numberingName = numberingName, fillerOverride = fillerOverride,
)
// ─── Category ───────────────────────────────────────────────────────────────
fun DbCategory.toRow(): CategoryRow = CategoryRow(
id = id, name = name, forItemType = forItemType.name, position = position,
hidden = hidden, shouldUpdate = shouldUpdate, updatedAt = updatedAt,
)
fun CategoryRow.toDb(): DbCategory = DbCategory(
id = id, name = name, forItemType = enumOrDefault(forItemType, DbItemType.Manga),
position = position, hidden = hidden, shouldUpdate = shouldUpdate, updatedAt = updatedAt,
)
// ─── Source ─────────────────────────────────────────────────────────────────
fun DbSource.toRow(): SourceRow = SourceRow(
id = id, name = name, baseUrl = baseUrl, lang = lang, isActive = isActive,
isAdded = isAdded, isPinned = isPinned, isNsfw = isNsfw, sourceCode = sourceCode,
sourceCodeUrl = sourceCodeUrl, typeSource = typeSource, iconUrl = iconUrl,
isFullData = isFullData, hasCloudflare = hasCloudflare, lastUsed = lastUsed,
dateFormat = dateFormat, dateFormatLocale = dateFormatLocale, apiUrl = apiUrl,
version = version, versionLast = versionLast, headers = headers,
supportLatest = supportLatest, filterList = filterList, preferenceList = preferenceList,
itemType = itemType.name, appMinVerReq = appMinVerReq, additionalParams = additionalParams,
isLocal = isLocal, isObsolete = isObsolete, sourceCodeLanguage = sourceCodeLanguage.name,
notes = notes, repoJson = repo?.let { RowJson.encodeToString(DbRepo.serializer(), it) },
updatedAt = updatedAt,
)
fun SourceRow.toDb(): DbSource = DbSource(
id = id, name = name, baseUrl = baseUrl, lang = lang, isActive = isActive,
isAdded = isAdded, isPinned = isPinned, isNsfw = isNsfw, sourceCode = sourceCode,
sourceCodeUrl = sourceCodeUrl, typeSource = typeSource, iconUrl = iconUrl,
isFullData = isFullData, hasCloudflare = hasCloudflare, lastUsed = lastUsed,
dateFormat = dateFormat, dateFormatLocale = dateFormatLocale, apiUrl = apiUrl,
version = version, versionLast = versionLast, headers = headers,
supportLatest = supportLatest, filterList = filterList, preferenceList = preferenceList,
itemType = enumOrDefault(itemType, DbItemType.Manga), appMinVerReq = appMinVerReq,
additionalParams = additionalParams, isLocal = isLocal, isObsolete = isObsolete,
sourceCodeLanguage = enumOrDefault(sourceCodeLanguage, DbSourceCodeLanguage.JavaScript),
notes = notes,
repo = repoJson?.let { runCatching { RowJson.decodeFromString(DbRepo.serializer(), it) }.getOrNull() },
updatedAt = updatedAt,
)
// ─── History ────────────────────────────────────────────────────────────────
fun DbHistory.toRow(): HistoryRow = HistoryRow(
id = id, mangaId = mangaId, chapterId = chapterId, itemType = itemType.name,
date = date, updatedAt = updatedAt, readingTimeSeconds = readingTimeSeconds,
)
fun HistoryRow.toDb(): DbHistory = DbHistory(
id = id, mangaId = mangaId, chapterId = chapterId,
itemType = enumOrDefault(itemType, DbItemType.Manga),
date = date, updatedAt = updatedAt, readingTimeSeconds = readingTimeSeconds,
)
// ─── Update / Download / CustomButton / Tracks ─────────────────────────────
fun DbUpdate.toRow() = UpdateRow(id, mangaId, chapterId, chapterName, date, updatedAt)
fun UpdateRow.toDb() = DbUpdate(id, mangaId, chapterId, chapterName, date, updatedAt)
fun DbDownload.toRow() = DownloadRow(id, chapterId, succeeded, failed, total, isDownload, isStartDownload, isPaused, storageLocation, requestJson)
fun DownloadRow.toDb() = DbDownload(id, chapterId, succeeded, failed, total, isDownload, isStartDownload, isPaused, storageLocation, requestJson)
fun DbCustomButton.toRow() = CustomButtonRow(
id, title, codePress, codeLongPress, codeStartup, isFavourite, position, updatedAt,
)
fun CustomButtonRow.toDb() = DbCustomButton(
id, title, codePress, codeLongPress, codeStartup, isFavourite, position, updatedAt,
)
fun DbTrack.toRow(): TrackRow = TrackRow(
id = id, libraryId = libraryId, mediaId = mediaId, mangaId = mangaId, syncId = syncId,
title = title, lastChapterRead = lastChapterRead, totalChapter = totalChapter, score = score,
status = status.name, startedReadingDate = startedReadingDate,
finishedReadingDate = finishedReadingDate, trackingUrl = trackingUrl,
itemType = itemType.name, updatedAt = updatedAt,
)
fun TrackRow.toDb(): DbTrack = DbTrack(
id = id, libraryId = libraryId, mediaId = mediaId, mangaId = mangaId, syncId = syncId,
title = title, lastChapterRead = lastChapterRead, totalChapter = totalChapter, score = score,
status = enumOrDefault(status, DbTrackStatus.Reading),
startedReadingDate = startedReadingDate, finishedReadingDate = finishedReadingDate,
trackingUrl = trackingUrl, itemType = enumOrDefault(itemType, DbItemType.Manga),
updatedAt = updatedAt,
)
fun DbTrackPreference.toRow() = TrackPreferenceRow(
syncId = syncId ?: 0L, username = username, oauth = oauth, prefs = prefs, refreshing = refreshing,
)
fun TrackPreferenceRow.toDb() = DbTrackPreference(
syncId = if (syncId == 0L) null else syncId, username = username, oauth = oauth, prefs = prefs,
refreshing = refreshing,
)
fun DbTrackSearch.toRow() = TrackSearchRow(
id = id, libraryId = libraryId, mediaId = mediaId, syncId = syncId, title = title,
lastChapterRead = lastChapterRead, totalChapter = totalChapter, score = score, status = status,
startedReadingDate = startedReadingDate, finishedReadingDate = finishedReadingDate,
trackingUrl = trackingUrl, coverUrl = coverUrl, summary = summary,
publishingStatus = publishingStatus, publishingType = publishingType, startDate = startDate,
)
fun TrackSearchRow.toDb() = DbTrackSearch(
id = id, libraryId = libraryId, mediaId = mediaId, syncId = syncId, title = title,
lastChapterRead = lastChapterRead, totalChapter = totalChapter, score = score, status = status,
startedReadingDate = startedReadingDate, finishedReadingDate = finishedReadingDate,
trackingUrl = trackingUrl, coverUrl = coverUrl, summary = summary,
publishingStatus = publishingStatus, publishingType = publishingType, startDate = startDate,
)
fun DbSyncPreference.toRow() = SyncPreferenceRow(
syncId = syncId ?: 0L, email = email, authToken = authToken,
lastSyncManga = lastSyncManga, lastSyncHistory = lastSyncHistory, lastSyncUpdate = lastSyncUpdate,
server = server, syncOn = syncOn, autoSyncFrequency = autoSyncFrequency,
syncHistories = syncHistories, syncUpdates = syncUpdates, syncSettings = syncSettings,
hubHead = hubHead, hubEpoch = hubEpoch, hubRecoveryPending = hubRecoveryPending,
hubBootstrapComplete = hubBootstrapComplete, hubHlc = hubHlc, deviceId = deviceId,
serverProvider = serverProvider.name,
mangayomiIdMappings = mangayomiIdMappings,
)
fun SyncPreferenceRow.toDb() = DbSyncPreference(
syncId = if (syncId == 0L) null else syncId, email = email, authToken = authToken,
lastSyncManga = lastSyncManga, lastSyncHistory = lastSyncHistory, lastSyncUpdate = lastSyncUpdate,
server = server, syncOn = syncOn, autoSyncFrequency = autoSyncFrequency,
syncHistories = syncHistories, syncUpdates = syncUpdates, syncSettings = syncSettings,
hubHead = hubHead, hubEpoch = hubEpoch, hubRecoveryPending = hubRecoveryPending,
hubBootstrapComplete = hubBootstrapComplete, hubHlc = hubHlc, deviceId = deviceId,
serverProvider = enumOrDefault(serverProvider, SyncServerProvider.YokanHub),
mangayomiIdMappings = mangayomiIdMappings,
)
fun DbOutboxOp.toRow() = OutboxRow(kind = kind, id = id, path = path, value = value, hlc = hlc, seq = seq, epoch = epoch)
fun OutboxRow.toDb() = DbOutboxOp(kind = kind, id = id, path = path, value = value, hlc = hlc, seq = seq, epoch = epoch)
fun DbChangedPart.toRow() = ChangedPartRow(
id = id, actionType = actionType.name, isarId = isarId, data = data, clientDate = clientDate,
)
fun ChangedPartRow.toDb() = DbChangedPart(
id = id, actionType = enumOrDefault(actionType, DbActionType.RemoveItem),
isarId = isarId, data = data, clientDate = clientDate,
)
// ─── Page cache ─────────────────────────────────────────────────────────────
fun DbChapterPageUrls.toRow(): PageCacheRow = PageCacheRow(
chapterId = chapterId ?: 0L,
chapterUrl = chapterUrl,
urls = urls?.let { RowJson.encodeToString(it) },
headers = headers?.let { RowJson.encodeToString(it) },
fetchedAt = fetchedAt,
sourceId = sourceId,
sourceVersion = sourceVersion,
)
fun PageCacheRow.toDb(): DbChapterPageUrls = DbChapterPageUrls(
chapterId = if (chapterId == 0L) null else chapterId,
chapterUrl = chapterUrl,
urls = urls?.let { runCatching { RowJson.decodeFromString<List<String>>(it) }.getOrNull() },
headers = headers?.let { runCatching { RowJson.decodeFromString<List<String>>(it) }.getOrNull() },
fetchedAt = fetchedAt,
sourceId = sourceId,
sourceVersion = sourceVersion,
)
// ─── Settings ───────────────────────────────────────────────────────────────
// Single-row JSON encoded. DbSettings has dozens of nested types; storing the
// whole thing as a TEXT blob avoids exploding the schema and keeps backup /
// sync paths reading the same kotlinx.serialization form.
fun DbSettings.toRow(): SettingsRow = SettingsRow(
id = 1L,
json = RowJson.encodeToString(DbSettings.serializer(), this),
)
fun SettingsRow.toDb(): DbSettings? =
runCatching { RowJson.decodeFromString(DbSettings.serializer(), json) }.getOrNull()
composeApp/src/nonWebMain/kotlin/eu/friedcutlet/yokan/database/room/YokanRoomDatabase.kt
- Source · implementation · 693 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
29: data class MangaRow(
67: data class MangaCreditRow(
77: interface MangaCreditDao {
85: data class ChapterRow(
110: data class CategoryRow(
121: data class SourceRow(
158: data class HistoryRow(
169: data class UpdateRow(
179: data class DownloadRow(
193: data class TrackRow(
212: data class TrackPreferenceRow(
221: data class TrackSearchRow(
243: data class SyncPreferenceRow(
267: data class ChangedPartRow(
277: data class OutboxRow(
288: data class CustomButtonRow(
300: data class PageCacheRow(
312: data class SettingsRow(
319: data class RecipeCatalogCheckpointRow(
327: data class RecipeCatalogTrustKeyRow(
337: data class RecipeCatalogInstalledRow(
355: interface MangaDao {
364: interface ChapterDao {
373: interface CategoryDao {
382: interface SourceDao {
392: interface HistoryDao {
401: interface UpdateDao {
410: interface DownloadDao {
419: interface TrackDao {
428: interface TrackPreferenceDao {
436: interface TrackSearchDao {
444: interface SyncPreferenceDao {
452: interface ChangedPartDao {
460: interface OutboxDao {
464: suspend fun deleteIfUnchanged(kind: Int, id: Long, path: String, seq: Long)
470: interface CustomButtonDao {
479: interface PageCacheDao {
488: interface SettingsDao {
494: interface RecipeInstallationDao {
535: abstract class YokanRoomDatabase : RoomDatabase() {
536: abstract fun mangaDao(): MangaDao
537: abstract fun mangaCreditDao(): MangaCreditDao
538: abstract fun chapterDao(): ChapterDao
539: abstract fun categoryDao(): CategoryDao
540: abstract fun sourceDao(): SourceDao
541: abstract fun historyDao(): HistoryDao
542: abstract fun updateDao(): UpdateDao
543: abstract fun downloadDao(): DownloadDao
544: abstract fun trackDao(): TrackDao
545: abstract fun trackPreferenceDao(): TrackPreferenceDao
546: abstract fun trackSearchDao(): TrackSearchDao
547: abstract fun syncPreferenceDao(): SyncPreferenceDao
548: abstract fun changedPartDao(): ChangedPartDao
549: abstract fun customButtonDao(): CustomButtonDao
550: abstract fun pageCacheDao(): PageCacheDao
551: abstract fun settingsDao(): SettingsDao
552: abstract fun outboxDao(): OutboxDao
553: abstract fun recipeInstallationDao(): RecipeInstallationDao
558: override fun migrate(connection: SQLiteConnection) {
572: override fun migrate(connection: SQLiteConnection) {
579: override fun migrate(connection: SQLiteConnection) {
586: override fun migrate(connection: SQLiteConnection) {
593: override fun migrate(connection: SQLiteConnection) {
602: override fun migrate(connection: SQLiteConnection) {
609: override fun migrate(connection: SQLiteConnection) {
618: override fun migrate(connection: SQLiteConnection) {
625: override fun migrate(connection: SQLiteConnection) {
632: override fun migrate(connection: SQLiteConnection) {
639: override fun migrate(connection: SQLiteConnection) {
648: override fun migrate(connection: SQLiteConnection) {
658: override fun migrate(connection: SQLiteConnection) {
666: override fun migrate(connection: SQLiteConnection) {
673: override fun migrate(connection: SQLiteConnection) {
682: expect object YokanRoomDatabaseConstructor : RoomDatabaseConstructor<YokanRoomDatabase> {
683: override fun initialize(): YokanRoomDatabase
686: expect fun createYokanRoomDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId = eu.friedcutlet.yokan.domain.ProfileId.Default): YokanRoomDatabase
689: internal fun RoomDatabase.Builder<YokanRoomDatabase>.buildYokanRoom(): YokanRoomDatabase = this
Exact file bytes / download · SHA-256 296c7399ae750daf14c7c1f5123f1472fdb04fcc52e0f5c958f83e377e4340dc.
Complete file
package eu.friedcutlet.yokan.database.room
import androidx.room.ColumnInfo
import androidx.room.ConstructedBy
import androidx.room.Dao
import androidx.room.Database
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.PrimaryKey
import androidx.room.Query
import androidx.room.RoomDatabase
import androidx.room.RoomDatabaseConstructor
import androidx.room.Upsert
import androidx.room.migration.Migration
import androidx.sqlite.SQLiteConnection
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
import androidx.sqlite.execSQL
import eu.friedcutlet.yokan.database.DbSettings
// ─── Entity schemas ─────────────────────────────────────────────────────────
// One Row class per logical table. Complex types (enums, List<String>,
// nested objects) are stored as JSON TEXT columns and translated in
// `RowAdapters.kt`; the schema stays plain SQL primitives so Room's KSP
// processor doesn't need TypeConverters.
@Entity(tableName = "manga")
data class MangaRow(
@PrimaryKey val id: Long,
val name: String? = null,
val link: String? = null,
val imageUrl: String? = null,
val description: String? = null,
val author: String? = null,
val artist: String? = null,
val status: String,
val itemType: String,
val genre: String? = null,
val favorite: Boolean = false,
val source: String? = null,
val lang: String? = null,
val dateAdded: Long? = null,
val lastUpdate: Long? = null,
val lastRead: Long = 0,
val categories: String? = null,
val isLocalArchive: Boolean = false,
val customCoverImage: ByteArray? = null,
val customCoverFromTracker: String? = null,
val smartUpdateDays: Int? = null,
val updatedAt: Long = 0,
val sourceId: Long? = null,
@ColumnInfo(defaultValue = "''") val privateNote: String = "",
@ColumnInfo(defaultValue = "0") val nextEpisodeAiringAt: Long = 0,
@ColumnInfo(defaultValue = "NULL") val nextEpisodeNumber: Int? = null,
@ColumnInfo(defaultValue = "0") val airingScheduleUpdatedAt: Long = 0,
@ColumnInfo(defaultValue = "NULL") val parentId: Long? = null,
@ColumnInfo(defaultValue = "'Episodes'") val fetchType: String = "Episodes",
@ColumnInfo(defaultValue = "NULL") val seasonNumber: Double? = null,
)
@Entity(
tableName = "manga_credit",
primaryKeys = ["mangaId", "position"],
foreignKeys = [ForeignKey(entity = MangaRow::class, parentColumns = ["id"], childColumns = ["mangaId"], onDelete = ForeignKey.CASCADE)],
)
data class MangaCreditRow(
val mangaId: Long,
val position: Int,
val name: String,
val role: String? = null,
val character: String? = null,
val imageUrl: String? = null,
)
@Dao
interface MangaCreditDao {
@Query("SELECT * FROM manga_credit ORDER BY mangaId, position") suspend fun all(): List<MangaCreditRow>
@Upsert suspend fun upsertAll(rows: List<MangaCreditRow>)
@Query("DELETE FROM manga_credit WHERE mangaId = :mangaId") suspend fun deleteForManga(mangaId: Long)
@Query("DELETE FROM manga_credit") suspend fun clear()
}
@Entity(tableName = "chapter")
data class ChapterRow(
@PrimaryKey val id: Long,
val mangaId: Long? = null,
val name: String? = null,
val url: String = "",
val dateUpload: String = "",
val scanlator: String = "",
val isBookmarked: Boolean = false,
val isRead: Boolean = false,
val lastPageRead: String = "",
val archivePath: String = "",
val isFiller: Boolean = false,
val thumbnailUrl: String? = null,
val description: String? = null,
val downloadSize: String? = null,
val duration: String? = null,
val updatedAt: Long = 0,
@ColumnInfo(defaultValue = "0") val fetchedAt: Long = 0,
@ColumnInfo(defaultValue = "NULL") val number: Double? = null,
@ColumnInfo(defaultValue = "NULL") val season: Int? = null,
@ColumnInfo(defaultValue = "NULL") val numberingName: String? = null,
@ColumnInfo(defaultValue = "NULL") val fillerOverride: Boolean? = null,
)
@Entity(tableName = "category")
data class CategoryRow(
@PrimaryKey val id: Long,
val name: String,
val forItemType: String,
val position: Int? = null,
val hidden: Boolean? = null,
val shouldUpdate: Boolean? = null,
val updatedAt: Long = 0,
)
@Entity(tableName = "source")
data class SourceRow(
@PrimaryKey val id: Long,
val name: String = "",
val baseUrl: String = "",
val lang: String = "",
val isActive: Boolean = true,
val isAdded: Boolean = false,
val isPinned: Boolean = false,
val isNsfw: Boolean = false,
val sourceCode: String = "",
val sourceCodeUrl: String = "",
val typeSource: String = "",
val iconUrl: String = "",
val isFullData: Boolean = false,
val hasCloudflare: Boolean = false,
val lastUsed: Boolean = false,
val dateFormat: String = "",
val dateFormatLocale: String = "",
val apiUrl: String = "",
val version: String = "0.0.1",
val versionLast: String = "0.0.1",
val headers: String = "",
val supportLatest: Boolean? = null,
val filterList: String? = null,
val preferenceList: String? = null,
val itemType: String,
val appMinVerReq: String = "",
val additionalParams: String = "",
val isLocal: Boolean = false,
val isObsolete: Boolean = false,
val sourceCodeLanguage: String,
val notes: String = "",
val repoJson: String? = null,
val updatedAt: Long = 0,
)
@Entity(tableName = "history")
data class HistoryRow(
@PrimaryKey val id: Long,
val mangaId: Long? = null,
val chapterId: Long? = null,
val itemType: String,
val date: String? = null,
val updatedAt: Long = 0,
val readingTimeSeconds: Int? = null,
)
@Entity(tableName = "library_update")
data class UpdateRow(
@PrimaryKey val id: Long,
val mangaId: Long? = null,
val chapterId: Long? = null,
val chapterName: String? = null,
val date: String? = null,
val updatedAt: Long = 0,
)
@Entity(tableName = "download")
data class DownloadRow(
@PrimaryKey val id: Long,
val chapterId: Long? = null,
val succeeded: Int? = null,
val failed: Int? = null,
val total: Int? = null,
val isDownload: Boolean? = null,
val isStartDownload: Boolean? = null,
@ColumnInfo(defaultValue = "0") val isPaused: Boolean = false,
val storageLocation: String? = null,
val requestJson: String? = null,
)
@Entity(tableName = "track")
data class TrackRow(
@PrimaryKey val id: Long,
val libraryId: Long? = null,
val mediaId: Long? = null,
val mangaId: Long? = null,
val syncId: Int? = null,
val title: String? = null,
val lastChapterRead: Int? = null,
val totalChapter: Int? = null,
val score: Int? = null,
val status: String,
val startedReadingDate: Long? = null,
val finishedReadingDate: Long? = null,
val trackingUrl: String? = null,
val itemType: String,
val updatedAt: Long = 0,
)
@Entity(tableName = "track_preference")
data class TrackPreferenceRow(
@PrimaryKey val syncId: Long,
val username: String? = null,
val oauth: String? = null,
val prefs: String? = null,
val refreshing: Boolean? = null,
)
@Entity(tableName = "track_search")
data class TrackSearchRow(
@PrimaryKey(autoGenerate = true) val rowId: Long = 0,
val id: Long? = null,
val libraryId: Long? = null,
val mediaId: Long? = null,
val syncId: Int? = null,
val title: String? = null,
val lastChapterRead: Int? = null,
val totalChapter: Int? = null,
val score: Double? = null,
val status: String = "",
val startedReadingDate: Long? = null,
val finishedReadingDate: Long? = null,
val trackingUrl: String? = null,
val coverUrl: String = "",
val summary: String = "",
val publishingStatus: String = "",
val publishingType: String = "",
val startDate: String = "",
)
@Entity(tableName = "sync_preference")
data class SyncPreferenceRow(
@PrimaryKey val syncId: Long,
val email: String? = null,
val authToken: String? = null,
val lastSyncManga: Long? = null,
val lastSyncHistory: Long? = null,
val lastSyncUpdate: Long? = null,
val server: String? = null,
val syncOn: Boolean = false,
val autoSyncFrequency: Int = 0,
val syncHistories: Boolean = false,
val syncUpdates: Boolean = false,
val syncSettings: Boolean = false,
@ColumnInfo(defaultValue = "0") val hubHead: Long = 0,
@ColumnInfo(defaultValue = "0") val hubEpoch: Int = 0,
@ColumnInfo(defaultValue = "0") val hubRecoveryPending: Boolean = false,
@ColumnInfo(defaultValue = "1") val hubBootstrapComplete: Boolean = false,
@ColumnInfo(defaultValue = "0") val hubHlc: Long = 0,
val deviceId: String? = null,
@ColumnInfo(defaultValue = "'YokanHub'") val serverProvider: String = "YokanHub",
val mangayomiIdMappings: String? = null,
)
@Entity(tableName = "changed_part")
data class ChangedPartRow(
@PrimaryKey val id: Long,
val actionType: String,
val isarId: Long? = null,
val data: String,
val clientDate: Long,
)
/** Unpushed hub ops; see `DbOutboxOp`. */
@Entity(tableName = "outbox", primaryKeys = ["kind", "id", "path"])
data class OutboxRow(
val kind: Int,
val id: Long,
val path: String,
val value: String? = null,
val hlc: Long,
val seq: Long,
@ColumnInfo(defaultValue = "0") val epoch: Int = 0,
)
@Entity(tableName = "custom_button")
data class CustomButtonRow(
@PrimaryKey val id: Long,
val title: String? = null,
val codePress: String? = null,
val codeLongPress: String = "",
val codeStartup: String = "",
val isFavourite: Boolean = false,
val position: Int,
val updatedAt: Long = 0,
)
@Entity(tableName = "page_cache")
data class PageCacheRow(
@PrimaryKey val chapterId: Long,
val chapterUrl: String? = null,
val urls: String? = null,
val headers: String? = null,
val fetchedAt: Long? = null,
val sourceId: Long? = null,
val sourceVersion: String? = null,
)
/** Single-row settings table; payload is the whole DbSettings serialized to JSON. */
@Entity(tableName = "settings")
data class SettingsRow(
@PrimaryKey val id: Long = 1L,
val json: String,
)
/** Durable host-owned recipe catalog checkpoint. These rows are intentionally excluded from legacy snapshots. */
@Entity(tableName = "recipe_catalog_checkpoint")
data class RecipeCatalogCheckpointRow(
@PrimaryKey val catalogId: String,
val generation: Long,
val replayRevision: Long? = null,
val replayPayloadHash: ByteArray? = null,
)
@Entity(tableName = "recipe_catalog_trust_key", primaryKeys = ["catalogId", "keyId"])
data class RecipeCatalogTrustKeyRow(
val catalogId: String,
val keyId: String,
val rawEd25519PublicKey: ByteArray,
val state: String,
val validFromEpochSeconds: Long? = null,
val validUntilEpochSeconds: Long? = null,
)
@Entity(tableName = "recipe_catalog_installed", primaryKeys = ["catalogId", "stableId"])
data class RecipeCatalogInstalledRow(
val catalogId: String,
val stableId: String,
val catalogRevision: Long,
val releaseVersion: String,
val sha256: String,
val sizeBytes: Long,
val artifactBytes: ByteArray,
/** Host-owned source row identity; null is a v6 record awaiting lazy materialization. */
val sourceId: Long? = null,
)
// ─── DAOs ───────────────────────────────────────────────────────────────────
// Each DAO exposes only `all()` / `upsert()` / `delete()` / `clear()`. Reads
// are still served from the in-memory snapshot for synchronous access; the
// DAOs only run on startup (hydration) and on mutations (write-through).
@Dao
interface MangaDao {
@Query("SELECT * FROM manga") suspend fun all(): List<MangaRow>
@Upsert suspend fun upsert(row: MangaRow)
@Upsert suspend fun upsertAll(rows: List<MangaRow>)
@Query("DELETE FROM manga") suspend fun clear()
@Query("DELETE FROM manga WHERE id = :id") suspend fun delete(id: Long)
}
@Dao
interface ChapterDao {
@Query("SELECT * FROM chapter") suspend fun all(): List<ChapterRow>
@Upsert suspend fun upsert(row: ChapterRow)
@Upsert suspend fun upsertAll(rows: List<ChapterRow>)
@Query("DELETE FROM chapter") suspend fun clear()
@Query("DELETE FROM chapter WHERE id = :id") suspend fun delete(id: Long)
}
@Dao
interface CategoryDao {
@Query("SELECT * FROM category") suspend fun all(): List<CategoryRow>
@Upsert suspend fun upsert(row: CategoryRow)
@Upsert suspend fun upsertAll(rows: List<CategoryRow>)
@Query("DELETE FROM category") suspend fun clear()
@Query("DELETE FROM category WHERE id = :id") suspend fun delete(id: Long)
}
@Dao
interface SourceDao {
@Query("SELECT * FROM source") suspend fun all(): List<SourceRow>
@Query("SELECT * FROM source WHERE id = :id") suspend fun source(id: Long): SourceRow?
@Upsert suspend fun upsert(row: SourceRow)
@Upsert suspend fun upsertAll(rows: List<SourceRow>)
@Query("DELETE FROM source") suspend fun clear()
@Query("DELETE FROM source WHERE id = :id") suspend fun delete(id: Long)
}
@Dao
interface HistoryDao {
@Query("SELECT * FROM history") suspend fun all(): List<HistoryRow>
@Upsert suspend fun upsert(row: HistoryRow)
@Upsert suspend fun upsertAll(rows: List<HistoryRow>)
@Query("DELETE FROM history") suspend fun clear()
@Query("DELETE FROM history WHERE id = :id") suspend fun delete(id: Long)
}
@Dao
interface UpdateDao {
@Query("SELECT * FROM library_update") suspend fun all(): List<UpdateRow>
@Upsert suspend fun upsert(row: UpdateRow)
@Upsert suspend fun upsertAll(rows: List<UpdateRow>)
@Query("DELETE FROM library_update") suspend fun clear()
@Query("DELETE FROM library_update WHERE id = :id") suspend fun delete(id: Long)
}
@Dao
interface DownloadDao {
@Query("SELECT * FROM download") suspend fun all(): List<DownloadRow>
@Upsert suspend fun upsert(row: DownloadRow)
@Upsert suspend fun upsertAll(rows: List<DownloadRow>)
@Query("DELETE FROM download") suspend fun clear()
@Query("DELETE FROM download WHERE id = :id") suspend fun delete(id: Long)
}
@Dao
interface TrackDao {
@Query("SELECT * FROM track") suspend fun all(): List<TrackRow>
@Upsert suspend fun upsert(row: TrackRow)
@Upsert suspend fun upsertAll(rows: List<TrackRow>)
@Query("DELETE FROM track") suspend fun clear()
@Query("DELETE FROM track WHERE id = :id") suspend fun delete(id: Long)
}
@Dao
interface TrackPreferenceDao {
@Query("SELECT * FROM track_preference") suspend fun all(): List<TrackPreferenceRow>
@Upsert suspend fun upsert(row: TrackPreferenceRow)
@Upsert suspend fun upsertAll(rows: List<TrackPreferenceRow>)
@Query("DELETE FROM track_preference") suspend fun clear()
}
@Dao
interface TrackSearchDao {
@Query("SELECT * FROM track_search") suspend fun all(): List<TrackSearchRow>
@Upsert suspend fun upsert(row: TrackSearchRow)
@Upsert suspend fun upsertAll(rows: List<TrackSearchRow>)
@Query("DELETE FROM track_search") suspend fun clear()
}
@Dao
interface SyncPreferenceDao {
@Query("SELECT * FROM sync_preference") suspend fun all(): List<SyncPreferenceRow>
@Upsert suspend fun upsert(row: SyncPreferenceRow)
@Upsert suspend fun upsertAll(rows: List<SyncPreferenceRow>)
@Query("DELETE FROM sync_preference") suspend fun clear()
}
@Dao
interface ChangedPartDao {
@Query("SELECT * FROM changed_part") suspend fun all(): List<ChangedPartRow>
@Upsert suspend fun upsert(row: ChangedPartRow)
@Upsert suspend fun upsertAll(rows: List<ChangedPartRow>)
@Query("DELETE FROM changed_part") suspend fun clear()
}
@Dao
interface OutboxDao {
@Query("SELECT * FROM outbox") suspend fun all(): List<OutboxRow>
@Upsert suspend fun upsertAll(rows: List<OutboxRow>)
@Query("DELETE FROM outbox WHERE kind = :kind AND id = :id AND path = :path AND seq = :seq")
suspend fun deleteIfUnchanged(kind: Int, id: Long, path: String, seq: Long)
@Query("DELETE FROM outbox") suspend fun clear()
@Query("DELETE FROM outbox WHERE epoch = 0") suspend fun clearUnnegotiated()
}
@Dao
interface CustomButtonDao {
@Query("SELECT * FROM custom_button") suspend fun all(): List<CustomButtonRow>
@Upsert suspend fun upsert(row: CustomButtonRow)
@Upsert suspend fun upsertAll(rows: List<CustomButtonRow>)
@Query("DELETE FROM custom_button") suspend fun clear()
@Query("DELETE FROM custom_button WHERE id = :id") suspend fun delete(id: Long)
}
@Dao
interface PageCacheDao {
@Query("SELECT * FROM page_cache") suspend fun all(): List<PageCacheRow>
@Upsert suspend fun upsert(row: PageCacheRow)
@Upsert suspend fun upsertAll(rows: List<PageCacheRow>)
@Query("DELETE FROM page_cache") suspend fun clear()
@Query("DELETE FROM page_cache WHERE chapterId = :chapterId") suspend fun delete(chapterId: Long)
}
@Dao
interface SettingsDao {
@Query("SELECT * FROM settings WHERE id = 1") suspend fun get(): SettingsRow?
@Upsert suspend fun upsert(row: SettingsRow)
}
@Dao
interface RecipeInstallationDao {
@Query("SELECT * FROM recipe_catalog_checkpoint WHERE catalogId = :catalogId") suspend fun checkpoint(catalogId: String): RecipeCatalogCheckpointRow?
@Query("SELECT * FROM recipe_catalog_checkpoint") suspend fun allCheckpoints(): List<RecipeCatalogCheckpointRow>
@Query("SELECT * FROM recipe_catalog_trust_key WHERE catalogId = :catalogId ORDER BY keyId") suspend fun trustKeys(catalogId: String): List<RecipeCatalogTrustKeyRow>
@Query("SELECT * FROM recipe_catalog_installed WHERE catalogId = :catalogId ORDER BY stableId") suspend fun installed(catalogId: String): List<RecipeCatalogInstalledRow>
@Query("SELECT * FROM recipe_catalog_installed ORDER BY catalogId, stableId") suspend fun allInstalled(): List<RecipeCatalogInstalledRow>
@Insert(onConflict = OnConflictStrategy.IGNORE) suspend fun insertCheckpoint(row: RecipeCatalogCheckpointRow): Long
@Insert(onConflict = OnConflictStrategy.ABORT) suspend fun insertTrustKeys(rows: List<RecipeCatalogTrustKeyRow>)
@Upsert suspend fun upsertCheckpoint(row: RecipeCatalogCheckpointRow)
@Upsert suspend fun upsertInstalled(row: RecipeCatalogInstalledRow)
@Query("DELETE FROM recipe_catalog_installed WHERE catalogId = :catalogId AND stableId = :stableId") suspend fun deleteInstalled(catalogId: String, stableId: String)
@Query("DELETE FROM recipe_catalog_trust_key WHERE catalogId = :catalogId") suspend fun deleteTrustKeys(catalogId: String)
}
@Database(
entities = [
MangaRow::class,
MangaCreditRow::class,
ChapterRow::class,
CategoryRow::class,
SourceRow::class,
HistoryRow::class,
UpdateRow::class,
DownloadRow::class,
TrackRow::class,
TrackPreferenceRow::class,
TrackSearchRow::class,
SyncPreferenceRow::class,
ChangedPartRow::class,
CustomButtonRow::class,
PageCacheRow::class,
SettingsRow::class,
OutboxRow::class,
RecipeCatalogCheckpointRow::class,
RecipeCatalogTrustKeyRow::class,
RecipeCatalogInstalledRow::class,
],
version = 16,
exportSchema = true,
)
@ConstructedBy(YokanRoomDatabaseConstructor::class)
abstract class YokanRoomDatabase : RoomDatabase() {
abstract fun mangaDao(): MangaDao
abstract fun mangaCreditDao(): MangaCreditDao
abstract fun chapterDao(): ChapterDao
abstract fun categoryDao(): CategoryDao
abstract fun sourceDao(): SourceDao
abstract fun historyDao(): HistoryDao
abstract fun updateDao(): UpdateDao
abstract fun downloadDao(): DownloadDao
abstract fun trackDao(): TrackDao
abstract fun trackPreferenceDao(): TrackPreferenceDao
abstract fun trackSearchDao(): TrackSearchDao
abstract fun syncPreferenceDao(): SyncPreferenceDao
abstract fun changedPartDao(): ChangedPartDao
abstract fun customButtonDao(): CustomButtonDao
abstract fun pageCacheDao(): PageCacheDao
abstract fun settingsDao(): SettingsDao
abstract fun outboxDao(): OutboxDao
abstract fun recipeInstallationDao(): RecipeInstallationDao
}
/** v1 → v2: hub sync. New `outbox` table, hub cursor columns on `sync_preference`. */
val MIGRATION_1_2: Migration = object : Migration(1, 2) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL(
"CREATE TABLE IF NOT EXISTS `outbox` (`kind` INTEGER NOT NULL, `id` INTEGER NOT NULL, `path` TEXT NOT NULL, " +
"`value` TEXT, `hlc` INTEGER NOT NULL, `seq` INTEGER NOT NULL, PRIMARY KEY(`kind`, `id`, `path`))",
)
connection.execSQL("ALTER TABLE `sync_preference` ADD COLUMN `hubHead` INTEGER NOT NULL DEFAULT 0")
connection.execSQL("ALTER TABLE `sync_preference` ADD COLUMN `hubEpoch` INTEGER NOT NULL DEFAULT 0")
connection.execSQL("ALTER TABLE `sync_preference` ADD COLUMN `hubHlc` INTEGER NOT NULL DEFAULT 0")
connection.execSQL("ALTER TABLE `sync_preference` ADD COLUMN `deviceId` TEXT")
}
}
/** v2 → v3: tag outbox operations with the hub history epoch. */
val MIGRATION_2_3: Migration = object : Migration(2, 3) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("ALTER TABLE `outbox` ADD COLUMN `epoch` INTEGER NOT NULL DEFAULT 0")
}
}
/** v3 → v4: persist interrupted hub rollback recovery. */
val MIGRATION_3_4: Migration = object : Migration(3, 4) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("ALTER TABLE `sync_preference` ADD COLUMN `hubRecoveryPending` INTEGER NOT NULL DEFAULT 0")
}
}
/** v4 → v5: persist bootstrap eligibility independently of the hub cursor. */
val MIGRATION_4_5: Migration = object : Migration(4, 5) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("ALTER TABLE `sync_preference` ADD COLUMN `hubBootstrapComplete` INTEGER NOT NULL DEFAULT 1")
}
}
/** v5 → v6: durable, host-owned recipe catalog checkpoints and artifact records. */
val MIGRATION_5_6: Migration = object : Migration(5, 6) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("CREATE TABLE IF NOT EXISTS `recipe_catalog_checkpoint` (`catalogId` TEXT NOT NULL, `generation` INTEGER NOT NULL, `replayRevision` INTEGER, `replayPayloadHash` BLOB, PRIMARY KEY(`catalogId`))")
connection.execSQL("CREATE TABLE IF NOT EXISTS `recipe_catalog_trust_key` (`catalogId` TEXT NOT NULL, `keyId` TEXT NOT NULL, `rawEd25519PublicKey` BLOB NOT NULL, `state` TEXT NOT NULL, `validFromEpochSeconds` INTEGER, `validUntilEpochSeconds` INTEGER, PRIMARY KEY(`catalogId`, `keyId`))")
connection.execSQL("CREATE TABLE IF NOT EXISTS `recipe_catalog_installed` (`catalogId` TEXT NOT NULL, `stableId` TEXT NOT NULL, `catalogRevision` INTEGER NOT NULL, `releaseVersion` TEXT NOT NULL, `sha256` TEXT NOT NULL, `sizeBytes` INTEGER NOT NULL, `artifactBytes` BLOB NOT NULL, PRIMARY KEY(`catalogId`, `stableId`))")
}
}
/** v6 → v7: bind each signed recipe artifact to a durable, host-owned source row. */
val MIGRATION_6_7: Migration = object : Migration(6, 7) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("ALTER TABLE `recipe_catalog_installed` ADD COLUMN `sourceId` INTEGER")
}
}
/** v7 → v8: page-list freshness. Existing lists get no `fetchedAt`, so they are refetched once. */
val MIGRATION_7_8: Migration = object : Migration(7, 8) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("ALTER TABLE `page_cache` ADD COLUMN `fetchedAt` INTEGER")
connection.execSQL("ALTER TABLE `page_cache` ADD COLUMN `sourceId` INTEGER")
connection.execSQL("ALTER TABLE `page_cache` ADD COLUMN `sourceVersion` TEXT")
}
}
/** v8 → v9: keep the selected sync server provider independent of its configured URL. */
val MIGRATION_8_9: Migration = object : Migration(8, 9) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("ALTER TABLE `sync_preference` ADD COLUMN `serverProvider` TEXT NOT NULL DEFAULT 'YokanHub'")
}
}
/** v9 → v10: persist stable Mangayomi-safe client IDs. */
val MIGRATION_9_10: Migration = object : Migration(9, 10) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("ALTER TABLE `sync_preference` ADD COLUMN `mangayomiIdMappings` TEXT")
}
}
/** v10 → v11: private title notes, empty for existing libraries. */
val MIGRATION_10_11: Migration = object : Migration(10, 11) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("ALTER TABLE `manga` ADD COLUMN `privateNote` TEXT NOT NULL DEFAULT ''")
}
}
/** v11 → v12: restore pause intent and exact download destinations/options. */
val MIGRATION_11_12: Migration = object : Migration(11, 12) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("ALTER TABLE `download` ADD COLUMN `isPaused` INTEGER NOT NULL DEFAULT 0")
connection.execSQL("ALTER TABLE `download` ADD COLUMN `storageLocation` TEXT")
connection.execSQL("ALTER TABLE `download` ADD COLUMN `requestJson` TEXT")
}
}
/** v12 → v13: independent chapter discovery timestamps and provider-announced anime schedules. */
val MIGRATION_12_13: Migration = object : Migration(12, 13) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("ALTER TABLE `chapter` ADD COLUMN `fetchedAt` INTEGER NOT NULL DEFAULT 0")
connection.execSQL("ALTER TABLE `manga` ADD COLUMN `nextEpisodeAiringAt` INTEGER NOT NULL DEFAULT 0")
connection.execSQL("ALTER TABLE `manga` ADD COLUMN `nextEpisodeNumber` INTEGER DEFAULT NULL")
connection.execSQL("ALTER TABLE `manga` ADD COLUMN `airingScheduleUpdatedAt` INTEGER NOT NULL DEFAULT 0")
}
}
/** v13 → v14: source numbering independent of optional local episode display titles. */
val MIGRATION_13_14: Migration = object : Migration(13, 14) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("ALTER TABLE `chapter` ADD COLUMN `number` REAL DEFAULT NULL")
connection.execSQL("ALTER TABLE `chapter` ADD COLUMN `season` INTEGER DEFAULT NULL")
connection.execSQL("ALTER TABLE `chapter` ADD COLUMN `numberingName` TEXT DEFAULT NULL")
}
}
val MIGRATION_14_15: Migration = object : Migration(14, 15) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("CREATE TABLE IF NOT EXISTS `manga_credit` (`mangaId` INTEGER NOT NULL, `position` INTEGER NOT NULL, `name` TEXT NOT NULL, `role` TEXT, `character` TEXT, `imageUrl` TEXT, PRIMARY KEY(`mangaId`, `position`), FOREIGN KEY(`mangaId`) REFERENCES `manga`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE)")
}
}
/** v15 → v16: Animetail season records (parent link, fetch type, season number) and user filler overrides. */
val MIGRATION_15_16: Migration = object : Migration(15, 16) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("ALTER TABLE `manga` ADD COLUMN `parentId` INTEGER DEFAULT NULL")
connection.execSQL("ALTER TABLE `manga` ADD COLUMN `fetchType` TEXT NOT NULL DEFAULT 'Episodes'")
connection.execSQL("ALTER TABLE `manga` ADD COLUMN `seasonNumber` REAL DEFAULT NULL")
connection.execSQL("ALTER TABLE `chapter` ADD COLUMN `fillerOverride` INTEGER DEFAULT NULL")
}
}
@Suppress("KotlinNoActualForExpect")
expect object YokanRoomDatabaseConstructor : RoomDatabaseConstructor<YokanRoomDatabase> {
override fun initialize(): YokanRoomDatabase
}
expect fun createYokanRoomDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId = eu.friedcutlet.yokan.domain.ProfileId.Default): YokanRoomDatabase
/** Driver, query lane and full migration chain shared by every [createYokanRoomDatabase] actual. */
internal fun RoomDatabase.Builder<YokanRoomDatabase>.buildYokanRoom(): YokanRoomDatabase = this
.setDriver(BundledSQLiteDriver())
.setQueryCoroutineContext(roomPersistenceDispatcher)
.addMigrations(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4, MIGRATION_4_5, MIGRATION_5_6, MIGRATION_6_7, MIGRATION_7_8, MIGRATION_8_9, MIGRATION_9_10, MIGRATION_10_11, MIGRATION_11_12, MIGRATION_12_13, MIGRATION_13_14, MIGRATION_14_15, MIGRATION_15_16)
.build()
composeApp/src/wasmJsMain/kotlin/eu/friedcutlet/yokan/database/PersistentDatabase.wasm.kt
- Source · implementation · 114 lines.
- Manual task: Implement the declarations below; preserve nullability, defaults, error paths, cancellation, resource ownership and externally visible behavior.
Declaration checklist (source line numbers):
22: actual fun createDefaultDatabaseSnapshotStore(): DatabaseSnapshotStore = WasmLocalStorageSnapshotStore(SnapshotStorageKey)
33: internal fun encodeBrowserSnapshot(snapshot: YokanDatabaseSnapshot): String =
45: private class WasmLocalStorageSnapshotStore(
49: override fun load(): YokanDatabaseSnapshot? {
56: override fun save(snapshot: YokanDatabaseSnapshot) {
65: internal suspend fun coalesceWrites(
84: private fun pageHidden(): Boolean = js("document.visibilityState === 'hidden'")
86: private fun createBrowserDatabase(profileId: ProfileId): SnapshotYokanDatabase {
111: actual fun createDefaultDatabase(): YokanDatabase = createBrowserDatabase(ProfileId.Default)
114: actual fun createProfileDatabase(profileId: ProfileId): YokanDatabase = createBrowserDatabase(profileId)
Exact file bytes / download · SHA-256 60fef39b5b18f8c6f97db4e98230453408b4dd5f7297728c403cbed01702a1ac.
Complete file
@file:OptIn(kotlin.js.ExperimentalWasmJsInterop::class)
package eu.friedcutlet.yokan.database
import eu.friedcutlet.yokan.domain.ProfileId
import eu.friedcutlet.yokan.domain.ProfileStorageNamespace
import kotlinx.browser.document
import kotlinx.browser.localStorage
import kotlinx.browser.window
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancelAndJoin
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.launch
import kotlinx.coroutines.withTimeoutOrNull
import kotlinx.serialization.json.Json
import org.w3c.dom.events.Event
actual fun createDefaultDatabaseSnapshotStore(): DatabaseSnapshotStore = WasmLocalStorageSnapshotStore(SnapshotStorageKey)
private const val SnapshotStorageKey = "yokan-database-v1"
/** Compact: indentation would count against the ~5 MB localStorage quota for nothing. */
private val BrowserDatabaseJson = Json(DatabaseJson) { prettyPrint = false }
/**
* The page cache is dropped: page URLs expire, the web target has no offline reader, and it
* was the largest unbounded part of the stored snapshot.
*/
internal fun encodeBrowserSnapshot(snapshot: YokanDatabaseSnapshot): String =
BrowserDatabaseJson.encodeToString(
PersistedDatabaseSnapshot(snapshot = snapshot.copy(pageCache = emptyList())),
)
/**
* Whole-snapshot JSON persistence in `window.localStorage`. Room and the
* bundled SQLite driver have no wasm artifacts, so the browser keeps the
* legacy snapshot backend.
*/
// ponytail: one localStorage key keeps every save atomic (restore and F9 retry rely on it);
// per-section keys need a generation/manifest scheme, add it if saves still hit the quota.
private class WasmLocalStorageSnapshotStore(
private val key: String,
private val requireValidSnapshot: Boolean = false,
) : DatabaseSnapshotStore {
override fun load(): YokanDatabaseSnapshot? {
val raw = localStorage.getItem(key) ?: return null
val snapshot = decodeDatabaseSnapshot(raw)
check(!requireValidSnapshot || snapshot != null) { "Profile database cannot be read safely" }
return snapshot
}
override fun save(snapshot: YokanDatabaseSnapshot) {
localStorage.setItem(key, encodeBrowserSnapshot(snapshot))
}
}
/**
* Calls [write] once [quietMillis] pass without a change, or [maxWaitMillis] after the first
* unsaved change while changes keep arriving, so a steady stream can't postpone saving forever.
*/
internal suspend fun coalesceWrites(
changes: Flow<*>,
quietMillis: Long,
maxWaitMillis: Long,
write: () -> Unit,
) = coroutineScope {
val pending = Channel<Unit>(Channel.CONFLATED)
launch { changes.collect { pending.send(Unit) } }
while (true) {
pending.receive()
withTimeoutOrNull(maxWaitMillis) {
do {
val changed = withTimeoutOrNull(quietMillis) { pending.receive() }
} while (changed != null)
}
write()
}
}
private fun pageHidden(): Boolean = js("document.visibilityState === 'hidden'")
private fun createBrowserDatabase(profileId: ProfileId): SnapshotYokanDatabase {
val job = SupervisorJob()
lateinit var database: SnapshotYokanDatabase
val hidden: (Event) -> Unit = { if (pageHidden()) database.persistIfDirty() }
val pageHide: (Event) -> Unit = { database.persistIfDirty() }
database = SnapshotYokanDatabase(
WasmLocalStorageSnapshotStore(ProfileStorageNamespace(profileId).browserSnapshotKey, requireValidSnapshot = profileId != ProfileId.Default),
stopPersistence = {
job.cancelAndJoin()
document.removeEventListener("visibilitychange", hidden)
window.removeEventListener("pagehide", pageHide)
},
)
CoroutineScope(Dispatchers.Default + job).launch {
// persistIfDirty saves current memory, so a pending old emission cannot undo a restore.
coalesceWrites(database.snapshots(), quietMillis = 1_000L, maxWaitMillis = 10_000L) {
database.persistIfDirty()
}
}
// The page may be discarded after either event without another chance to run.
document.addEventListener("visibilitychange", hidden)
window.addEventListener("pagehide", pageHide)
return database
}
actual fun createDefaultDatabase(): YokanDatabase = createBrowserDatabase(ProfileId.Default)
/** Each backend owns and removes its persistence job/listeners when the session closes it. */
actual fun createProfileDatabase(profileId: ProfileId): YokanDatabase = createBrowserDatabase(profileId)
composeApp/src/wasmJsTest/kotlin/eu/friedcutlet/yokan/database/BrowserSnapshotPersistenceTest.kt
- Source · test / fixture · 42 lines.
- Manual task: Recreate the fixtures and assertions in this file after its production contract exists. Run it in its original source set; distinguish deterministic checks from native/live integration checks.
Declaration checklist (source line numbers):
14: class BrowserSnapshotPersistenceTest {
16: fun steadyChangesStillSaveAtMaxWaitThenOnceAfterQuiet() = runTest {
33: fun storedSnapshotIsCompactAndOmitsPageCache() {
Exact file bytes / download · SHA-256 63b958be9fe9bc95b4b3a83341f8d77358cce75d9c93694cf869b7e8204f6a62.
Complete file
package eu.friedcutlet.yokan.database
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
@OptIn(ExperimentalCoroutinesApi::class)
class BrowserSnapshotPersistenceTest {
@Test
fun steadyChangesStillSaveAtMaxWaitThenOnceAfterQuiet() = runTest {
val changes = MutableSharedFlow<Int>()
var writes = 0
backgroundScope.launch { coalesceWrites(changes, quietMillis = 1_000L, maxWaitMillis = 10_000L) { writes++ } }
runCurrent()
repeat(50) { change -> // one change every 500 ms for 25 s: a plain debounce never fires
changes.emit(change)
advanceTimeBy(500L)
}
assertEquals(2, writes)
advanceTimeBy(1_001L)
assertEquals(3, writes)
advanceTimeBy(60_000L)
assertEquals(3, writes)
}
@Test
fun storedSnapshotIsCompactAndOmitsPageCache() {
val snapshot = seedDatabaseSnapshot().copy(
mangas = listOf(DbManga(id = 1, name = "Kept")),
pageCache = listOf(DbChapterPageUrls(chapterId = 1, urls = listOf("https://example.test/1.png"))),
)
val raw = encodeBrowserSnapshot(snapshot)
assertFalse(raw.contains('\n'))
assertEquals(snapshot.copy(pageCache = emptyList()), decodeDatabaseSnapshot(raw))
}
}