Files
erika/drizzle/0017_friendly_video_upload.sql
T

36 lines
1.4 KiB
SQL

CREATE TABLE IF NOT EXISTS "public"."video_upload" (
"id" text PRIMARY KEY NOT NULL,
"title" text NOT NULL,
"description" text DEFAULT '' NOT NULL,
"video_path" text NOT NULL,
"thumbnail_path" text,
"original_filename" text NOT NULL,
"mime_type" text NOT NULL,
"size" bigint NOT NULL,
"scheduled_at" timestamptz,
"status" text DEFAULT 'draft' NOT NULL,
"youtube_settings" jsonb DEFAULT '{}'::jsonb NOT NULL,
"tiktok_settings" jsonb DEFAULT '{}'::jsonb NOT NULL,
"created_by_discord_id" text NOT NULL,
"created_at" timestamptz DEFAULT now() NOT NULL,
"updated_at" timestamptz DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "video_upload_status_scheduled_idx" ON "public"."video_upload" ("status", "scheduled_at");
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "public"."video_upload_job" (
"id" text PRIMARY KEY NOT NULL,
"upload_id" text NOT NULL REFERENCES "public"."video_upload"("id") ON DELETE cascade,
"platform" text NOT NULL,
"status" text DEFAULT 'pending' NOT NULL,
"external_id" text,
"external_url" text,
"error" text,
"attempts" integer DEFAULT 0 NOT NULL,
"started_at" timestamptz,
"completed_at" timestamptz,
"created_at" timestamptz DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "video_upload_job_upload_platform_idx" ON "public"."video_upload_job" ("upload_id", "platform");