Files

13 lines
454 B
SQL

CREATE TABLE "upload" (
"id" text PRIMARY KEY,
"original_name" text NOT NULL,
"oss_key" text NOT NULL UNIQUE,
"url" text NOT NULL,
"mime_type" text NOT NULL,
"size" integer NOT NULL,
"bucket" text NOT NULL,
"user_id" text,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "upload" ADD CONSTRAINT "upload_user_id_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE SET NULL;