From 13d04e7ebc4bd4b325250f7ffd25dbff414a546d Mon Sep 17 00:00:00 2001 From: Aleksandar Ilic Date: Mon, 13 May 2024 16:28:19 +0200 Subject: [PATCH] Revert "Fix primary key for NoteZapData table" This reverts commit 5f65714cad6fbeec3660c637d788efe8b88f040f. --- .../29.json | 1398 ----------------- .../net/primal/android/db/PrimalDatabase.kt | 2 +- .../net/primal/android/note/db/NoteZapData.kt | 10 +- 3 files changed, 8 insertions(+), 1402 deletions(-) delete mode 100644 app/schemas/net.primal.android.db.PrimalDatabase/29.json diff --git a/app/schemas/net.primal.android.db.PrimalDatabase/29.json b/app/schemas/net.primal.android.db.PrimalDatabase/29.json deleted file mode 100644 index 7289d69ea..000000000 --- a/app/schemas/net.primal.android.db.PrimalDatabase/29.json +++ /dev/null @@ -1,1398 +0,0 @@ -{ - "formatVersion": 1, - "database": { - "version": 29, - "identityHash": "9d8b6fdfda2ad116ce9b16ff027e2699", - "entities": [ - { - "tableName": "PostData", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postId` TEXT NOT NULL, `authorId` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `tags` TEXT NOT NULL, `content` TEXT NOT NULL, `uris` TEXT NOT NULL, `hashtags` TEXT NOT NULL, `sig` TEXT NOT NULL, `raw` TEXT NOT NULL, `authorMetadataId` TEXT, `replyToPostId` TEXT, `replyToAuthorId` TEXT, PRIMARY KEY(`postId`))", - "fields": [ - { - "fieldPath": "postId", - "columnName": "postId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "authorId", - "columnName": "authorId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "createdAt", - "columnName": "createdAt", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "tags", - "columnName": "tags", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "content", - "columnName": "content", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "uris", - "columnName": "uris", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "hashtags", - "columnName": "hashtags", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "sig", - "columnName": "sig", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "raw", - "columnName": "raw", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "authorMetadataId", - "columnName": "authorMetadataId", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "replyToPostId", - "columnName": "replyToPostId", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "replyToAuthorId", - "columnName": "replyToAuthorId", - "affinity": "TEXT", - "notNull": false - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "postId" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "ProfileData", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`ownerId` TEXT NOT NULL, `eventId` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `raw` TEXT NOT NULL, `handle` TEXT, `displayName` TEXT, `internetIdentifier` TEXT, `lightningAddress` TEXT, `lnUrlDecoded` TEXT, `avatarCdnImage` TEXT, `bannerCdnImage` TEXT, `website` TEXT, `about` TEXT, `aboutUris` TEXT NOT NULL, `aboutHashtags` TEXT NOT NULL, PRIMARY KEY(`ownerId`))", - "fields": [ - { - "fieldPath": "ownerId", - "columnName": "ownerId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "eventId", - "columnName": "eventId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "createdAt", - "columnName": "createdAt", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "raw", - "columnName": "raw", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "handle", - "columnName": "handle", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "displayName", - "columnName": "displayName", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "internetIdentifier", - "columnName": "internetIdentifier", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "lightningAddress", - "columnName": "lightningAddress", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "lnUrlDecoded", - "columnName": "lnUrlDecoded", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "avatarCdnImage", - "columnName": "avatarCdnImage", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "bannerCdnImage", - "columnName": "bannerCdnImage", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "website", - "columnName": "website", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "about", - "columnName": "about", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "aboutUris", - "columnName": "aboutUris", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "aboutHashtags", - "columnName": "aboutHashtags", - "affinity": "TEXT", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "ownerId" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "RepostData", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`repostId` TEXT NOT NULL, `authorId` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `tags` TEXT NOT NULL, `postId` TEXT NOT NULL, `postAuthorId` TEXT NOT NULL, `sig` TEXT NOT NULL, PRIMARY KEY(`repostId`))", - "fields": [ - { - "fieldPath": "repostId", - "columnName": "repostId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "authorId", - "columnName": "authorId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "createdAt", - "columnName": "createdAt", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "tags", - "columnName": "tags", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "postId", - "columnName": "postId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "postAuthorId", - "columnName": "postAuthorId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "sig", - "columnName": "sig", - "affinity": "TEXT", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "repostId" - ] - }, - "indices": [ - { - "name": "index_RepostData_postId", - "unique": false, - "columnNames": [ - "postId" - ], - "orders": [], - "createSql": "CREATE INDEX IF NOT EXISTS `index_RepostData_postId` ON `${TABLE_NAME}` (`postId`)" - } - ], - "foreignKeys": [] - }, - { - "tableName": "NoteStats", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postId` TEXT NOT NULL, `likes` INTEGER NOT NULL, `replies` INTEGER NOT NULL, `mentions` INTEGER NOT NULL, `reposts` INTEGER NOT NULL, `zaps` INTEGER NOT NULL, `satsZapped` INTEGER NOT NULL, `score` INTEGER NOT NULL, `score24h` INTEGER NOT NULL, PRIMARY KEY(`postId`))", - "fields": [ - { - "fieldPath": "postId", - "columnName": "postId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "likes", - "columnName": "likes", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "replies", - "columnName": "replies", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "mentions", - "columnName": "mentions", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "reposts", - "columnName": "reposts", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "zaps", - "columnName": "zaps", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "satsZapped", - "columnName": "satsZapped", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "score", - "columnName": "score", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "score24h", - "columnName": "score24h", - "affinity": "INTEGER", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "postId" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "NoteNostrUri", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postId` TEXT NOT NULL, `uri` TEXT NOT NULL, `refPost_postId` TEXT, `refPost_createdAt` INTEGER, `refPost_content` TEXT, `refPost_authorId` TEXT, `refPost_authorName` TEXT, `refPost_authorAvatarCdnImage` TEXT, `refPost_authorInternetIdentifier` TEXT, `refPost_authorLightningAddress` TEXT, `refPost_attachments` TEXT, `refPost_nostrUris` TEXT, `refUser_userId` TEXT, `refUser_handle` TEXT, PRIMARY KEY(`postId`, `uri`))", - "fields": [ - { - "fieldPath": "postId", - "columnName": "postId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "uri", - "columnName": "uri", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "referencedPost.postId", - "columnName": "refPost_postId", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "referencedPost.createdAt", - "columnName": "refPost_createdAt", - "affinity": "INTEGER", - "notNull": false - }, - { - "fieldPath": "referencedPost.content", - "columnName": "refPost_content", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "referencedPost.authorId", - "columnName": "refPost_authorId", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "referencedPost.authorName", - "columnName": "refPost_authorName", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "referencedPost.authorAvatarCdnImage", - "columnName": "refPost_authorAvatarCdnImage", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "referencedPost.authorInternetIdentifier", - "columnName": "refPost_authorInternetIdentifier", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "referencedPost.authorLightningAddress", - "columnName": "refPost_authorLightningAddress", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "referencedPost.attachments", - "columnName": "refPost_attachments", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "referencedPost.nostrUris", - "columnName": "refPost_nostrUris", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "referencedUser.userId", - "columnName": "refUser_userId", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "referencedUser.handle", - "columnName": "refUser_handle", - "affinity": "TEXT", - "notNull": false - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "postId", - "uri" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "NoteAttachment", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`eventId` TEXT NOT NULL, `url` TEXT NOT NULL, `type` TEXT NOT NULL, `mimeType` TEXT, `variants` TEXT, `title` TEXT, `description` TEXT, `thumbnail` TEXT, `authorAvatarUrl` TEXT, PRIMARY KEY(`eventId`, `url`))", - "fields": [ - { - "fieldPath": "eventId", - "columnName": "eventId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "url", - "columnName": "url", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "type", - "columnName": "type", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "mimeType", - "columnName": "mimeType", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "variants", - "columnName": "variants", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "title", - "columnName": "title", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "description", - "columnName": "description", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "thumbnail", - "columnName": "thumbnail", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "authorAvatarUrl", - "columnName": "authorAvatarUrl", - "affinity": "TEXT", - "notNull": false - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "eventId", - "url" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "NoteZapData", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `zapSenderId` TEXT NOT NULL, `zapReceiverId` TEXT NOT NULL, `noteId` TEXT NOT NULL, `zapRequestAt` INTEGER NOT NULL, `zapReceiptAt` INTEGER NOT NULL, `amountInBtc` REAL NOT NULL, `message` TEXT)", - "fields": [ - { - "fieldPath": "id", - "columnName": "id", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "zapSenderId", - "columnName": "zapSenderId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "zapReceiverId", - "columnName": "zapReceiverId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "noteId", - "columnName": "noteId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "zapRequestAt", - "columnName": "zapRequestAt", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "zapReceiptAt", - "columnName": "zapReceiptAt", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "amountInBtc", - "columnName": "amountInBtc", - "affinity": "REAL", - "notNull": true - }, - { - "fieldPath": "message", - "columnName": "message", - "affinity": "TEXT", - "notNull": false - } - ], - "primaryKey": { - "autoGenerate": true, - "columnNames": [ - "id" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "Feed", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`directive` TEXT NOT NULL, `name` TEXT NOT NULL, PRIMARY KEY(`directive`))", - "fields": [ - { - "fieldPath": "directive", - "columnName": "directive", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "name", - "columnName": "name", - "affinity": "TEXT", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "directive" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "FeedPostDataCrossRef", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`feedDirective` TEXT NOT NULL, `eventId` TEXT NOT NULL, PRIMARY KEY(`feedDirective`, `eventId`))", - "fields": [ - { - "fieldPath": "feedDirective", - "columnName": "feedDirective", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "eventId", - "columnName": "eventId", - "affinity": "TEXT", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "feedDirective", - "eventId" - ] - }, - "indices": [ - { - "name": "index_FeedPostDataCrossRef_feedDirective", - "unique": false, - "columnNames": [ - "feedDirective" - ], - "orders": [], - "createSql": "CREATE INDEX IF NOT EXISTS `index_FeedPostDataCrossRef_feedDirective` ON `${TABLE_NAME}` (`feedDirective`)" - }, - { - "name": "index_FeedPostDataCrossRef_eventId", - "unique": false, - "columnNames": [ - "eventId" - ], - "orders": [], - "createSql": "CREATE INDEX IF NOT EXISTS `index_FeedPostDataCrossRef_eventId` ON `${TABLE_NAME}` (`eventId`)" - } - ], - "foreignKeys": [] - }, - { - "tableName": "FeedPostRemoteKey", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`eventId` TEXT NOT NULL, `directive` TEXT NOT NULL, `sinceId` INTEGER NOT NULL, `untilId` INTEGER NOT NULL, `cachedAt` INTEGER NOT NULL, PRIMARY KEY(`eventId`, `directive`))", - "fields": [ - { - "fieldPath": "eventId", - "columnName": "eventId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "directive", - "columnName": "directive", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "sinceId", - "columnName": "sinceId", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "untilId", - "columnName": "untilId", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "cachedAt", - "columnName": "cachedAt", - "affinity": "INTEGER", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "eventId", - "directive" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "FeedPostSync", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`timestamp` INTEGER NOT NULL, `feedDirective` TEXT NOT NULL, `count` INTEGER NOT NULL, `postIds` TEXT NOT NULL, PRIMARY KEY(`timestamp`, `feedDirective`))", - "fields": [ - { - "fieldPath": "timestamp", - "columnName": "timestamp", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "feedDirective", - "columnName": "feedDirective", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "count", - "columnName": "count", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "postIds", - "columnName": "postIds", - "affinity": "TEXT", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "timestamp", - "feedDirective" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "ThreadConversationCrossRef", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postId` TEXT NOT NULL, `replyPostId` TEXT NOT NULL, PRIMARY KEY(`postId`, `replyPostId`))", - "fields": [ - { - "fieldPath": "postId", - "columnName": "postId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "replyPostId", - "columnName": "replyPostId", - "affinity": "TEXT", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "postId", - "replyPostId" - ] - }, - "indices": [ - { - "name": "index_ThreadConversationCrossRef_postId", - "unique": false, - "columnNames": [ - "postId" - ], - "orders": [], - "createSql": "CREATE INDEX IF NOT EXISTS `index_ThreadConversationCrossRef_postId` ON `${TABLE_NAME}` (`postId`)" - }, - { - "name": "index_ThreadConversationCrossRef_replyPostId", - "unique": false, - "columnNames": [ - "replyPostId" - ], - "orders": [], - "createSql": "CREATE INDEX IF NOT EXISTS `index_ThreadConversationCrossRef_replyPostId` ON `${TABLE_NAME}` (`replyPostId`)" - } - ], - "foreignKeys": [] - }, - { - "tableName": "NoteUserStats", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`postId` TEXT NOT NULL, `userId` TEXT NOT NULL, `replied` INTEGER NOT NULL, `liked` INTEGER NOT NULL, `reposted` INTEGER NOT NULL, `zapped` INTEGER NOT NULL, PRIMARY KEY(`postId`, `userId`))", - "fields": [ - { - "fieldPath": "postId", - "columnName": "postId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "userId", - "columnName": "userId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "replied", - "columnName": "replied", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "liked", - "columnName": "liked", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "reposted", - "columnName": "reposted", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "zapped", - "columnName": "zapped", - "affinity": "INTEGER", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "postId", - "userId" - ] - }, - "indices": [ - { - "name": "index_NoteUserStats_postId", - "unique": false, - "columnNames": [ - "postId" - ], - "orders": [], - "createSql": "CREATE INDEX IF NOT EXISTS `index_NoteUserStats_postId` ON `${TABLE_NAME}` (`postId`)" - }, - { - "name": "index_NoteUserStats_userId", - "unique": false, - "columnNames": [ - "userId" - ], - "orders": [], - "createSql": "CREATE INDEX IF NOT EXISTS `index_NoteUserStats_userId` ON `${TABLE_NAME}` (`userId`)" - } - ], - "foreignKeys": [] - }, - { - "tableName": "ProfileStats", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`profileId` TEXT NOT NULL, `following` INTEGER, `followers` INTEGER, `notesCount` INTEGER, `repliesCount` INTEGER, `relaysCount` INTEGER, `totalReceivedZaps` INTEGER, `totalReceivedSats` INTEGER, `joinedAt` INTEGER, PRIMARY KEY(`profileId`))", - "fields": [ - { - "fieldPath": "profileId", - "columnName": "profileId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "following", - "columnName": "following", - "affinity": "INTEGER", - "notNull": false - }, - { - "fieldPath": "followers", - "columnName": "followers", - "affinity": "INTEGER", - "notNull": false - }, - { - "fieldPath": "notesCount", - "columnName": "notesCount", - "affinity": "INTEGER", - "notNull": false - }, - { - "fieldPath": "repliesCount", - "columnName": "repliesCount", - "affinity": "INTEGER", - "notNull": false - }, - { - "fieldPath": "relaysCount", - "columnName": "relaysCount", - "affinity": "INTEGER", - "notNull": false - }, - { - "fieldPath": "totalReceivedZaps", - "columnName": "totalReceivedZaps", - "affinity": "INTEGER", - "notNull": false - }, - { - "fieldPath": "totalReceivedSats", - "columnName": "totalReceivedSats", - "affinity": "INTEGER", - "notNull": false - }, - { - "fieldPath": "joinedAt", - "columnName": "joinedAt", - "affinity": "INTEGER", - "notNull": false - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "profileId" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "TrendingHashtag", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`hashtag` TEXT NOT NULL, `score` REAL NOT NULL, PRIMARY KEY(`hashtag`))", - "fields": [ - { - "fieldPath": "hashtag", - "columnName": "hashtag", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "score", - "columnName": "score", - "affinity": "REAL", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "hashtag" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "NotificationData", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`ownerId` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `type` TEXT NOT NULL, `seenGloballyAt` INTEGER, `actionUserId` TEXT, `actionPostId` TEXT, `satsZapped` INTEGER, PRIMARY KEY(`ownerId`, `createdAt`, `type`))", - "fields": [ - { - "fieldPath": "ownerId", - "columnName": "ownerId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "createdAt", - "columnName": "createdAt", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "type", - "columnName": "type", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "seenGloballyAt", - "columnName": "seenGloballyAt", - "affinity": "INTEGER", - "notNull": false - }, - { - "fieldPath": "actionUserId", - "columnName": "actionUserId", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "actionPostId", - "columnName": "actionPostId", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "satsZapped", - "columnName": "satsZapped", - "affinity": "INTEGER", - "notNull": false - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "ownerId", - "createdAt", - "type" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "MutedUserData", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`userId` TEXT NOT NULL, `userMetadataEventId` TEXT, PRIMARY KEY(`userId`))", - "fields": [ - { - "fieldPath": "userId", - "columnName": "userId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "userMetadataEventId", - "columnName": "userMetadataEventId", - "affinity": "TEXT", - "notNull": false - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "userId" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "DirectMessageData", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`messageId` TEXT NOT NULL, `senderId` TEXT NOT NULL, `receiverId` TEXT NOT NULL, `participantId` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `content` TEXT NOT NULL, `uris` TEXT NOT NULL, `hashtags` TEXT NOT NULL, PRIMARY KEY(`messageId`))", - "fields": [ - { - "fieldPath": "messageId", - "columnName": "messageId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "senderId", - "columnName": "senderId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "receiverId", - "columnName": "receiverId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "participantId", - "columnName": "participantId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "createdAt", - "columnName": "createdAt", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "content", - "columnName": "content", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "uris", - "columnName": "uris", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "hashtags", - "columnName": "hashtags", - "affinity": "TEXT", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "messageId" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "MessageConversationData", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`participantId` TEXT NOT NULL, `lastMessageId` TEXT NOT NULL, `lastMessageAt` INTEGER NOT NULL, `unreadMessagesCount` INTEGER NOT NULL, `relation` TEXT NOT NULL, `participantMetadataId` TEXT, PRIMARY KEY(`participantId`))", - "fields": [ - { - "fieldPath": "participantId", - "columnName": "participantId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "lastMessageId", - "columnName": "lastMessageId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "lastMessageAt", - "columnName": "lastMessageAt", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "unreadMessagesCount", - "columnName": "unreadMessagesCount", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "relation", - "columnName": "relation", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "participantMetadataId", - "columnName": "participantMetadataId", - "affinity": "TEXT", - "notNull": false - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "participantId" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "WalletTransactionData", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `walletLightningAddress` TEXT NOT NULL, `type` TEXT NOT NULL, `state` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, `completedAt` INTEGER, `amountInBtc` REAL NOT NULL, `amountInUsd` REAL, `isZap` INTEGER NOT NULL, `isStorePurchase` INTEGER NOT NULL, `userId` TEXT NOT NULL, `userSubWallet` TEXT NOT NULL, `userLightningAddress` TEXT, `otherUserId` TEXT, `otherLightningAddress` TEXT, `note` TEXT, `invoice` TEXT, `totalFeeInBtc` TEXT, `exchangeRate` TEXT, `onChainAddress` TEXT, `onChainTxId` TEXT, `zapNoteId` TEXT, `zapNoteAuthorId` TEXT, `zappedByUserId` TEXT, PRIMARY KEY(`id`))", - "fields": [ - { - "fieldPath": "id", - "columnName": "id", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "walletLightningAddress", - "columnName": "walletLightningAddress", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "type", - "columnName": "type", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "state", - "columnName": "state", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "createdAt", - "columnName": "createdAt", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "updatedAt", - "columnName": "updatedAt", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "completedAt", - "columnName": "completedAt", - "affinity": "INTEGER", - "notNull": false - }, - { - "fieldPath": "amountInBtc", - "columnName": "amountInBtc", - "affinity": "REAL", - "notNull": true - }, - { - "fieldPath": "amountInUsd", - "columnName": "amountInUsd", - "affinity": "REAL", - "notNull": false - }, - { - "fieldPath": "isZap", - "columnName": "isZap", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "isStorePurchase", - "columnName": "isStorePurchase", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "userId", - "columnName": "userId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "userSubWallet", - "columnName": "userSubWallet", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "userLightningAddress", - "columnName": "userLightningAddress", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "otherUserId", - "columnName": "otherUserId", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "otherLightningAddress", - "columnName": "otherLightningAddress", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "note", - "columnName": "note", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "invoice", - "columnName": "invoice", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "totalFeeInBtc", - "columnName": "totalFeeInBtc", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "exchangeRate", - "columnName": "exchangeRate", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "onChainAddress", - "columnName": "onChainAddress", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "onChainTxId", - "columnName": "onChainTxId", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "zapNoteId", - "columnName": "zapNoteId", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "zapNoteAuthorId", - "columnName": "zapNoteAuthorId", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "zappedByUserId", - "columnName": "zappedByUserId", - "affinity": "TEXT", - "notNull": false - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "id" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "Relay", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`userId` TEXT NOT NULL, `kind` TEXT NOT NULL, `url` TEXT NOT NULL, `read` INTEGER NOT NULL, `write` INTEGER NOT NULL, PRIMARY KEY(`userId`, `kind`, `url`))", - "fields": [ - { - "fieldPath": "userId", - "columnName": "userId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "kind", - "columnName": "kind", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "url", - "columnName": "url", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "read", - "columnName": "read", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "write", - "columnName": "write", - "affinity": "INTEGER", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "userId", - "kind", - "url" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "EventHints", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`eventId` TEXT NOT NULL, `relays` TEXT NOT NULL, `isBookmarked` INTEGER, PRIMARY KEY(`eventId`))", - "fields": [ - { - "fieldPath": "eventId", - "columnName": "eventId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "relays", - "columnName": "relays", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "isBookmarked", - "columnName": "isBookmarked", - "affinity": "INTEGER", - "notNull": false - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "eventId" - ] - }, - "indices": [], - "foreignKeys": [] - }, - { - "tableName": "ProfileInteraction", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`profileId` TEXT NOT NULL, `lastInteractionAt` INTEGER NOT NULL, PRIMARY KEY(`profileId`))", - "fields": [ - { - "fieldPath": "profileId", - "columnName": "profileId", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "lastInteractionAt", - "columnName": "lastInteractionAt", - "affinity": "INTEGER", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "profileId" - ] - }, - "indices": [], - "foreignKeys": [] - } - ], - "views": [], - "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, '9d8b6fdfda2ad116ce9b16ff027e2699')" - ] - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/net/primal/android/db/PrimalDatabase.kt b/app/src/main/kotlin/net/primal/android/db/PrimalDatabase.kt index 71fc2d11b..60d57eeb2 100644 --- a/app/src/main/kotlin/net/primal/android/db/PrimalDatabase.kt +++ b/app/src/main/kotlin/net/primal/android/db/PrimalDatabase.kt @@ -81,7 +81,7 @@ import net.primal.android.wallet.db.WalletTransactionData EventHints::class, ProfileInteraction::class, ], - version = 29, + version = 28, exportSchema = true, ) @TypeConverters( diff --git a/app/src/main/kotlin/net/primal/android/note/db/NoteZapData.kt b/app/src/main/kotlin/net/primal/android/note/db/NoteZapData.kt index 048faec86..a191f29f2 100644 --- a/app/src/main/kotlin/net/primal/android/note/db/NoteZapData.kt +++ b/app/src/main/kotlin/net/primal/android/note/db/NoteZapData.kt @@ -1,11 +1,15 @@ package net.primal.android.note.db import androidx.room.Entity -import androidx.room.PrimaryKey -@Entity +@Entity( + primaryKeys = [ + "zapSenderId", + "noteId", + "zapRequestAt", + ], +) data class NoteZapData( - @PrimaryKey(autoGenerate = true) val id: Int = 0, val zapSenderId: String, val zapReceiverId: String, val noteId: String,