watchdogs/src/schema.sql

32 lines
878 B
MySQL
Raw Normal View History

2023-10-06 18:29:55 +02:00
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" TEXT,
PRIMARY KEY("id")
);
CREATE TABLE IF NOT EXISTS "youtube_meta_tags" (
"youtube_id" TEXT NOT NULL,
"tag" TEXT NOT NULL,
PRIMARY KEY("tag","youtube_id"),
FOREIGN KEY("youtube_id") REFERENCES "youtube_meta"("id")
);
CREATE TABLE IF NOT EXISTS "videos" (
"sha256" TEXT NOT NULL,
"directory" TEXT NOT NULL,
"path" TEXT NOT NULL,
"title" TEXT,
"youtube_id" TEXT,
PRIMARY KEY("sha256"),
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("category","youtube_id"),
FOREIGN KEY("youtube_id") REFERENCES "youtube_meta"("id")
);