Add nested posts UI (#5)
## Summary - Cut hunt, question, submission, voting, hiding, and profile flows over to unified posts - Render nested replies with permission-aware inline Reply/Edit controls and edited markers - Add post profile queries and the author index migration they depend on Co-authored-by: codegirl-007 <s.raide@gmail.com>
This commit was merged in pull request #5.
This commit is contained in:
@@ -64,6 +64,9 @@ CREATE TABLE IF NOT EXISTS posts (
|
||||
{name: "index post replies", sql: `
|
||||
CREATE INDEX IF NOT EXISTS idx_posts_parent_created
|
||||
ON posts(parent_id, created_at, id)`},
|
||||
{name: "index post authors", sql: `
|
||||
CREATE INDEX IF NOT EXISTS idx_posts_author_created
|
||||
ON posts(author_id, created_at DESC, id DESC)`},
|
||||
{name: "index root posts", sql: `
|
||||
CREATE INDEX IF NOT EXISTS idx_posts_root_date
|
||||
ON posts(post_date, post_state)
|
||||
@@ -117,6 +120,15 @@ CREATE INDEX IF NOT EXISTS idx_post_votes_post_id
|
||||
return nil
|
||||
}
|
||||
|
||||
func migratePostAuthorIndex(ctx context.Context, exec execContext) error {
|
||||
if _, err := exec.ExecContext(ctx, `
|
||||
CREATE INDEX IF NOT EXISTS idx_posts_author_created
|
||||
ON posts(author_id, created_at DESC, id DESC)`); err != nil {
|
||||
return fmt.Errorf("idx_posts_author_created: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func migratePostDate(ctx context.Context, exec execContext) error {
|
||||
steps := []struct {
|
||||
name string
|
||||
@@ -306,6 +318,7 @@ CREATE TABLE IF NOT EXISTS schema_migrations (
|
||||
{"005_post_vote_post_id_index", migratePostVoteIndex},
|
||||
{"006_post_date", migratePostDate},
|
||||
{"007_post_state", migratePostState},
|
||||
{"008_post_author_index", migratePostAuthorIndex},
|
||||
}
|
||||
for _, m := range migrations {
|
||||
if applied[m.version] {
|
||||
|
||||
Reference in New Issue
Block a user