watchdogs/migrations/0001_init.sql

35 lines
910 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,
"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" (
2024-10-07 09:24:54 +02:00
"id" UUID NOT NULL PRIMARY KEY DEFAULT gen_random_uuid(),
2023-10-06 18:29:55 +02:00
"directory" TEXT NOT NULL,
"path" TEXT NOT NULL,
2024-12-12 18:54:40 +01:00
"duration" FLOAT NOT NULL,
"title" TEXT NOT NULL,
2024-10-05 01:21:43 +02:00
"youtube_id" TEXT,
2023-10-06 18:29:55 +02:00
FOREIGN KEY("youtube_id") REFERENCES "youtube_meta"("id")
);