2023-05-08 01:25:22 +00:00
|
|
|
CREATE TYPE feed_type AS ENUM ('atom', 'rss');
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS "feeds" (
|
|
|
|
"id" SERIAL PRIMARY KEY NOT NULL,
|
2023-05-18 03:10:23 +00:00
|
|
|
"title" VARCHAR(255),
|
2023-05-08 01:25:22 +00:00
|
|
|
"url" VARCHAR(2048) NOT NULL,
|
|
|
|
"type" feed_type NOT NULL,
|
|
|
|
"description" TEXT,
|
|
|
|
"created_at" timestamp(3) NOT NULL,
|
|
|
|
"updated_at" timestamp(3) NOT NULL,
|
|
|
|
"deleted_at" timestamp(3)
|
|
|
|
);
|
2023-05-10 03:46:42 +00:00
|
|
|
CREATE INDEX "feeds_deleted_at" ON "feeds" ("deleted_at");
|
|
|
|
CREATE UNIQUE INDEX "feeds_url" ON "feeds" ("url");
|
2023-05-08 01:25:22 +00:00
|
|
|
|
2023-05-13 19:39:39 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS "entries" (
|
2023-05-07 21:41:45 +00:00
|
|
|
"id" SERIAL PRIMARY KEY NOT NULL,
|
2023-05-18 03:10:23 +00:00
|
|
|
"title" VARCHAR(255),
|
2023-05-07 23:50:44 +00:00
|
|
|
"url" VARCHAR(2048) NOT NULL,
|
|
|
|
"description" TEXT,
|
2023-06-07 05:06:03 +00:00
|
|
|
"html_content" TEXT,
|
2023-05-08 01:25:22 +00:00
|
|
|
"feed_id" INTEGER REFERENCES "feeds"(id) NOT NULL,
|
2023-06-08 05:20:21 +00:00
|
|
|
"published_at" timestamp(3) NOT NULL,
|
2023-05-07 21:41:45 +00:00
|
|
|
"created_at" timestamp(3) NOT NULL,
|
|
|
|
"updated_at" timestamp(3) NOT NULL,
|
|
|
|
"deleted_at" timestamp(3)
|
|
|
|
);
|
2023-06-08 05:20:21 +00:00
|
|
|
CREATE INDEX "entries_published_at_where_deleted_at_is_null" ON "entries" ("published_at" DESC) WHERE "deleted_at" IS NULL;
|
2023-05-13 19:39:39 +00:00
|
|
|
CREATE UNIQUE INDEX "entries_url_and_feed_id" ON "entries" ("url", "feed_id");
|