-- AlterTable: Add denormalized impersonatedUserId column to AdminAction
-- This enables indexed queries for support session actions instead of slow JSON path queries.
-- The value is also stored in details.impersonatedUserId for backwards compatibility.

ALTER TABLE "AdminAction" ADD COLUMN "impersonatedUserId" TEXT;

-- CreateIndex: Enable efficient lookups by impersonated user
CREATE INDEX "AdminAction_impersonatedUserId_idx" ON "AdminAction"("impersonatedUserId");
