Add feed model, link items to feeds

This commit is contained in:
2023-05-07 21:25:22 -04:00
parent f30be5f451
commit b2a5bf5882
10 changed files with 188 additions and 16 deletions

View File

@@ -1,9 +1,23 @@
CREATE TABLE IF NOT EXISTS "items" (
CREATE TYPE feed_type AS ENUM ('atom', 'rss');
CREATE TABLE IF NOT EXISTS "feeds" (
"id" SERIAL PRIMARY KEY NOT NULL,
"title" VARCHAR(255) NOT NULL,
"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)
);
CREATE TABLE IF NOT EXISTS "items" (
"id" SERIAL PRIMARY KEY NOT NULL,
"title" VARCHAR(255) NOT NULL,
"url" VARCHAR(2048) NOT NULL,
"description" TEXT,
"feed_id" INTEGER REFERENCES "feeds"(id) NOT NULL,
"created_at" timestamp(3) NOT NULL,
"updated_at" timestamp(3) NOT NULL,
"deleted_at" timestamp(3)
);