34 lines
910 B
SQL
34 lines
910 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,
|
|
"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" FLOAT NOT NULL,
|
|
"title" TEXT NOT NULL,
|
|
"youtube_id" TEXT,
|
|
FOREIGN KEY("youtube_id") REFERENCES "youtube_meta"("id")
|
|
);
|