2 ADD COLUMN parent_id integer;
4 -- Constraints and index
6 ADD CONSTRAINT comment_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES comment (id) ON UPDATE CASCADE ON DELETE CASCADE;
8 CREATE INDEX idx_comment_parent ON comment (parent_id);
10 -- Update the parent_id column
11 -- subpath(subpath(0, -1), -1) gets the immediate parent but it fails null checks
15 parent_id = cast(ltree2text (nullif (subpath (nullif (subpath (path, 0, -1), '0'), -1), '0')) AS INTEGER);
20 ALTER TABLE comment_aggregates
21 DROP COLUMN child_count;
25 -- Add back in the read column
27 ADD COLUMN read boolean DEFAULT FALSE NOT NULL;
38 CREATE VIEW comment_alias_1 AS
44 DROP TABLE comment_reply;