Begin support for comment visibility
Add public_visibility column to comment model Add a table to map comments to possible seers Only show public comment at the momentpull/364/head
parent
9e799f2cf2
commit
141931fb94
@ -0,0 +1,4 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
ALTER TABLE comments DROP COLUMN public_visibility;
|
||||
|
||||
DROP TABLE comment_seers;
|
@ -0,0 +1,9 @@
|
||||
-- Your SQL goes here
|
||||
ALTER TABLE comments ADD public_visibility BOOLEAN NOT NULL DEFAULT 't';
|
||||
|
||||
CREATE TABLE comment_seers (
|
||||
id SERIAL PRIMARY KEY,
|
||||
comment_id INTEGER REFERENCES comments(id) ON DELETE CASCADE NOT NULL,
|
||||
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
|
||||
UNIQUE (comment_id, user_id)
|
||||
)
|
@ -0,0 +1,18 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
CREATE TABLE comments2 (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
content TEXT NOT NULL DEFAULT '',
|
||||
in_response_to_id INTEGER REFERENCES comments(id),
|
||||
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE NOT NULL,
|
||||
author_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
|
||||
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ap_url VARCHAR,
|
||||
sensitive BOOLEAN NOT NULL DEFAULT 'f',
|
||||
spoiler_text TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
INSERT INTO comments2 SELECT id,content,in_response_to_id,post_id,author_id,creation_date,ap_url,sensitive,spoiler_text FROM comments;
|
||||
DROP TABLE comments;
|
||||
ALTER TABLE comments2 RENAME TO comments;
|
||||
|
||||
DROP TABLE comment_seers;
|
@ -0,0 +1,9 @@
|
||||
-- Your SQL goes here
|
||||
ALTER TABLE comments ADD public_visibility BOOLEAN NOT NULL DEFAULT 't';
|
||||
|
||||
CREATE TABLE comment_seers (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
comment_id INTEGER REFERENCES comments(id) ON DELETE CASCADE NOT NULL,
|
||||
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
|
||||
UNIQUE (comment_id, user_id)
|
||||
)
|
Loading…
Reference in New Issue