watchdogs/migrations/0001_init.sql
2024-10-07 09:24:54 +02:00

35 lines
915 B
SQL

CREATE TABLE IF NOT EXISTS "youtube_meta" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT,
"uploader_name" TEXT,
"uploader_id" TEXT,
"duration" INTEGER,
"views" INTEGER,
"upload_date" DATE,
PRIMARY KEY("id")
);
CREATE TABLE IF NOT EXISTS "youtube_meta_tags" (
"youtube_id" TEXT NOT NULL,
"tag" TEXT NOT NULL,
PRIMARY KEY("youtube_id", "tag"),
FOREIGN KEY("youtube_id") REFERENCES "youtube_meta"("id")
);
CREATE TABLE IF NOT EXISTS "youtube_meta_categories" (
"youtube_id" TEXT NOT NULL,
"category" TEXT NOT NULL,
PRIMARY KEY("youtube_id", "category"),
FOREIGN KEY("youtube_id") REFERENCES "youtube_meta"("id")
);
CREATE TABLE IF NOT EXISTS "videos" (
"id" UUID NOT NULL PRIMARY KEY DEFAULT gen_random_uuid(),
"directory" TEXT NOT NULL,
"path" TEXT NOT NULL,
"duration" INTEGER,
"title" TEXT,
"youtube_id" TEXT,
FOREIGN KEY("youtube_id") REFERENCES "youtube_meta"("id")
);