kemono2/db/schema/public/posts/comments.sql

35 lines
1.1 KiB
MySQL
Raw Normal View History

2024-11-26 00:11:49 +01:00
CREATE TABLE comments(
"id" varchar(255) NOT NULL,
"post_id" varchar(255) NOT NULL,
"parent_id" varchar(255),
"commenter" varchar(255) NOT NULL,
"service" varchar(20) NOT NULL,
"content" text NOT NULL DEFAULT '',
"added" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"published" timestamp,
deleted_at timestamp,
commenter_name text,
PRIMARY KEY (id, service)
);
CREATE TABLE comments_revisions(
revision_id serial4 NOT NULL,
id varchar(255) NOT NULL,
post_id varchar(255) NOT NULL,
parent_id varchar(255) NULL,
commenter varchar(255) NOT NULL,
service varchar(20) NOT NULL,
"content" text NOT NULL DEFAULT ''::text,
added timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
published timestamp NULL,
deleted_at timestamp,
commenter_name text,
CONSTRAINT comments_revisions_pkey PRIMARY KEY (revision_id)
);
CREATE INDEX comments_revisions_post_id_idx ON comments_revisions USING btree(post_id);
CREATE INDEX comments_revisions_id_idx ON comments_revisions USING btree(id);
CREATE INDEX comment_idx ON comments USING btree("post_id");