From fb7e2f930987fb286d3c6da1506e58069dfb232f Mon Sep 17 00:00:00 2001 From: Adetunji Dahunsi Date: Mon, 10 Aug 2026 20:32:31 -0400 Subject: [PATCH 1/2] Data layer for muting reposts --- .../data/network/models/ProfileConversions.kt | 2 + .../data/repository/ProfileRepository.kt | 12 +- .../49.json | 4769 +++++++++++++++++ .../tunjid/heron/data/database/AppDatabase.kt | 4 +- .../profile/ProfileViewerStateEntity.kt | 7 + .../tunjid/heron/data/core/models/Profile.kt | 4 + .../data/core/models/ProfileViewerState.kt | 5 + gradle/libs.versions.toml | 2 +- 8 files changed, 4801 insertions(+), 4 deletions(-) create mode 100644 data/database/schemas/com.tunjid.heron.data.database.AppDatabase/49.json diff --git a/data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/models/ProfileConversions.kt b/data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/models/ProfileConversions.kt index ad22a6612..b61eac4c4 100644 --- a/data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/models/ProfileConversions.kt +++ b/data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/models/ProfileConversions.kt @@ -296,6 +296,8 @@ private fun profileViewerStateEntity( followedBy = viewer.followedBy?.atUri?.let(::FollowUri), blocking = viewer.blocking?.atUri?.let(::BlockUri), commonFollowersCount = viewer.knownFollowers?.count, + mutedOnlyReposts = viewer.mutedOnlyReposts, + mutedOnlyQuotePosts = viewer.mutedOnlyQuoteposts, ) // TODO: Use this when known follower profiles are also saved diff --git a/data/core/src/commonMain/kotlin/com/tunjid/heron/data/repository/ProfileRepository.kt b/data/core/src/commonMain/kotlin/com/tunjid/heron/data/repository/ProfileRepository.kt index 470b4dc70..e45c467e7 100644 --- a/data/core/src/commonMain/kotlin/com/tunjid/heron/data/repository/ProfileRepository.kt +++ b/data/core/src/commonMain/kotlin/com/tunjid/heron/data/repository/ProfileRepository.kt @@ -507,18 +507,26 @@ internal class OfflineProfileRepository( is Profile.Restriction.Mute -> networkService.runCatchingWithMonitoredNetworkRetry { when (restriction) { is Profile.Restriction.Mute.Add -> muteActor( - MuteActorRequest(restriction.profileId.id.let(::Did)), + MuteActorRequest( + actor = restriction.profileId.id.let(::Did), + onlyReposts = restriction.onlyReposts.takeIf { it }, + onlyQuoteposts = restriction.onlyQuoteposts.takeIf { it }, + ), ) is Profile.Restriction.Mute.Remove -> unmuteActor( UnmuteActorRequest(restriction.profileId.id.let(::Did)), ) } }.toOutcome { + val add = restriction as? Profile.Restriction.Mute.Add profileDao.updatePartialProfileViewer( ProfileViewerStateEntity.MutedPartial( profileId = restriction.signedInProfileId, otherProfileId = restriction.profileId, - muted = restriction is Profile.Restriction.Mute.Add, + // Scoped mutes are exclusive with a full mute, mirroring the lexicon. + muted = add != null && !add.onlyReposts && !add.onlyQuoteposts, + mutedOnlyReposts = add?.onlyReposts == true, + mutedOnlyQuotePosts = add?.onlyQuoteposts == true, ), ) } diff --git a/data/database/schemas/com.tunjid.heron.data.database.AppDatabase/49.json b/data/database/schemas/com.tunjid.heron.data.database.AppDatabase/49.json new file mode 100644 index 000000000..1d60c9dad --- /dev/null +++ b/data/database/schemas/com.tunjid.heron.data.database.AppDatabase/49.json @@ -0,0 +1,4769 @@ +{ + "formatVersion": 1, + "database": { + "version": 49, + "identityHash": "355bd7568f1e54fe574a4d3b9e59b7fb", + "entities": [ + { + "tableName": "bookmarks", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`bookmarkedUri` TEXT NOT NULL, `viewingProfileId` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, PRIMARY KEY(`bookmarkedUri`, `viewingProfileId`))", + "fields": [ + { + "fieldPath": "bookmarkedUri", + "columnName": "bookmarkedUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "viewingProfileId", + "columnName": "viewingProfileId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "bookmarkedUri", + "viewingProfileId" + ] + }, + "indices": [ + { + "name": "index_bookmarks_createdAt", + "unique": false, + "columnNames": [ + "createdAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_bookmarks_createdAt` ON `${TABLE_NAME}` (`createdAt`)" + }, + { + "name": "index_bookmarks_bookmarkedUri", + "unique": false, + "columnNames": [ + "bookmarkedUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_bookmarks_bookmarkedUri` ON `${TABLE_NAME}` (`bookmarkedUri`)" + }, + { + "name": "index_bookmarks_viewingProfileId_createdAt", + "unique": false, + "columnNames": [ + "viewingProfileId", + "createdAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_bookmarks_viewingProfileId_createdAt` ON `${TABLE_NAME}` (`viewingProfileId`, `createdAt`)" + } + ] + }, + { + "tableName": "postDrafts", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `authorId` TEXT NOT NULL, `content` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "authorId", + "columnName": "authorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "content", + "columnName": "content", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "updatedAt", + "columnName": "updatedAt", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_postDrafts_authorId", + "unique": false, + "columnNames": [ + "authorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postDrafts_authorId` ON `${TABLE_NAME}` (`authorId`)" + }, + { + "name": "index_postDrafts_authorId_updatedAt", + "unique": false, + "columnNames": [ + "authorId", + "updatedAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postDrafts_authorId_updatedAt` ON `${TABLE_NAME}` (`authorId`, `updatedAt`)" + } + ] + }, + { + "tableName": "externalEmbeds", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uri` TEXT NOT NULL, `title` TEXT NOT NULL, `description` TEXT NOT NULL, `thumb` TEXT, `readingTime` INTEGER, `createdAt` INTEGER, `updatedAt` INTEGER, PRIMARY KEY(`uri`))", + "fields": [ + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "title", + "columnName": "title", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "description", + "columnName": "description", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "thumb", + "columnName": "thumb", + "affinity": "TEXT" + }, + { + "fieldPath": "readingTime", + "columnName": "readingTime", + "affinity": "INTEGER" + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER" + }, + { + "fieldPath": "updatedAt", + "columnName": "updatedAt", + "affinity": "INTEGER" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + } + }, + { + "tableName": "images", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`fullSize` TEXT NOT NULL, `thumb` TEXT NOT NULL, `alt` TEXT NOT NULL, `width` INTEGER, `height` INTEGER, `index` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`fullSize`))", + "fields": [ + { + "fieldPath": "fullSize", + "columnName": "fullSize", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "thumb", + "columnName": "thumb", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "alt", + "columnName": "alt", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "width", + "columnName": "width", + "affinity": "INTEGER" + }, + { + "fieldPath": "height", + "columnName": "height", + "affinity": "INTEGER" + }, + { + "fieldPath": "index", + "columnName": "index", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "fullSize" + ] + } + }, + { + "tableName": "videos", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cid` TEXT NOT NULL, `playlist` TEXT NOT NULL, `thumbnail` TEXT, `alt` TEXT, `width` INTEGER, `height` INTEGER, `index` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`cid`))", + "fields": [ + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "playlist", + "columnName": "playlist", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "thumbnail", + "columnName": "thumbnail", + "affinity": "TEXT" + }, + { + "fieldPath": "alt", + "columnName": "alt", + "affinity": "TEXT" + }, + { + "fieldPath": "width", + "columnName": "width", + "affinity": "INTEGER" + }, + { + "fieldPath": "height", + "columnName": "height", + "affinity": "INTEGER" + }, + { + "fieldPath": "index", + "columnName": "index", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "cid" + ] + } + }, + { + "tableName": "postExternalEmbeds", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postUri` TEXT NOT NULL, `externalEmbedUri` TEXT NOT NULL, PRIMARY KEY(`postUri`, `externalEmbedUri`), FOREIGN KEY(`postUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`externalEmbedUri`) REFERENCES `externalEmbeds`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "postUri", + "columnName": "postUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "externalEmbedUri", + "columnName": "externalEmbedUri", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "postUri", + "externalEmbedUri" + ] + }, + "indices": [ + { + "name": "index_postExternalEmbeds_postUri", + "unique": false, + "columnNames": [ + "postUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postExternalEmbeds_postUri` ON `${TABLE_NAME}` (`postUri`)" + }, + { + "name": "index_postExternalEmbeds_externalEmbedUri", + "unique": false, + "columnNames": [ + "externalEmbedUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postExternalEmbeds_externalEmbedUri` ON `${TABLE_NAME}` (`externalEmbedUri`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "postUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "externalEmbeds", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "externalEmbedUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "postExternalAssociatedRecords", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postUri` TEXT NOT NULL, `externalEmbedUri` TEXT NOT NULL, `recordUri` TEXT NOT NULL, `recordCid` TEXT, PRIMARY KEY(`postUri`, `externalEmbedUri`, `recordUri`), FOREIGN KEY(`postUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`externalEmbedUri`) REFERENCES `externalEmbeds`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "postUri", + "columnName": "postUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "externalEmbedUri", + "columnName": "externalEmbedUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "recordUri", + "columnName": "recordUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "recordCid", + "columnName": "recordCid", + "affinity": "TEXT" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "postUri", + "externalEmbedUri", + "recordUri" + ] + }, + "indices": [ + { + "name": "index_postExternalAssociatedRecords_postUri", + "unique": false, + "columnNames": [ + "postUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postExternalAssociatedRecords_postUri` ON `${TABLE_NAME}` (`postUri`)" + }, + { + "name": "index_postExternalAssociatedRecords_externalEmbedUri", + "unique": false, + "columnNames": [ + "externalEmbedUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postExternalAssociatedRecords_externalEmbedUri` ON `${TABLE_NAME}` (`externalEmbedUri`)" + }, + { + "name": "index_postExternalAssociatedRecords_recordUri", + "unique": false, + "columnNames": [ + "recordUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postExternalAssociatedRecords_recordUri` ON `${TABLE_NAME}` (`recordUri`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "postUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "externalEmbeds", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "externalEmbedUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "postExternalAssociatedProfiles", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postUri` TEXT NOT NULL, `externalEmbedUri` TEXT NOT NULL, `profileId` TEXT NOT NULL, `ordinal` INTEGER NOT NULL, PRIMARY KEY(`postUri`, `externalEmbedUri`, `profileId`), FOREIGN KEY(`postUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`externalEmbedUri`) REFERENCES `externalEmbeds`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`profileId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "postUri", + "columnName": "postUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "externalEmbedUri", + "columnName": "externalEmbedUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "profileId", + "columnName": "profileId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "ordinal", + "columnName": "ordinal", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "postUri", + "externalEmbedUri", + "profileId" + ] + }, + "indices": [ + { + "name": "index_postExternalAssociatedProfiles_postUri", + "unique": false, + "columnNames": [ + "postUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postExternalAssociatedProfiles_postUri` ON `${TABLE_NAME}` (`postUri`)" + }, + { + "name": "index_postExternalAssociatedProfiles_externalEmbedUri", + "unique": false, + "columnNames": [ + "externalEmbedUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postExternalAssociatedProfiles_externalEmbedUri` ON `${TABLE_NAME}` (`externalEmbedUri`)" + }, + { + "name": "index_postExternalAssociatedProfiles_profileId", + "unique": false, + "columnNames": [ + "profileId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postExternalAssociatedProfiles_profileId` ON `${TABLE_NAME}` (`profileId`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "postUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "externalEmbeds", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "externalEmbedUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "profileId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "postImages", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postUri` TEXT NOT NULL, `imageUri` TEXT NOT NULL, PRIMARY KEY(`postUri`, `imageUri`), FOREIGN KEY(`postUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`imageUri`) REFERENCES `images`(`fullSize`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "postUri", + "columnName": "postUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "imageUri", + "columnName": "imageUri", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "postUri", + "imageUri" + ] + }, + "indices": [ + { + "name": "index_postImages_postUri", + "unique": false, + "columnNames": [ + "postUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postImages_postUri` ON `${TABLE_NAME}` (`postUri`)" + }, + { + "name": "index_postImages_imageUri", + "unique": false, + "columnNames": [ + "imageUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postImages_imageUri` ON `${TABLE_NAME}` (`imageUri`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "postUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "images", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "imageUri" + ], + "referencedColumns": [ + "fullSize" + ] + } + ] + }, + { + "tableName": "postVideos", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postUri` TEXT NOT NULL, `videoId` TEXT NOT NULL, PRIMARY KEY(`postUri`, `videoId`), FOREIGN KEY(`postUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`videoId`) REFERENCES `videos`(`cid`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "postUri", + "columnName": "postUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "videoId", + "columnName": "videoId", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "postUri", + "videoId" + ] + }, + "indices": [ + { + "name": "index_postVideos_postUri", + "unique": false, + "columnNames": [ + "postUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postVideos_postUri` ON `${TABLE_NAME}` (`postUri`)" + }, + { + "name": "index_postVideos_videoId", + "unique": false, + "columnNames": [ + "videoId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postVideos_videoId` ON `${TABLE_NAME}` (`videoId`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "postUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "videos", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "videoId" + ], + "referencedColumns": [ + "cid" + ] + } + ] + }, + { + "tableName": "postPosts", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postUri` TEXT NOT NULL, `embeddedPostUri` TEXT NOT NULL, PRIMARY KEY(`postUri`, `embeddedPostUri`), FOREIGN KEY(`postUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`embeddedPostUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "postUri", + "columnName": "postUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "embeddedPostUri", + "columnName": "embeddedPostUri", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "postUri", + "embeddedPostUri" + ] + }, + "indices": [ + { + "name": "index_postPosts_postUri", + "unique": false, + "columnNames": [ + "postUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postPosts_postUri` ON `${TABLE_NAME}` (`postUri`)" + }, + { + "name": "index_postPosts_embeddedPostUri", + "unique": false, + "columnNames": [ + "embeddedPostUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postPosts_embeddedPostUri` ON `${TABLE_NAME}` (`embeddedPostUri`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "postUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "embeddedPostUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "posts", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cid` TEXT NOT NULL, `uri` TEXT NOT NULL, `authorId` TEXT NOT NULL, `replyCount` INTEGER, `repostCount` INTEGER, `likeCount` INTEGER, `quoteCount` INTEGER, `hasThreadGate` INTEGER, `indexedAt` INTEGER NOT NULL, `text` TEXT, `base64EncodedRecord` TEXT, `embeddedRecordUri` TEXT, `createdAt` INTEGER, `via` TEXT DEFAULT NULL, PRIMARY KEY(`uri`), FOREIGN KEY(`authorId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "authorId", + "columnName": "authorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "replyCount", + "columnName": "replyCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "repostCount", + "columnName": "repostCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "likeCount", + "columnName": "likeCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "quoteCount", + "columnName": "quoteCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "hasThreadGate", + "columnName": "hasThreadGate", + "affinity": "INTEGER" + }, + { + "fieldPath": "indexedAt", + "columnName": "indexedAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "record.text", + "columnName": "text", + "affinity": "TEXT" + }, + { + "fieldPath": "record.base64EncodedRecord", + "columnName": "base64EncodedRecord", + "affinity": "TEXT" + }, + { + "fieldPath": "record.embeddedRecordUri", + "columnName": "embeddedRecordUri", + "affinity": "TEXT" + }, + { + "fieldPath": "record.createdAt", + "columnName": "createdAt", + "affinity": "INTEGER" + }, + { + "fieldPath": "record.via", + "columnName": "via", + "affinity": "TEXT", + "defaultValue": "NULL" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + }, + "indices": [ + { + "name": "index_posts_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_posts_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_posts_cid", + "unique": false, + "columnNames": [ + "cid" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_posts_cid` ON `${TABLE_NAME}` (`cid`)" + }, + { + "name": "index_posts_authorId", + "unique": false, + "columnNames": [ + "authorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_posts_authorId` ON `${TABLE_NAME}` (`authorId`)" + } + ], + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "authorId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "postAuthors", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postUri` TEXT NOT NULL, `authorId` TEXT NOT NULL, PRIMARY KEY(`postUri`, `authorId`), FOREIGN KEY(`postUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`authorId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "postUri", + "columnName": "postUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "authorId", + "columnName": "authorId", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "postUri", + "authorId" + ] + }, + "indices": [ + { + "name": "index_postAuthors_postUri", + "unique": false, + "columnNames": [ + "postUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postAuthors_postUri` ON `${TABLE_NAME}` (`postUri`)" + }, + { + "name": "index_postAuthors_authorId", + "unique": false, + "columnNames": [ + "authorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postAuthors_authorId` ON `${TABLE_NAME}` (`authorId`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "postUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "authorId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "postThreads", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`parentPostUri` TEXT NOT NULL, `postUri` TEXT NOT NULL, PRIMARY KEY(`parentPostUri`, `postUri`), FOREIGN KEY(`parentPostUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`postUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "parentPostUri", + "columnName": "parentPostUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "postUri", + "columnName": "postUri", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "parentPostUri", + "postUri" + ] + }, + "indices": [ + { + "name": "index_postThreads_parentPostUri", + "unique": false, + "columnNames": [ + "parentPostUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postThreads_parentPostUri` ON `${TABLE_NAME}` (`parentPostUri`)" + }, + { + "name": "index_postThreads_postUri", + "unique": false, + "columnNames": [ + "postUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postThreads_postUri` ON `${TABLE_NAME}` (`postUri`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "parentPostUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "postUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "postViewerStatistics", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postUri` TEXT NOT NULL, `viewingProfileId` TEXT NOT NULL, `likeUri` TEXT DEFAULT NULL, `repostUri` TEXT DEFAULT NULL, `threadMuted` INTEGER NOT NULL, `replyDisabled` INTEGER NOT NULL, `embeddingDisabled` INTEGER NOT NULL, `pinned` INTEGER NOT NULL, `bookmarked` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`postUri`, `viewingProfileId`), FOREIGN KEY(`postUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`viewingProfileId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "postUri", + "columnName": "postUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "viewingProfileId", + "columnName": "viewingProfileId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "likeUri", + "columnName": "likeUri", + "affinity": "TEXT", + "defaultValue": "NULL" + }, + { + "fieldPath": "repostUri", + "columnName": "repostUri", + "affinity": "TEXT", + "defaultValue": "NULL" + }, + { + "fieldPath": "threadMuted", + "columnName": "threadMuted", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "replyDisabled", + "columnName": "replyDisabled", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "embeddingDisabled", + "columnName": "embeddingDisabled", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "pinned", + "columnName": "pinned", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "bookmarked", + "columnName": "bookmarked", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "postUri", + "viewingProfileId" + ] + }, + "indices": [ + { + "name": "index_postViewerStatistics_postUri", + "unique": false, + "columnNames": [ + "postUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postViewerStatistics_postUri` ON `${TABLE_NAME}` (`postUri`)" + }, + { + "name": "index_postViewerStatistics_viewingProfileId", + "unique": false, + "columnNames": [ + "viewingProfileId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postViewerStatistics_viewingProfileId` ON `${TABLE_NAME}` (`viewingProfileId`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "postUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "viewingProfileId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "profileTabs", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`profileId` TEXT NOT NULL, `delimitedTabs` TEXT NOT NULL, PRIMARY KEY(`profileId`), FOREIGN KEY(`profileId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "profileId", + "columnName": "profileId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "delimitedTabs", + "columnName": "delimitedTabs", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "profileId" + ] + }, + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "profileId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "profileAtmosphereApps", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`profileId` TEXT NOT NULL, `atmosphereAppId` TEXT NOT NULL, `viewingProfileId` TEXT NOT NULL, PRIMARY KEY(`profileId`, `atmosphereAppId`, `viewingProfileId`), FOREIGN KEY(`profileId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`viewingProfileId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "profileId", + "columnName": "profileId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "atmosphereAppId", + "columnName": "atmosphereAppId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "viewingProfileId", + "columnName": "viewingProfileId", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "profileId", + "atmosphereAppId", + "viewingProfileId" + ] + }, + "indices": [ + { + "name": "index_profileAtmosphereApps_profileId", + "unique": false, + "columnNames": [ + "profileId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_profileAtmosphereApps_profileId` ON `${TABLE_NAME}` (`profileId`)" + }, + { + "name": "index_profileAtmosphereApps_viewingProfileId", + "unique": false, + "columnNames": [ + "viewingProfileId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_profileAtmosphereApps_viewingProfileId` ON `${TABLE_NAME}` (`viewingProfileId`)" + }, + { + "name": "index_profileAtmosphereApps_atmosphereAppId", + "unique": false, + "columnNames": [ + "atmosphereAppId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_profileAtmosphereApps_atmosphereAppId` ON `${TABLE_NAME}` (`atmosphereAppId`)" + } + ], + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "profileId" + ], + "referencedColumns": [ + "did" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "viewingProfileId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "profileViewerStates", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`profileId` TEXT NOT NULL, `otherProfileId` TEXT NOT NULL, `muted` INTEGER, `mutedByList` TEXT, `blockedBy` INTEGER, `blocking` TEXT, `blockingByList` TEXT, `following` TEXT, `followedBy` TEXT, `commonFollowersCount` INTEGER, `mutedOnlyReposts` INTEGER, `mutedOnlyQuoteposts` INTEGER, PRIMARY KEY(`profileId`, `otherProfileId`), FOREIGN KEY(`profileId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`otherProfileId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "profileId", + "columnName": "profileId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "otherProfileId", + "columnName": "otherProfileId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "muted", + "columnName": "muted", + "affinity": "INTEGER" + }, + { + "fieldPath": "mutedByList", + "columnName": "mutedByList", + "affinity": "TEXT" + }, + { + "fieldPath": "blockedBy", + "columnName": "blockedBy", + "affinity": "INTEGER" + }, + { + "fieldPath": "blocking", + "columnName": "blocking", + "affinity": "TEXT" + }, + { + "fieldPath": "blockingByList", + "columnName": "blockingByList", + "affinity": "TEXT" + }, + { + "fieldPath": "following", + "columnName": "following", + "affinity": "TEXT" + }, + { + "fieldPath": "followedBy", + "columnName": "followedBy", + "affinity": "TEXT" + }, + { + "fieldPath": "commonFollowersCount", + "columnName": "commonFollowersCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "mutedOnlyReposts", + "columnName": "mutedOnlyReposts", + "affinity": "INTEGER" + }, + { + "fieldPath": "mutedOnlyQuoteposts", + "columnName": "mutedOnlyQuoteposts", + "affinity": "INTEGER" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "profileId", + "otherProfileId" + ] + }, + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "profileId" + ], + "referencedColumns": [ + "did" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "otherProfileId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "profiles", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`did` TEXT NOT NULL, `handle` TEXT NOT NULL, `displayName` TEXT, `description` TEXT, `avatar` TEXT, `banner` TEXT, `followersCount` INTEGER, `followsCount` INTEGER, `postsCount` INTEGER, `joinedViaStarterPack` TEXT, `indexedAt` INTEGER, `createdAt` INTEGER, `pronouns` TEXT DEFAULT NULL, `createdListCount` INTEGER, `createdFeedGeneratorCount` INTEGER, `createdStarterPackCount` INTEGER, `labeler` INTEGER, `allowDms` TEXT, `status_uri` TEXT, `status_value` TEXT, `status_uriLink` TEXT, `status_title` TEXT, `status_description` TEXT, `status_thumbnail` TEXT, `status_expiresAt` INTEGER, `status_active` INTEGER, `status_disabled` INTEGER, PRIMARY KEY(`did`))", + "fields": [ + { + "fieldPath": "did", + "columnName": "did", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "handle", + "columnName": "handle", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "displayName", + "columnName": "displayName", + "affinity": "TEXT" + }, + { + "fieldPath": "description", + "columnName": "description", + "affinity": "TEXT" + }, + { + "fieldPath": "avatar", + "columnName": "avatar", + "affinity": "TEXT" + }, + { + "fieldPath": "banner", + "columnName": "banner", + "affinity": "TEXT" + }, + { + "fieldPath": "followersCount", + "columnName": "followersCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "followsCount", + "columnName": "followsCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "postsCount", + "columnName": "postsCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "joinedViaStarterPack", + "columnName": "joinedViaStarterPack", + "affinity": "TEXT" + }, + { + "fieldPath": "indexedAt", + "columnName": "indexedAt", + "affinity": "INTEGER" + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER" + }, + { + "fieldPath": "pronouns", + "columnName": "pronouns", + "affinity": "TEXT", + "defaultValue": "NULL" + }, + { + "fieldPath": "associated.createdListCount", + "columnName": "createdListCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "associated.createdFeedGeneratorCount", + "columnName": "createdFeedGeneratorCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "associated.createdStarterPackCount", + "columnName": "createdStarterPackCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "associated.labeler", + "columnName": "labeler", + "affinity": "INTEGER" + }, + { + "fieldPath": "associated.allowDms", + "columnName": "allowDms", + "affinity": "TEXT" + }, + { + "fieldPath": "status.uri", + "columnName": "status_uri", + "affinity": "TEXT" + }, + { + "fieldPath": "status.value", + "columnName": "status_value", + "affinity": "TEXT" + }, + { + "fieldPath": "status.uriLink", + "columnName": "status_uriLink", + "affinity": "TEXT" + }, + { + "fieldPath": "status.title", + "columnName": "status_title", + "affinity": "TEXT" + }, + { + "fieldPath": "status.description", + "columnName": "status_description", + "affinity": "TEXT" + }, + { + "fieldPath": "status.thumbnail", + "columnName": "status_thumbnail", + "affinity": "TEXT" + }, + { + "fieldPath": "status.expiresAt", + "columnName": "status_expiresAt", + "affinity": "INTEGER" + }, + { + "fieldPath": "status.active", + "columnName": "status_active", + "affinity": "INTEGER" + }, + { + "fieldPath": "status.disabled", + "columnName": "status_disabled", + "affinity": "INTEGER" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "did" + ] + }, + "indices": [ + { + "name": "index_profiles_did", + "unique": false, + "columnNames": [ + "did" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_profiles_did` ON `${TABLE_NAME}` (`did`)" + }, + { + "name": "index_profiles_handle", + "unique": false, + "columnNames": [ + "handle" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_profiles_handle` ON `${TABLE_NAME}` (`handle`)" + } + ] + }, + { + "tableName": "postLikes", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postUri` TEXT NOT NULL, `authorId` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `indexedAt` INTEGER NOT NULL, PRIMARY KEY(`postUri`, `authorId`), FOREIGN KEY(`postUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`authorId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "postUri", + "columnName": "postUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "authorId", + "columnName": "authorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "indexedAt", + "columnName": "indexedAt", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "postUri", + "authorId" + ] + }, + "indices": [ + { + "name": "index_postLikes_postUri", + "unique": false, + "columnNames": [ + "postUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postLikes_postUri` ON `${TABLE_NAME}` (`postUri`)" + }, + { + "name": "index_postLikes_authorId", + "unique": false, + "columnNames": [ + "authorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postLikes_authorId` ON `${TABLE_NAME}` (`authorId`)" + }, + { + "name": "index_postLikes_createdAt", + "unique": false, + "columnNames": [ + "createdAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postLikes_createdAt` ON `${TABLE_NAME}` (`createdAt`)" + }, + { + "name": "index_postLikes_indexedAt", + "unique": false, + "columnNames": [ + "indexedAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postLikes_indexedAt` ON `${TABLE_NAME}` (`indexedAt`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "postUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "authorId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "postReposts", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postUri` TEXT NOT NULL, `authorId` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `indexedAt` INTEGER NOT NULL, PRIMARY KEY(`postUri`, `authorId`), FOREIGN KEY(`postUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`authorId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "postUri", + "columnName": "postUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "authorId", + "columnName": "authorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "indexedAt", + "columnName": "indexedAt", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "postUri", + "authorId" + ] + }, + "indices": [ + { + "name": "index_postReposts_postUri", + "unique": false, + "columnNames": [ + "postUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postReposts_postUri` ON `${TABLE_NAME}` (`postUri`)" + }, + { + "name": "index_postReposts_authorId", + "unique": false, + "columnNames": [ + "authorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postReposts_authorId` ON `${TABLE_NAME}` (`authorId`)" + }, + { + "name": "index_postReposts_indexedAt", + "unique": false, + "columnNames": [ + "indexedAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_postReposts_indexedAt` ON `${TABLE_NAME}` (`indexedAt`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "postUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "authorId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "labels", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cid` TEXT, `uri` TEXT NOT NULL, `creatorId` TEXT NOT NULL, `value` TEXT NOT NULL, `version` INTEGER, `createdAt` INTEGER NOT NULL, `expiresAt` INTEGER, PRIMARY KEY(`uri`, `value`), FOREIGN KEY(`creatorId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT" + }, + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "creatorId", + "columnName": "creatorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "value", + "columnName": "value", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "version", + "columnName": "version", + "affinity": "INTEGER" + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "expiresAt", + "columnName": "expiresAt", + "affinity": "INTEGER" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri", + "value" + ] + }, + "indices": [ + { + "name": "index_labels_createdAt", + "unique": false, + "columnNames": [ + "createdAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_labels_createdAt` ON `${TABLE_NAME}` (`createdAt`)" + }, + { + "name": "index_labels_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_labels_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_labels_creatorId", + "unique": false, + "columnNames": [ + "creatorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_labels_creatorId` ON `${TABLE_NAME}` (`creatorId`)" + }, + { + "name": "index_labels_value", + "unique": false, + "columnNames": [ + "value" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_labels_value` ON `${TABLE_NAME}` (`value`)" + } + ], + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "creatorId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "labelers", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cid` TEXT NOT NULL, `uri` TEXT NOT NULL, `creatorId` TEXT NOT NULL, `likeCount` INTEGER, PRIMARY KEY(`uri`), FOREIGN KEY(`creatorId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "creatorId", + "columnName": "creatorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "likeCount", + "columnName": "likeCount", + "affinity": "INTEGER" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + }, + "indices": [ + { + "name": "index_labelers_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_labelers_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_labelers_creatorId", + "unique": false, + "columnNames": [ + "creatorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_labelers_creatorId` ON `${TABLE_NAME}` (`creatorId`)" + } + ], + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "creatorId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "labelDefinitions", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`creatorId` TEXT NOT NULL, `identifier` TEXT NOT NULL, `adultOnly` INTEGER NOT NULL, `blurs` TEXT NOT NULL, `defaultSetting` TEXT NOT NULL, `severity` TEXT NOT NULL, `localeInfoCbor` TEXT NOT NULL, PRIMARY KEY(`creatorId`, `identifier`), FOREIGN KEY(`creatorId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "creatorId", + "columnName": "creatorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "identifier", + "columnName": "identifier", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "adultOnly", + "columnName": "adultOnly", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "blurs", + "columnName": "blurs", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "defaultSetting", + "columnName": "defaultSetting", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "severity", + "columnName": "severity", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "localeInfoCbor", + "columnName": "localeInfoCbor", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "creatorId", + "identifier" + ] + }, + "indices": [ + { + "name": "index_labelDefinitions_creatorId", + "unique": false, + "columnNames": [ + "creatorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_labelDefinitions_creatorId` ON `${TABLE_NAME}` (`creatorId`)" + }, + { + "name": "index_labelDefinitions_identifier", + "unique": false, + "columnNames": [ + "identifier" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_labelDefinitions_identifier` ON `${TABLE_NAME}` (`identifier`)" + } + ], + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "creatorId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "lists", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cid` TEXT NOT NULL, `uri` TEXT NOT NULL, `creatorId` TEXT NOT NULL, `name` TEXT NOT NULL, `description` TEXT, `avatar` TEXT, `listItemCount` INTEGER, `purpose` TEXT NOT NULL, `indexedAt` INTEGER NOT NULL, `createdAt` INTEGER NOT NULL, PRIMARY KEY(`uri`), FOREIGN KEY(`creatorId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "creatorId", + "columnName": "creatorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "description", + "columnName": "description", + "affinity": "TEXT" + }, + { + "fieldPath": "avatar", + "columnName": "avatar", + "affinity": "TEXT" + }, + { + "fieldPath": "listItemCount", + "columnName": "listItemCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "purpose", + "columnName": "purpose", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "indexedAt", + "columnName": "indexedAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + }, + "indices": [ + { + "name": "index_lists_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_lists_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_lists_cid", + "unique": false, + "columnNames": [ + "cid" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_lists_cid` ON `${TABLE_NAME}` (`cid`)" + }, + { + "name": "index_lists_creatorId", + "unique": false, + "columnNames": [ + "creatorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_lists_creatorId` ON `${TABLE_NAME}` (`creatorId`)" + }, + { + "name": "index_lists_indexedAt", + "unique": false, + "columnNames": [ + "indexedAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_lists_indexedAt` ON `${TABLE_NAME}` (`indexedAt`)" + }, + { + "name": "index_lists_createdAt", + "unique": false, + "columnNames": [ + "createdAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_lists_createdAt` ON `${TABLE_NAME}` (`createdAt`)" + } + ], + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "creatorId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "listMembers", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uri` TEXT NOT NULL, `listUri` TEXT NOT NULL, `subjectId` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, PRIMARY KEY(`uri`), FOREIGN KEY(`subjectId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`listUri`) REFERENCES `lists`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "listUri", + "columnName": "listUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "subjectId", + "columnName": "subjectId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + }, + "indices": [ + { + "name": "index_listMembers_createdAt", + "unique": false, + "columnNames": [ + "createdAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_listMembers_createdAt` ON `${TABLE_NAME}` (`createdAt`)" + } + ], + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "subjectId" + ], + "referencedColumns": [ + "did" + ] + }, + { + "table": "lists", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "listUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "feedGenerators", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cid` TEXT NOT NULL, `did` TEXT NOT NULL, `uri` TEXT NOT NULL, `avatar` TEXT, `likeCount` INTEGER, `creatorId` TEXT NOT NULL, `displayName` TEXT NOT NULL, `description` TEXT, `acceptsInteractions` INTEGER, `contentMode` TEXT, `indexedAt` INTEGER NOT NULL, `createdAt` INTEGER NOT NULL, PRIMARY KEY(`uri`), FOREIGN KEY(`creatorId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "did", + "columnName": "did", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "avatar", + "columnName": "avatar", + "affinity": "TEXT" + }, + { + "fieldPath": "likeCount", + "columnName": "likeCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "creatorId", + "columnName": "creatorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "displayName", + "columnName": "displayName", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "description", + "columnName": "description", + "affinity": "TEXT" + }, + { + "fieldPath": "acceptsInteractions", + "columnName": "acceptsInteractions", + "affinity": "INTEGER" + }, + { + "fieldPath": "contentMode", + "columnName": "contentMode", + "affinity": "TEXT" + }, + { + "fieldPath": "indexedAt", + "columnName": "indexedAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + }, + "indices": [ + { + "name": "index_feedGenerators_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_feedGenerators_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_feedGenerators_cid", + "unique": false, + "columnNames": [ + "cid" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_feedGenerators_cid` ON `${TABLE_NAME}` (`cid`)" + }, + { + "name": "index_feedGenerators_creatorId", + "unique": false, + "columnNames": [ + "creatorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_feedGenerators_creatorId` ON `${TABLE_NAME}` (`creatorId`)" + }, + { + "name": "index_feedGenerators_indexedAt", + "unique": false, + "columnNames": [ + "indexedAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_feedGenerators_indexedAt` ON `${TABLE_NAME}` (`indexedAt`)" + }, + { + "name": "index_feedGenerators_createdAt", + "unique": false, + "columnNames": [ + "createdAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_feedGenerators_createdAt` ON `${TABLE_NAME}` (`createdAt`)" + } + ], + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "creatorId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "notifications", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cid` TEXT NOT NULL, `uri` TEXT NOT NULL, `authorId` TEXT NOT NULL, `ownerId` TEXT NOT NULL, `reason` TEXT NOT NULL, `reasonSubject` TEXT, `associatedPostUri` TEXT, `isRead` INTEGER NOT NULL, `indexedAt` INTEGER NOT NULL, PRIMARY KEY(`uri`, `ownerId`), FOREIGN KEY(`associatedPostUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`authorId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`ownerId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "authorId", + "columnName": "authorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "ownerId", + "columnName": "ownerId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "reason", + "columnName": "reason", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "reasonSubject", + "columnName": "reasonSubject", + "affinity": "TEXT" + }, + { + "fieldPath": "associatedPostUri", + "columnName": "associatedPostUri", + "affinity": "TEXT" + }, + { + "fieldPath": "isRead", + "columnName": "isRead", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "indexedAt", + "columnName": "indexedAt", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri", + "ownerId" + ] + }, + "indices": [ + { + "name": "index_notifications_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_notifications_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_notifications_cid", + "unique": false, + "columnNames": [ + "cid" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_notifications_cid` ON `${TABLE_NAME}` (`cid`)" + }, + { + "name": "index_notifications_authorId", + "unique": false, + "columnNames": [ + "authorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_notifications_authorId` ON `${TABLE_NAME}` (`authorId`)" + }, + { + "name": "index_notifications_ownerId", + "unique": false, + "columnNames": [ + "ownerId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_notifications_ownerId` ON `${TABLE_NAME}` (`ownerId`)" + }, + { + "name": "index_notifications_indexedAt", + "unique": false, + "columnNames": [ + "indexedAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_notifications_indexedAt` ON `${TABLE_NAME}` (`indexedAt`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "associatedPostUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "authorId" + ], + "referencedColumns": [ + "did" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "ownerId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "timelineItems", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postUri` TEXT NOT NULL, `viewingProfileId` TEXT, `sourceId` TEXT NOT NULL, `embeddedRecordUri` TEXT, `reposter` TEXT, `hasMedia` INTEGER NOT NULL DEFAULT false, `isPinned` INTEGER NOT NULL, `itemSort` INTEGER NOT NULL, `indexedAt` INTEGER NOT NULL, `feedContext` TEXT DEFAULT NULL, `reqId` TEXT DEFAULT NULL, `id` TEXT NOT NULL, `rootPostUri` TEXT, `rootPostEmbeddedRecordUri` TEXT DEFAULT NULL, `parentPostUri` TEXT, `parentPostEmbeddedRecordUri` TEXT DEFAULT NULL, `grandParentPostAuthorId` TEXT, PRIMARY KEY(`id`), FOREIGN KEY(`postUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`rootPostUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`parentPostUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`grandParentPostAuthorId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "postUri", + "columnName": "postUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "viewingProfileId", + "columnName": "viewingProfileId", + "affinity": "TEXT" + }, + { + "fieldPath": "sourceId", + "columnName": "sourceId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "embeddedRecordUri", + "columnName": "embeddedRecordUri", + "affinity": "TEXT" + }, + { + "fieldPath": "reposter", + "columnName": "reposter", + "affinity": "TEXT" + }, + { + "fieldPath": "hasMedia", + "columnName": "hasMedia", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "false" + }, + { + "fieldPath": "isPinned", + "columnName": "isPinned", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "itemSort", + "columnName": "itemSort", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "indexedAt", + "columnName": "indexedAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "feedContext", + "columnName": "feedContext", + "affinity": "TEXT", + "defaultValue": "NULL" + }, + { + "fieldPath": "reqId", + "columnName": "reqId", + "affinity": "TEXT", + "defaultValue": "NULL" + }, + { + "fieldPath": "id", + "columnName": "id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "reply.rootPostUri", + "columnName": "rootPostUri", + "affinity": "TEXT" + }, + { + "fieldPath": "reply.rootPostEmbeddedRecordUri", + "columnName": "rootPostEmbeddedRecordUri", + "affinity": "TEXT", + "defaultValue": "NULL" + }, + { + "fieldPath": "reply.parentPostUri", + "columnName": "parentPostUri", + "affinity": "TEXT" + }, + { + "fieldPath": "reply.parentPostEmbeddedRecordUri", + "columnName": "parentPostEmbeddedRecordUri", + "affinity": "TEXT", + "defaultValue": "NULL" + }, + { + "fieldPath": "reply.grandParentPostAuthorId", + "columnName": "grandParentPostAuthorId", + "affinity": "TEXT" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_timelineItems_postUri", + "unique": false, + "columnNames": [ + "postUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_timelineItems_postUri` ON `${TABLE_NAME}` (`postUri`)" + }, + { + "name": "index_timelineItems_indexedAt", + "unique": false, + "columnNames": [ + "indexedAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_timelineItems_indexedAt` ON `${TABLE_NAME}` (`indexedAt`)" + }, + { + "name": "index_timelineItems_viewingProfileId", + "unique": false, + "columnNames": [ + "viewingProfileId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_timelineItems_viewingProfileId` ON `${TABLE_NAME}` (`viewingProfileId`)" + }, + { + "name": "index_timelineItems_sourceId", + "unique": false, + "columnNames": [ + "sourceId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_timelineItems_sourceId` ON `${TABLE_NAME}` (`sourceId`)" + }, + { + "name": "index_timelineItems_rootPostUri", + "unique": false, + "columnNames": [ + "rootPostUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_timelineItems_rootPostUri` ON `${TABLE_NAME}` (`rootPostUri`)" + }, + { + "name": "index_timelineItems_parentPostUri", + "unique": false, + "columnNames": [ + "parentPostUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_timelineItems_parentPostUri` ON `${TABLE_NAME}` (`parentPostUri`)" + }, + { + "name": "index_timelineItems_grandParentPostAuthorId", + "unique": false, + "columnNames": [ + "grandParentPostAuthorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_timelineItems_grandParentPostAuthorId` ON `${TABLE_NAME}` (`grandParentPostAuthorId`)" + }, + { + "name": "index_timelineItems_itemSort", + "unique": false, + "columnNames": [ + "itemSort" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_timelineItems_itemSort` ON `${TABLE_NAME}` (`itemSort`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "postUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "rootPostUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "parentPostUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "grandParentPostAuthorId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "timelinePreferences", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`sourceId` TEXT NOT NULL, `viewingProfileId` TEXT, `lastFetchedAt` INTEGER NOT NULL, `preferredPresentation` TEXT, `id` TEXT NOT NULL, PRIMARY KEY(`id`))", + "fields": [ + { + "fieldPath": "sourceId", + "columnName": "sourceId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "viewingProfileId", + "columnName": "viewingProfileId", + "affinity": "TEXT" + }, + { + "fieldPath": "lastFetchedAt", + "columnName": "lastFetchedAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "preferredPresentation", + "columnName": "preferredPresentation", + "affinity": "TEXT" + }, + { + "fieldPath": "id", + "columnName": "id", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_timelinePreferences_viewingProfileId", + "unique": false, + "columnNames": [ + "viewingProfileId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_timelinePreferences_viewingProfileId` ON `${TABLE_NAME}` (`viewingProfileId`)" + }, + { + "name": "index_timelinePreferences_sourceId", + "unique": false, + "columnNames": [ + "sourceId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_timelinePreferences_sourceId` ON `${TABLE_NAME}` (`sourceId`)" + } + ] + }, + { + "tableName": "starterPacks", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cid` TEXT NOT NULL, `uri` TEXT NOT NULL, `creatorId` TEXT NOT NULL, `listUri` TEXT, `name` TEXT NOT NULL, `description` TEXT, `joinedWeekCount` INTEGER, `joinedAllTimeCount` INTEGER, `indexedAt` INTEGER NOT NULL, `createdAt` INTEGER NOT NULL, PRIMARY KEY(`uri`), FOREIGN KEY(`creatorId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "creatorId", + "columnName": "creatorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "listUri", + "columnName": "listUri", + "affinity": "TEXT" + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "description", + "columnName": "description", + "affinity": "TEXT" + }, + { + "fieldPath": "joinedWeekCount", + "columnName": "joinedWeekCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "joinedAllTimeCount", + "columnName": "joinedAllTimeCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "indexedAt", + "columnName": "indexedAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + }, + "indices": [ + { + "name": "index_starterPacks_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_starterPacks_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_starterPacks_cid", + "unique": false, + "columnNames": [ + "cid" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_starterPacks_cid` ON `${TABLE_NAME}` (`cid`)" + }, + { + "name": "index_starterPacks_creatorId", + "unique": false, + "columnNames": [ + "creatorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_starterPacks_creatorId` ON `${TABLE_NAME}` (`creatorId`)" + }, + { + "name": "index_starterPacks_indexedAt", + "unique": false, + "columnNames": [ + "indexedAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_starterPacks_indexedAt` ON `${TABLE_NAME}` (`indexedAt`)" + }, + { + "name": "index_starterPacks_createdAt", + "unique": false, + "columnNames": [ + "createdAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_starterPacks_createdAt` ON `${TABLE_NAME}` (`createdAt`)" + } + ], + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "creatorId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "conversations", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `rev` TEXT NOT NULL, `ownerId` TEXT NOT NULL, `lastMessageId` TEXT, `lastReactedToMessageId` TEXT, `muted` INTEGER NOT NULL, `status` TEXT, `unreadCount` INTEGER NOT NULL, `kind` TEXT, `name` TEXT, `memberCount` INTEGER, `lockStatus` TEXT, PRIMARY KEY(`id`, `ownerId`), FOREIGN KEY(`ownerId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "rev", + "columnName": "rev", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "ownerId", + "columnName": "ownerId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "lastMessageId", + "columnName": "lastMessageId", + "affinity": "TEXT" + }, + { + "fieldPath": "lastReactedToMessageId", + "columnName": "lastReactedToMessageId", + "affinity": "TEXT" + }, + { + "fieldPath": "muted", + "columnName": "muted", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "status", + "columnName": "status", + "affinity": "TEXT" + }, + { + "fieldPath": "unreadCount", + "columnName": "unreadCount", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "kind", + "columnName": "kind", + "affinity": "TEXT" + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT" + }, + { + "fieldPath": "memberCount", + "columnName": "memberCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "lockStatus", + "columnName": "lockStatus", + "affinity": "TEXT" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id", + "ownerId" + ] + }, + "indices": [ + { + "name": "index_conversations_id", + "unique": false, + "columnNames": [ + "id" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_conversations_id` ON `${TABLE_NAME}` (`id`)" + }, + { + "name": "index_conversations_ownerId", + "unique": false, + "columnNames": [ + "ownerId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_conversations_ownerId` ON `${TABLE_NAME}` (`ownerId`)" + } + ], + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "ownerId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "conversationMembers", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`conversationId` TEXT NOT NULL, `conversationOwnerId` TEXT NOT NULL, `memberId` TEXT NOT NULL, PRIMARY KEY(`conversationId`, `memberId`), FOREIGN KEY(`conversationId`, `conversationOwnerId`) REFERENCES `conversations`(`id`, `ownerId`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`memberId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "conversationId", + "columnName": "conversationId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "conversationOwnerId", + "columnName": "conversationOwnerId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "memberId", + "columnName": "memberId", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "conversationId", + "memberId" + ] + }, + "foreignKeys": [ + { + "table": "conversations", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "conversationId", + "conversationOwnerId" + ], + "referencedColumns": [ + "id", + "ownerId" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "memberId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "messages", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `rev` TEXT NOT NULL, `text` TEXT NOT NULL, `senderId` TEXT, `conversationId` TEXT NOT NULL, `conversationOwnerId` TEXT NOT NULL, `isDeleted` INTEGER NOT NULL, `sentAt` INTEGER NOT NULL, `base64EncodedMetadata` TEXT DEFAULT NULL, `base64EncodedSystemContent` TEXT DEFAULT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`conversationId`, `conversationOwnerId`) REFERENCES `conversations`(`id`, `ownerId`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`senderId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "rev", + "columnName": "rev", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "text", + "columnName": "text", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "senderId", + "columnName": "senderId", + "affinity": "TEXT" + }, + { + "fieldPath": "conversationId", + "columnName": "conversationId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "conversationOwnerId", + "columnName": "conversationOwnerId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "isDeleted", + "columnName": "isDeleted", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "sentAt", + "columnName": "sentAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "base64EncodedMetadata", + "columnName": "base64EncodedMetadata", + "affinity": "TEXT", + "defaultValue": "NULL" + }, + { + "fieldPath": "base64EncodedSystemContent", + "columnName": "base64EncodedSystemContent", + "affinity": "TEXT", + "defaultValue": "NULL" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_messages_sentAt", + "unique": false, + "columnNames": [ + "sentAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_messages_sentAt` ON `${TABLE_NAME}` (`sentAt`)" + } + ], + "foreignKeys": [ + { + "table": "conversations", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "conversationId", + "conversationOwnerId" + ], + "referencedColumns": [ + "id", + "ownerId" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "senderId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "messageFeedGenerators", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`messageId` TEXT NOT NULL, `feedGeneratorUri` TEXT NOT NULL, PRIMARY KEY(`messageId`, `feedGeneratorUri`), FOREIGN KEY(`messageId`) REFERENCES `messages`(`id`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`feedGeneratorUri`) REFERENCES `feedGenerators`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "messageId", + "columnName": "messageId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "feedGeneratorUri", + "columnName": "feedGeneratorUri", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "messageId", + "feedGeneratorUri" + ] + }, + "indices": [ + { + "name": "index_messageFeedGenerators_messageId", + "unique": false, + "columnNames": [ + "messageId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_messageFeedGenerators_messageId` ON `${TABLE_NAME}` (`messageId`)" + }, + { + "name": "index_messageFeedGenerators_feedGeneratorUri", + "unique": false, + "columnNames": [ + "feedGeneratorUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_messageFeedGenerators_feedGeneratorUri` ON `${TABLE_NAME}` (`feedGeneratorUri`)" + } + ], + "foreignKeys": [ + { + "table": "messages", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "messageId" + ], + "referencedColumns": [ + "id" + ] + }, + { + "table": "feedGenerators", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "feedGeneratorUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "messageLists", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`messageId` TEXT NOT NULL, `listUri` TEXT NOT NULL, PRIMARY KEY(`messageId`, `listUri`), FOREIGN KEY(`messageId`) REFERENCES `messages`(`id`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`listUri`) REFERENCES `lists`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "messageId", + "columnName": "messageId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "listUri", + "columnName": "listUri", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "messageId", + "listUri" + ] + }, + "indices": [ + { + "name": "index_messageLists_messageId", + "unique": false, + "columnNames": [ + "messageId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_messageLists_messageId` ON `${TABLE_NAME}` (`messageId`)" + }, + { + "name": "index_messageLists_listUri", + "unique": false, + "columnNames": [ + "listUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_messageLists_listUri` ON `${TABLE_NAME}` (`listUri`)" + } + ], + "foreignKeys": [ + { + "table": "messages", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "messageId" + ], + "referencedColumns": [ + "id" + ] + }, + { + "table": "lists", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "listUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "messagePosts", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`messageId` TEXT NOT NULL, `postUri` TEXT NOT NULL, PRIMARY KEY(`messageId`, `postUri`), FOREIGN KEY(`messageId`) REFERENCES `messages`(`id`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`postUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "messageId", + "columnName": "messageId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "postUri", + "columnName": "postUri", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "messageId", + "postUri" + ] + }, + "indices": [ + { + "name": "index_messagePosts_messageId", + "unique": false, + "columnNames": [ + "messageId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_messagePosts_messageId` ON `${TABLE_NAME}` (`messageId`)" + }, + { + "name": "index_messagePosts_postUri", + "unique": false, + "columnNames": [ + "postUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_messagePosts_postUri` ON `${TABLE_NAME}` (`postUri`)" + } + ], + "foreignKeys": [ + { + "table": "messages", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "messageId" + ], + "referencedColumns": [ + "id" + ] + }, + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "postUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "messageReactions", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`value` TEXT NOT NULL, `messageId` TEXT NOT NULL, `senderId` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, PRIMARY KEY(`value`, `messageId`, `senderId`), FOREIGN KEY(`messageId`) REFERENCES `messages`(`id`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`senderId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "value", + "columnName": "value", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "messageId", + "columnName": "messageId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "senderId", + "columnName": "senderId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "value", + "messageId", + "senderId" + ] + }, + "indices": [ + { + "name": "index_messageReactions_createdAt", + "unique": false, + "columnNames": [ + "createdAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_messageReactions_createdAt` ON `${TABLE_NAME}` (`createdAt`)" + } + ], + "foreignKeys": [ + { + "table": "messages", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "messageId" + ], + "referencedColumns": [ + "id" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "senderId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "messageStarterPacks", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`messageId` TEXT NOT NULL, `starterPackUri` TEXT NOT NULL, PRIMARY KEY(`messageId`, `starterPackUri`), FOREIGN KEY(`messageId`) REFERENCES `messages`(`id`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`starterPackUri`) REFERENCES `starterPacks`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "messageId", + "columnName": "messageId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "starterPackUri", + "columnName": "starterPackUri", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "messageId", + "starterPackUri" + ] + }, + "indices": [ + { + "name": "index_messageStarterPacks_messageId", + "unique": false, + "columnNames": [ + "messageId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_messageStarterPacks_messageId` ON `${TABLE_NAME}` (`messageId`)" + }, + { + "name": "index_messageStarterPacks_starterPackUri", + "unique": false, + "columnNames": [ + "starterPackUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_messageStarterPacks_starterPackUri` ON `${TABLE_NAME}` (`starterPackUri`)" + } + ], + "foreignKeys": [ + { + "table": "messages", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "messageId" + ], + "referencedColumns": [ + "id" + ] + }, + { + "table": "starterPacks", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "starterPackUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "threadGates", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cid` TEXT NOT NULL, `uri` TEXT NOT NULL, `gatedPostUri` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `allowsFollowing` INTEGER, `allowsFollowers` INTEGER, `allowsMentioned` INTEGER, PRIMARY KEY(`uri`), FOREIGN KEY(`gatedPostUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "gatedPostUri", + "columnName": "gatedPostUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "allowed.allowsFollowing", + "columnName": "allowsFollowing", + "affinity": "INTEGER" + }, + { + "fieldPath": "allowed.allowsFollowers", + "columnName": "allowsFollowers", + "affinity": "INTEGER" + }, + { + "fieldPath": "allowed.allowsMentioned", + "columnName": "allowsMentioned", + "affinity": "INTEGER" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + }, + "indices": [ + { + "name": "index_threadGates_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_threadGates_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_threadGates_cid", + "unique": false, + "columnNames": [ + "cid" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_threadGates_cid` ON `${TABLE_NAME}` (`cid`)" + }, + { + "name": "index_threadGates_gatedPostUri", + "unique": false, + "columnNames": [ + "gatedPostUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_threadGates_gatedPostUri` ON `${TABLE_NAME}` (`gatedPostUri`)" + } + ], + "foreignKeys": [ + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "gatedPostUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "threadGateAllowedLists", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`threadGateUri` TEXT NOT NULL, `allowedListUri` TEXT NOT NULL, PRIMARY KEY(`threadGateUri`, `allowedListUri`), FOREIGN KEY(`threadGateUri`) REFERENCES `threadGates`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`allowedListUri`) REFERENCES `lists`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "threadGateUri", + "columnName": "threadGateUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "allowedListUri", + "columnName": "allowedListUri", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "threadGateUri", + "allowedListUri" + ] + }, + "indices": [ + { + "name": "index_threadGateAllowedLists_threadGateUri", + "unique": false, + "columnNames": [ + "threadGateUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_threadGateAllowedLists_threadGateUri` ON `${TABLE_NAME}` (`threadGateUri`)" + }, + { + "name": "index_threadGateAllowedLists_allowedListUri", + "unique": false, + "columnNames": [ + "allowedListUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_threadGateAllowedLists_allowedListUri` ON `${TABLE_NAME}` (`allowedListUri`)" + } + ], + "foreignKeys": [ + { + "table": "threadGates", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "threadGateUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "lists", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "allowedListUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "threadGateHiddenPosts", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`threadGateUri` TEXT NOT NULL, `hiddenPostUri` TEXT NOT NULL, PRIMARY KEY(`threadGateUri`, `hiddenPostUri`), FOREIGN KEY(`threadGateUri`) REFERENCES `threadGates`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`hiddenPostUri`) REFERENCES `posts`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "threadGateUri", + "columnName": "threadGateUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "hiddenPostUri", + "columnName": "hiddenPostUri", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "threadGateUri", + "hiddenPostUri" + ] + }, + "indices": [ + { + "name": "index_threadGateHiddenPosts_threadGateUri", + "unique": false, + "columnNames": [ + "threadGateUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_threadGateHiddenPosts_threadGateUri` ON `${TABLE_NAME}` (`threadGateUri`)" + }, + { + "name": "index_threadGateHiddenPosts_hiddenPostUri", + "unique": false, + "columnNames": [ + "hiddenPostUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_threadGateHiddenPosts_hiddenPostUri` ON `${TABLE_NAME}` (`hiddenPostUri`)" + } + ], + "foreignKeys": [ + { + "table": "threadGates", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "threadGateUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "posts", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "hiddenPostUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "standardPublications", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uri` TEXT NOT NULL, `cid` TEXT, `publisherId` TEXT NOT NULL, `name` TEXT NOT NULL, `description` TEXT, `url` TEXT NOT NULL, `icon` TEXT, `sortedAt` INTEGER NOT NULL DEFAULT 0, `preferences_showInDiscover` INTEGER, `theme_accent_r` INTEGER, `theme_accent_g` INTEGER, `theme_accent_b` INTEGER, `theme_accent_a` INTEGER, `theme_accentFg_r` INTEGER, `theme_accentFg_g` INTEGER, `theme_accentFg_b` INTEGER, `theme_accentFg_a` INTEGER, `theme_bg_r` INTEGER, `theme_bg_g` INTEGER, `theme_bg_b` INTEGER, `theme_bg_a` INTEGER, `theme_fg_r` INTEGER, `theme_fg_g` INTEGER, `theme_fg_b` INTEGER, `theme_fg_a` INTEGER, PRIMARY KEY(`uri`), FOREIGN KEY(`publisherId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT" + }, + { + "fieldPath": "publisherId", + "columnName": "publisherId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "description", + "columnName": "description", + "affinity": "TEXT" + }, + { + "fieldPath": "url", + "columnName": "url", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "icon", + "columnName": "icon", + "affinity": "TEXT" + }, + { + "fieldPath": "sortedAt", + "columnName": "sortedAt", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "preferences.showInDiscover", + "columnName": "preferences_showInDiscover", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.accent.r", + "columnName": "theme_accent_r", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.accent.g", + "columnName": "theme_accent_g", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.accent.b", + "columnName": "theme_accent_b", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.accent.a", + "columnName": "theme_accent_a", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.accentForeground.r", + "columnName": "theme_accentFg_r", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.accentForeground.g", + "columnName": "theme_accentFg_g", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.accentForeground.b", + "columnName": "theme_accentFg_b", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.accentForeground.a", + "columnName": "theme_accentFg_a", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.background.r", + "columnName": "theme_bg_r", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.background.g", + "columnName": "theme_bg_g", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.background.b", + "columnName": "theme_bg_b", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.background.a", + "columnName": "theme_bg_a", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.foreground.r", + "columnName": "theme_fg_r", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.foreground.g", + "columnName": "theme_fg_g", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.foreground.b", + "columnName": "theme_fg_b", + "affinity": "INTEGER" + }, + { + "fieldPath": "basicTheme.foreground.a", + "columnName": "theme_fg_a", + "affinity": "INTEGER" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + }, + "indices": [ + { + "name": "index_standardPublications_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_standardPublications_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_standardPublications_publisherId", + "unique": false, + "columnNames": [ + "publisherId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_standardPublications_publisherId` ON `${TABLE_NAME}` (`publisherId`)" + }, + { + "name": "index_standardPublications_sortedAt", + "unique": false, + "columnNames": [ + "sortedAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_standardPublications_sortedAt` ON `${TABLE_NAME}` (`sortedAt`)" + } + ], + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "publisherId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "standardDocuments", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uri` TEXT NOT NULL, `cid` TEXT, `authorId` TEXT NOT NULL, `title` TEXT NOT NULL, `description` TEXT, `textContent` TEXT, `path` TEXT, `site` TEXT NOT NULL, `publishedAt` INTEGER NOT NULL, `updatedAt` INTEGER, `coverImage` TEXT, `bskyPostRefUri` TEXT, `bskyPostRefCid` TEXT, `tags` TEXT, `publicationUri` TEXT, `markdownContent` TEXT, PRIMARY KEY(`uri`), FOREIGN KEY(`publicationUri`) REFERENCES `standardPublications`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`authorId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT" + }, + { + "fieldPath": "authorId", + "columnName": "authorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "title", + "columnName": "title", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "description", + "columnName": "description", + "affinity": "TEXT" + }, + { + "fieldPath": "textContent", + "columnName": "textContent", + "affinity": "TEXT" + }, + { + "fieldPath": "path", + "columnName": "path", + "affinity": "TEXT" + }, + { + "fieldPath": "site", + "columnName": "site", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "publishedAt", + "columnName": "publishedAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "updatedAt", + "columnName": "updatedAt", + "affinity": "INTEGER" + }, + { + "fieldPath": "coverImage", + "columnName": "coverImage", + "affinity": "TEXT" + }, + { + "fieldPath": "bskyPostRefUri", + "columnName": "bskyPostRefUri", + "affinity": "TEXT" + }, + { + "fieldPath": "bskyPostRefCid", + "columnName": "bskyPostRefCid", + "affinity": "TEXT" + }, + { + "fieldPath": "tags", + "columnName": "tags", + "affinity": "TEXT" + }, + { + "fieldPath": "publicationUri", + "columnName": "publicationUri", + "affinity": "TEXT" + }, + { + "fieldPath": "markdownContent", + "columnName": "markdownContent", + "affinity": "TEXT" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + }, + "indices": [ + { + "name": "index_standardDocuments_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_standardDocuments_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_standardDocuments_publicationUri", + "unique": false, + "columnNames": [ + "publicationUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_standardDocuments_publicationUri` ON `${TABLE_NAME}` (`publicationUri`)" + }, + { + "name": "index_standardDocuments_authorId", + "unique": false, + "columnNames": [ + "authorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_standardDocuments_authorId` ON `${TABLE_NAME}` (`authorId`)" + }, + { + "name": "index_standardDocuments_publishedAt", + "unique": false, + "columnNames": [ + "publishedAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_standardDocuments_publishedAt` ON `${TABLE_NAME}` (`publishedAt`)" + } + ], + "foreignKeys": [ + { + "table": "standardPublications", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "publicationUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "authorId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "standardSubscriptions", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uri` TEXT NOT NULL, `cid` TEXT, `publicationUri` TEXT NOT NULL, `viewingProfileId` TEXT NOT NULL, `sortedAt` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`publicationUri`, `viewingProfileId`), FOREIGN KEY(`publicationUri`) REFERENCES `standardPublications`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`viewingProfileId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT" + }, + { + "fieldPath": "publicationUri", + "columnName": "publicationUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "viewingProfileId", + "columnName": "viewingProfileId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "sortedAt", + "columnName": "sortedAt", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "publicationUri", + "viewingProfileId" + ] + }, + "indices": [ + { + "name": "index_standardSubscriptions_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_standardSubscriptions_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_standardSubscriptions_publicationUri", + "unique": false, + "columnNames": [ + "publicationUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_standardSubscriptions_publicationUri` ON `${TABLE_NAME}` (`publicationUri`)" + }, + { + "name": "index_standardSubscriptions_viewingProfileId", + "unique": false, + "columnNames": [ + "viewingProfileId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_standardSubscriptions_viewingProfileId` ON `${TABLE_NAME}` (`viewingProfileId`)" + }, + { + "name": "index_standardSubscriptions_sortedAt", + "unique": false, + "columnNames": [ + "sortedAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_standardSubscriptions_sortedAt` ON `${TABLE_NAME}` (`sortedAt`)" + } + ], + "foreignKeys": [ + { + "table": "standardPublications", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "publicationUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "viewingProfileId" + ], + "referencedColumns": [ + "did" + ] + } + ] + }, + { + "tableName": "rockskyTracks", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uri` TEXT NOT NULL, `cid` TEXT NOT NULL, `creatorId` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `albumArtist` TEXT, `album` TEXT, `albumArt` TEXT, `trackNumber` INTEGER, `discNumber` INTEGER, `duration` INTEGER, `albumUri` TEXT, `artistUri` TEXT, `createdAt` INTEGER, `playCount` INTEGER, `uniqueListeners` INTEGER, PRIMARY KEY(`uri`), FOREIGN KEY(`albumUri`) REFERENCES `rockskyAlbums`(`uri`) ON UPDATE CASCADE ON DELETE SET NULL , FOREIGN KEY(`artistUri`) REFERENCES `rockskyArtists`(`uri`) ON UPDATE CASCADE ON DELETE SET NULL )", + "fields": [ + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "creatorId", + "columnName": "creatorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "title", + "columnName": "title", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "artist", + "columnName": "artist", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "albumArtist", + "columnName": "albumArtist", + "affinity": "TEXT" + }, + { + "fieldPath": "album", + "columnName": "album", + "affinity": "TEXT" + }, + { + "fieldPath": "albumArt", + "columnName": "albumArt", + "affinity": "TEXT" + }, + { + "fieldPath": "trackNumber", + "columnName": "trackNumber", + "affinity": "INTEGER" + }, + { + "fieldPath": "discNumber", + "columnName": "discNumber", + "affinity": "INTEGER" + }, + { + "fieldPath": "duration", + "columnName": "duration", + "affinity": "INTEGER" + }, + { + "fieldPath": "albumUri", + "columnName": "albumUri", + "affinity": "TEXT" + }, + { + "fieldPath": "artistUri", + "columnName": "artistUri", + "affinity": "TEXT" + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER" + }, + { + "fieldPath": "playCount", + "columnName": "playCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "uniqueListeners", + "columnName": "uniqueListeners", + "affinity": "INTEGER" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + }, + "indices": [ + { + "name": "index_rockskyTracks_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyTracks_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_rockskyTracks_creatorId", + "unique": false, + "columnNames": [ + "creatorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyTracks_creatorId` ON `${TABLE_NAME}` (`creatorId`)" + }, + { + "name": "index_rockskyTracks_albumUri", + "unique": false, + "columnNames": [ + "albumUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyTracks_albumUri` ON `${TABLE_NAME}` (`albumUri`)" + }, + { + "name": "index_rockskyTracks_artistUri", + "unique": false, + "columnNames": [ + "artistUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyTracks_artistUri` ON `${TABLE_NAME}` (`artistUri`)" + }, + { + "name": "index_rockskyTracks_createdAt", + "unique": false, + "columnNames": [ + "createdAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyTracks_createdAt` ON `${TABLE_NAME}` (`createdAt`)" + } + ], + "foreignKeys": [ + { + "table": "rockskyAlbums", + "onDelete": "SET NULL", + "onUpdate": "CASCADE", + "columns": [ + "albumUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "rockskyArtists", + "onDelete": "SET NULL", + "onUpdate": "CASCADE", + "columns": [ + "artistUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "rockskyScrobbles", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uri` TEXT NOT NULL, `cid` TEXT NOT NULL, `creatorId` TEXT NOT NULL, `trackId` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `albumArtist` TEXT, `album` TEXT, `albumArt` TEXT, `handle` TEXT, `did` TEXT NOT NULL, `avatar` TEXT, `trackUri` TEXT, `artistUri` TEXT, `albumUri` TEXT, `createdAt` INTEGER NOT NULL, PRIMARY KEY(`uri`), FOREIGN KEY(`did`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`trackUri`) REFERENCES `rockskyTracks`(`uri`) ON UPDATE CASCADE ON DELETE SET NULL , FOREIGN KEY(`artistUri`) REFERENCES `rockskyArtists`(`uri`) ON UPDATE CASCADE ON DELETE SET NULL , FOREIGN KEY(`albumUri`) REFERENCES `rockskyAlbums`(`uri`) ON UPDATE CASCADE ON DELETE SET NULL )", + "fields": [ + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "creatorId", + "columnName": "creatorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "trackId", + "columnName": "trackId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "title", + "columnName": "title", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "artist", + "columnName": "artist", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "albumArtist", + "columnName": "albumArtist", + "affinity": "TEXT" + }, + { + "fieldPath": "album", + "columnName": "album", + "affinity": "TEXT" + }, + { + "fieldPath": "albumArt", + "columnName": "albumArt", + "affinity": "TEXT" + }, + { + "fieldPath": "handle", + "columnName": "handle", + "affinity": "TEXT" + }, + { + "fieldPath": "did", + "columnName": "did", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "avatar", + "columnName": "avatar", + "affinity": "TEXT" + }, + { + "fieldPath": "trackUri", + "columnName": "trackUri", + "affinity": "TEXT" + }, + { + "fieldPath": "artistUri", + "columnName": "artistUri", + "affinity": "TEXT" + }, + { + "fieldPath": "albumUri", + "columnName": "albumUri", + "affinity": "TEXT" + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + }, + "indices": [ + { + "name": "index_rockskyScrobbles_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyScrobbles_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_rockskyScrobbles_did", + "unique": false, + "columnNames": [ + "did" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyScrobbles_did` ON `${TABLE_NAME}` (`did`)" + }, + { + "name": "index_rockskyScrobbles_creatorId", + "unique": false, + "columnNames": [ + "creatorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyScrobbles_creatorId` ON `${TABLE_NAME}` (`creatorId`)" + }, + { + "name": "index_rockskyScrobbles_trackUri", + "unique": false, + "columnNames": [ + "trackUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyScrobbles_trackUri` ON `${TABLE_NAME}` (`trackUri`)" + }, + { + "name": "index_rockskyScrobbles_artistUri", + "unique": false, + "columnNames": [ + "artistUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyScrobbles_artistUri` ON `${TABLE_NAME}` (`artistUri`)" + }, + { + "name": "index_rockskyScrobbles_albumUri", + "unique": false, + "columnNames": [ + "albumUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyScrobbles_albumUri` ON `${TABLE_NAME}` (`albumUri`)" + }, + { + "name": "index_rockskyScrobbles_createdAt", + "unique": false, + "columnNames": [ + "createdAt" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyScrobbles_createdAt` ON `${TABLE_NAME}` (`createdAt`)" + } + ], + "foreignKeys": [ + { + "table": "profiles", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "did" + ], + "referencedColumns": [ + "did" + ] + }, + { + "table": "rockskyTracks", + "onDelete": "SET NULL", + "onUpdate": "CASCADE", + "columns": [ + "trackUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "rockskyArtists", + "onDelete": "SET NULL", + "onUpdate": "CASCADE", + "columns": [ + "artistUri" + ], + "referencedColumns": [ + "uri" + ] + }, + { + "table": "rockskyAlbums", + "onDelete": "SET NULL", + "onUpdate": "CASCADE", + "columns": [ + "albumUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "rockskyAlbums", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uri` TEXT NOT NULL, `cid` TEXT NOT NULL, `creatorId` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `releaseDate` TEXT, `year` INTEGER, `albumArt` TEXT, `artistUri` TEXT NOT NULL, `playCount` INTEGER, `uniqueListeners` INTEGER, `appleMusicLink` TEXT, `spotifyLink` TEXT, `tidalLink` TEXT, `youtubeLink` TEXT, PRIMARY KEY(`uri`), FOREIGN KEY(`artistUri`) REFERENCES `rockskyArtists`(`uri`) ON UPDATE CASCADE ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "creatorId", + "columnName": "creatorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "title", + "columnName": "title", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "artist", + "columnName": "artist", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "releaseDate", + "columnName": "releaseDate", + "affinity": "TEXT" + }, + { + "fieldPath": "year", + "columnName": "year", + "affinity": "INTEGER" + }, + { + "fieldPath": "albumArt", + "columnName": "albumArt", + "affinity": "TEXT" + }, + { + "fieldPath": "artistUri", + "columnName": "artistUri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "playCount", + "columnName": "playCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "uniqueListeners", + "columnName": "uniqueListeners", + "affinity": "INTEGER" + }, + { + "fieldPath": "appleMusicLink", + "columnName": "appleMusicLink", + "affinity": "TEXT" + }, + { + "fieldPath": "spotifyLink", + "columnName": "spotifyLink", + "affinity": "TEXT" + }, + { + "fieldPath": "tidalLink", + "columnName": "tidalLink", + "affinity": "TEXT" + }, + { + "fieldPath": "youtubeLink", + "columnName": "youtubeLink", + "affinity": "TEXT" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + }, + "indices": [ + { + "name": "index_rockskyAlbums_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyAlbums_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_rockskyAlbums_artistUri", + "unique": false, + "columnNames": [ + "artistUri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyAlbums_artistUri` ON `${TABLE_NAME}` (`artistUri`)" + }, + { + "name": "index_rockskyAlbums_creatorId", + "unique": false, + "columnNames": [ + "creatorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyAlbums_creatorId` ON `${TABLE_NAME}` (`creatorId`)" + } + ], + "foreignKeys": [ + { + "table": "rockskyArtists", + "onDelete": "CASCADE", + "onUpdate": "CASCADE", + "columns": [ + "artistUri" + ], + "referencedColumns": [ + "uri" + ] + } + ] + }, + { + "tableName": "rockskyArtists", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uri` TEXT NOT NULL, `cid` TEXT NOT NULL, `creatorId` TEXT NOT NULL, `name` TEXT NOT NULL, `picture` TEXT, `playCount` INTEGER, `uniqueListeners` INTEGER, `tags` TEXT, PRIMARY KEY(`uri`))", + "fields": [ + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "creatorId", + "columnName": "creatorId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "picture", + "columnName": "picture", + "affinity": "TEXT" + }, + { + "fieldPath": "playCount", + "columnName": "playCount", + "affinity": "INTEGER" + }, + { + "fieldPath": "uniqueListeners", + "columnName": "uniqueListeners", + "affinity": "INTEGER" + }, + { + "fieldPath": "tags", + "columnName": "tags", + "affinity": "TEXT" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uri" + ] + }, + "indices": [ + { + "name": "index_rockskyArtists_uri", + "unique": false, + "columnNames": [ + "uri" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyArtists_uri` ON `${TABLE_NAME}` (`uri`)" + }, + { + "name": "index_rockskyArtists_creatorId", + "unique": false, + "columnNames": [ + "creatorId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rockskyArtists_creatorId` ON `${TABLE_NAME}` (`creatorId`)" + } + ] + } + ], + "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, '355bd7568f1e54fe574a4d3b9e59b7fb')" + ] + } +} \ No newline at end of file diff --git a/data/database/src/commonMain/kotlin/com/tunjid/heron/data/database/AppDatabase.kt b/data/database/src/commonMain/kotlin/com/tunjid/heron/data/database/AppDatabase.kt index 4485b659e..48c3fe72b 100644 --- a/data/database/src/commonMain/kotlin/com/tunjid/heron/data/database/AppDatabase.kt +++ b/data/database/src/commonMain/kotlin/com/tunjid/heron/data/database/AppDatabase.kt @@ -111,7 +111,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.IO @Database( - version = 48, + version = 49, entities = [ BookmarkEntity::class, PostDraftEntity::class, @@ -259,6 +259,8 @@ import kotlinx.coroutines.IO AutoMigration(from = 46, to = 47), // Add PostDraftEntity for cached post drafts AutoMigration(from = 47, to = 48), + // Add mutedOnlyReposts and mutedOnlyQuoteposts to ProfileViewerStateEntity + AutoMigration(from = 48, to = 49), ], exportSchema = true, ) diff --git a/data/database/src/commonMain/kotlin/com/tunjid/heron/data/database/entities/profile/ProfileViewerStateEntity.kt b/data/database/src/commonMain/kotlin/com/tunjid/heron/data/database/entities/profile/ProfileViewerStateEntity.kt index e0ebd7caf..37446e450 100644 --- a/data/database/src/commonMain/kotlin/com/tunjid/heron/data/database/entities/profile/ProfileViewerStateEntity.kt +++ b/data/database/src/commonMain/kotlin/com/tunjid/heron/data/database/entities/profile/ProfileViewerStateEntity.kt @@ -59,6 +59,9 @@ data class ProfileViewerStateEntity( val following: FollowUri?, val followedBy: FollowUri?, val commonFollowersCount: Long?, + // Newly added fields should have defaults for serialization + val mutedOnlyReposts: Boolean? = null, + val mutedOnlyQuotePosts: Boolean? = null, ) { data class Partial( val profileId: ProfileId, @@ -71,6 +74,8 @@ data class ProfileViewerStateEntity( val profileId: ProfileId, val otherProfileId: ProfileId, val muted: Boolean, + val mutedOnlyReposts: Boolean, + val mutedOnlyQuotePosts: Boolean, ) data class BlockPartial( @@ -98,4 +103,6 @@ fun ProfileViewerStateEntity.asExternalModel() = following = following, followedBy = followedBy, commonFollowersCount = commonFollowersCount, + mutedOnlyReposts = mutedOnlyReposts, + mutedOnlyQuotePosts = this@asExternalModel.mutedOnlyQuotePosts, ) diff --git a/data/models/src/commonMain/kotlin/com/tunjid/heron/data/core/models/Profile.kt b/data/models/src/commonMain/kotlin/com/tunjid/heron/data/core/models/Profile.kt index 0d8033277..ae9e77c46 100644 --- a/data/models/src/commonMain/kotlin/com/tunjid/heron/data/core/models/Profile.kt +++ b/data/models/src/commonMain/kotlin/com/tunjid/heron/data/core/models/Profile.kt @@ -98,6 +98,10 @@ data class Profile( data class Add( override val signedInProfileId: ProfileId, override val profileId: ProfileId, + // Scope the mute to a specific kind of content instead of the whole + // account. Newly added fields should have defaults for serialization. + val onlyReposts: Boolean = false, + val onlyQuoteposts: Boolean = false, ) : Mute() @Serializable diff --git a/data/models/src/commonMain/kotlin/com/tunjid/heron/data/core/models/ProfileViewerState.kt b/data/models/src/commonMain/kotlin/com/tunjid/heron/data/core/models/ProfileViewerState.kt index 505ff447e..a0607b814 100644 --- a/data/models/src/commonMain/kotlin/com/tunjid/heron/data/core/models/ProfileViewerState.kt +++ b/data/models/src/commonMain/kotlin/com/tunjid/heron/data/core/models/ProfileViewerState.kt @@ -31,6 +31,9 @@ data class ProfileViewerState( val following: FollowUri?, val followedBy: FollowUri?, val commonFollowersCount: Long?, + // Newly added fields should have defaults for serialization + val mutedOnlyReposts: Boolean? = null, + val mutedOnlyQuotePosts: Boolean? = null, ) val ProfileViewerState?.isFollowing: Boolean get() = this?.following != null @@ -38,6 +41,8 @@ val ProfileViewerState?.followsYou: Boolean get() = this?.followedBy != null val ProfileViewerState?.isBlockedBy: Boolean get() = this?.blockedBy == true val ProfileViewerState?.isBlocked: Boolean get() = this?.blocking != null val ProfileViewerState?.isMuted: Boolean get() = this?.muted == true +val ProfileViewerState?.isMutingReposts: Boolean get() = this?.mutedOnlyReposts == true +val ProfileViewerState?.isMutingQuoteposts: Boolean get() = this?.mutedOnlyQuotePosts == true val ProfileViewerState?.isRestricted get() = isMuted || isBlocked || this?.blockingByList != null diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 58877d022..d62def610 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -48,7 +48,7 @@ navigationEventCompose = "1.1.0" navigation3Multiplatform = "1.1.1" okio = "3.17.0" ozone-atproto = "0.3.9" -ozone-bluesky-lexicons = "2026.08.04" +ozone-bluesky-lexicons = "2026.08.08" savedstate-multiplatform = "1.4.0" spotless = "8.4.0" tunjid-state-holder = "2.0.0" -- knotmirror 0.0.1 From f9ee63f914c21e15083cae0c0dc7ee591e7423fe Mon Sep 17 00:00:00 2001 From: Adetunji Dahunsi Date: Mon, 10 Aug 2026 21:03:02 -0400 Subject: [PATCH 2/2] Update 49.json --- .../com.tunjid.heron.data.database.AppDatabase/49.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data/database/schemas/com.tunjid.heron.data.database.AppDatabase/49.json b/data/database/schemas/com.tunjid.heron.data.database.AppDatabase/49.json index 1d60c9dad..4f65d87a0 100644 --- a/data/database/schemas/com.tunjid.heron.data.database.AppDatabase/49.json +++ b/data/database/schemas/com.tunjid.heron.data.database.AppDatabase/49.json @@ -2,7 +2,7 @@ "formatVersion": 1, "database": { "version": 49, - "identityHash": "355bd7568f1e54fe574a4d3b9e59b7fb", + "identityHash": "29c653210d19e52f0fce99deb46d3dec", "entities": [ { "tableName": "bookmarks", @@ -1247,7 +1247,7 @@ }, { "tableName": "profileViewerStates", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`profileId` TEXT NOT NULL, `otherProfileId` TEXT NOT NULL, `muted` INTEGER, `mutedByList` TEXT, `blockedBy` INTEGER, `blocking` TEXT, `blockingByList` TEXT, `following` TEXT, `followedBy` TEXT, `commonFollowersCount` INTEGER, `mutedOnlyReposts` INTEGER, `mutedOnlyQuoteposts` INTEGER, PRIMARY KEY(`profileId`, `otherProfileId`), FOREIGN KEY(`profileId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`otherProfileId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`profileId` TEXT NOT NULL, `otherProfileId` TEXT NOT NULL, `muted` INTEGER, `mutedByList` TEXT, `blockedBy` INTEGER, `blocking` TEXT, `blockingByList` TEXT, `following` TEXT, `followedBy` TEXT, `commonFollowersCount` INTEGER, `mutedOnlyReposts` INTEGER, `mutedOnlyQuotePosts` INTEGER, PRIMARY KEY(`profileId`, `otherProfileId`), FOREIGN KEY(`profileId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`otherProfileId`) REFERENCES `profiles`(`did`) ON UPDATE CASCADE ON DELETE CASCADE )", "fields": [ { "fieldPath": "profileId", @@ -1307,8 +1307,8 @@ "affinity": "INTEGER" }, { - "fieldPath": "mutedOnlyQuoteposts", - "columnName": "mutedOnlyQuoteposts", + "fieldPath": "mutedOnlyQuotePosts", + "columnName": "mutedOnlyQuotePosts", "affinity": "INTEGER" } ], @@ -4763,7 +4763,7 @@ ], "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, '355bd7568f1e54fe574a4d3b9e59b7fb')" + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '29c653210d19e52f0fce99deb46d3dec')" ] } } \ No newline at end of file -- knotmirror 0.0.1