feat: add videos table to schema and implement video upload route with metadata persistence

This commit is contained in:
2025-12-11 16:15:00 +00:00
parent cae15f3f7d
commit ac28dd14e4
5 changed files with 307 additions and 2 deletions

View File

@@ -0,0 +1,17 @@
CREATE TABLE "videos" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" uuid NOT NULL,
"object_key" varchar(1024) NOT NULL,
"bucket" varchar(255) NOT NULL,
"upload_url" text NOT NULL,
"download_url" text,
"status" varchar(32) DEFAULT 'pending' NOT NULL,
"expires_at" timestamp with time zone,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "videos_object_key_unique" UNIQUE("object_key")
);
--> statement-breakpoint
ALTER TABLE "events" ADD COLUMN "creator_id" uuid;--> statement-breakpoint
ALTER TABLE "videos" ADD CONSTRAINT "videos_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "events" ADD CONSTRAINT "events_creator_id_users_id_fk" FOREIGN KEY ("creator_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;