watchdogs/migrations/0001_init.sql

37 lines
905 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,
2024-10-05 01:21:43 +02:00
"upload_date" DATE,
2023-10-06 18:29:55 +02:00
PRIMARY KEY("id")
);
2024-10-05 01:21:43 +02:00
2023-10-06 18:29:55 +02:00
CREATE TABLE IF NOT EXISTS "youtube_meta_tags" (
2024-10-05 01:21:43 +02:00
"youtube_id" TEXT NOT NULL,
2023-10-06 18:29:55 +02:00
"tag" TEXT NOT NULL,
2024-10-05 01:21:43 +02:00
PRIMARY KEY("youtube_id", "tag"),
2023-10-06 18:29:55 +02:00
FOREIGN KEY("youtube_id") REFERENCES "youtube_meta"("id")
);
2024-10-05 01:21:43 +02:00
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")
);
2023-10-06 18:29:55 +02:00
CREATE TABLE IF NOT EXISTS "videos" (
"sha256" TEXT NOT NULL,
"directory" TEXT NOT NULL,
"path" TEXT NOT NULL,
2024-10-05 01:21:43 +02:00
"duration" INTEGER,
2023-10-06 18:29:55 +02:00
"title" TEXT,
2024-10-05 01:21:43 +02:00
"youtube_id" TEXT,
2023-10-06 18:29:55 +02:00
PRIMARY KEY("sha256"),
FOREIGN KEY("youtube_id") REFERENCES "youtube_meta"("id")
);