CREATE TABLE IF NOT EXISTS "user_file" (
  "id" TEXT PRIMARY KEY NOT NULL,
  "user_id" TEXT NOT NULL,
  "filename" TEXT NOT NULL,
  "original_name" TEXT NOT NULL,
  "content_type" TEXT NOT NULL,
  "size" INTEGER NOT NULL,
  "s3_key" TEXT NOT NULL,
  "url" TEXT NOT NULL,
  "uploaded_at" INTEGER NOT NULL,
  FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE CASCADE
);

CREATE INDEX IF NOT EXISTS "user_file_user_id_idx" ON "user_file" ("user_id");
