diff --git a/schema/comments_ddl.sql b/schema/comments_ddl.sql index db9e0fa..41719dc 100644 --- a/schema/comments_ddl.sql +++ b/schema/comments_ddl.sql @@ -5,15 +5,7 @@ PRAGMA FOREIGN_KEYS = ON; -- DROP TABLE IF EXISTS COMMENT; -- DROP TABLE IF EXISTS CHANNEL; -CREATE TABLE IF NOT EXISTS CHANNEL( - ClaimId TEXT NOT NULL, - Name TEXT NOT NULL, - CONSTRAINT CHANNEL_PK PRIMARY KEY (ClaimId) - ON CONFLICT IGNORE -); - - --- DROP TABLE IF EXISTS COMMENT; +DROP TABLE IF EXISTS COMMENT; CREATE TABLE IF NOT EXISTS COMMENT ( CommentId TEXT NOT NULL, LbryClaimId TEXT NOT NULL, @@ -30,6 +22,15 @@ CREATE TABLE IF NOT EXISTS COMMENT ( ON UPDATE CASCADE ON DELETE NO ACTION -- setting null implies comment is top level ); +DROP TABLE IF EXISTS CHANNEL; +CREATE TABLE IF NOT EXISTS CHANNEL( + ClaimId TEXT NOT NULL, + Name TEXT NOT NULL, + CONSTRAINT CHANNEL_PK PRIMARY KEY (ClaimId) + ON CONFLICT IGNORE +); + + -- indexes -- DROP INDEX IF EXISTS COMMENT_CLAIM_INDEX; CREATE INDEX IF NOT EXISTS COMMENT_CLAIM_INDEX ON COMMENT (LbryClaimId);