feat(database): add description to the saved post table

This commit is contained in:
Harsh Shandilya 2022-12-10 18:25:11 +05:30
parent 9d8fd77a08
commit 1f850435b1
No known key found for this signature in database
4 changed files with 7 additions and 1 deletions

View file

@ -21,6 +21,7 @@ fun LobstersPost.toDbModel(): SavedPost {
submitterName = submitter.username,
submitterAvatarUrl = submitter.avatarUrl,
tags = tags,
description = description,
)
}
@ -35,5 +36,6 @@ fun LobstersPostDetails.toDbModel(): SavedPost {
submitterName = submitter.username,
submitterAvatarUrl = submitter.avatarUrl,
tags = tags,
description = description,
)
}

View file

@ -0,0 +1,2 @@
ALTER TABLE SavedPost
ADD COLUMN description TEXT NOT NULL DEFAULT "";

View file

@ -11,7 +11,8 @@ CREATE TABLE IF NOT EXISTS SavedPost(
commentsUrl TEXT NOT NULL,
submitterName TEXT NOT NULL,
submitterAvatarUrl TEXT NOT NULL,
tags TEXT AS List<String> NOT NULL
tags TEXT AS List<String> NOT NULL,
description TEXT NOT NULL DEFAULT ""
);
insertOrReplacePost:

View file

@ -131,6 +131,7 @@ class SqlDelightQueriesTest : FunSpec() {
submitterName = "test_user_$i",
submitterAvatarUrl = "test_avatar_url",
tags = listOf(),
description = "",
)
posts.add(post)