safeguards

This commit is contained in:
Oleg Silkin 2019-05-31 15:56:32 -04:00
parent f405076e37
commit 6cd4706360

View file

@ -5,7 +5,7 @@ PRAGMA FOREIGN_KEYS = ON;
-- DROP TABLE IF EXISTS COMMENT; -- DROP TABLE IF EXISTS COMMENT;
-- DROP TABLE IF EXISTS CHANNEL; -- DROP TABLE IF EXISTS CHANNEL;
DROP TABLE IF EXISTS COMMENT; -- DROP TABLE IF EXISTS COMMENT;
CREATE TABLE IF NOT EXISTS COMMENT ( CREATE TABLE IF NOT EXISTS COMMENT (
CommentId TEXT NOT NULL, CommentId TEXT NOT NULL,
LbryClaimId TEXT NOT NULL, LbryClaimId TEXT NOT NULL,
@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS COMMENT (
ON UPDATE CASCADE ON DELETE NO ACTION -- setting null implies comment is top level ON UPDATE CASCADE ON DELETE NO ACTION -- setting null implies comment is top level
); );
DROP TABLE IF EXISTS CHANNEL; -- DROP TABLE IF EXISTS CHANNEL;
CREATE TABLE IF NOT EXISTS CHANNEL( CREATE TABLE IF NOT EXISTS CHANNEL(
ClaimId TEXT NOT NULL, ClaimId TEXT NOT NULL,
Name TEXT NOT NULL, Name TEXT NOT NULL,
@ -46,7 +46,7 @@ CREATE VIEW IF NOT EXISTS COMMENTS_ON_CLAIMS (comment_id, claim_id, timestamp, c
-- DROP VIEW IF EXISTS COMMENT_REPLIES; DROP VIEW IF EXISTS COMMENT_REPLIES;
CREATE VIEW IF NOT EXISTS COMMENT_REPLIES (Author, CommentBody, ParentAuthor, ParentCommentBody) AS CREATE VIEW IF NOT EXISTS COMMENT_REPLIES (Author, CommentBody, ParentAuthor, ParentCommentBody) AS
SELECT AUTHOR.Name, OG.Body, PCHAN.Name, PARENT.Body FROM COMMENT AS OG SELECT AUTHOR.Name, OG.Body, PCHAN.Name, PARENT.Body FROM COMMENT AS OG
JOIN COMMENT AS PARENT JOIN COMMENT AS PARENT