Skip to content

Commit f0c2f99

Browse files
committed
select parentPostUri in postThread DAO query
1 parent bbc2000 commit f0c2f99

File tree

1 file changed

+4
-1
lines changed
  • data/database/src/commonMain/kotlin/com/tunjid/heron/data/database/daos

1 file changed

+4
-1
lines changed

data/database/src/commonMain/kotlin/com/tunjid/heron/data/database/daos/PostDao.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,14 @@ interface PostDao {
396396
ft.rootPostUri AS rootPostUri,
397397
ft.generation AS generation,
398398
ft.ancestorCreated AS ancestorCreated,
399-
ft.postCreated AS postCreated
399+
ft.postCreated AS postCreated,
400+
CASE WHEN ft.generation = 0 THEN NULL ELSE pt.parentPostUri END AS parentPostUri
400401
FROM
401402
posts p
402403
JOIN
403404
FullThread ft ON p.uri = ft.uri
405+
LEFT JOIN
406+
postThreads pt ON pt.postUri = p.uri
404407
ORDER BY
405408
ft.ancestorCreated, ft.generation, ft.postCreated; -- sort by the first reply to the op, then the generation, then the post itself
406409
""",

0 commit comments

Comments
 (0)