-- AlterTable
ALTER TABLE "content_flag" ADD COLUMN     "severity" TEXT NOT NULL DEFAULT 'medium',
ADD COLUMN     "source" TEXT NOT NULL DEFAULT 'system';

-- CreateTable
CREATE TABLE "worker_heartbeat" (
    "name" TEXT NOT NULL,
    "lastBeatAt" TIMESTAMP(3) NOT NULL,
    "queued" INTEGER,
    "running" INTEGER,
    "meta" JSONB,

    CONSTRAINT "worker_heartbeat_pkey" PRIMARY KEY ("name")
);

-- CreateTable
CREATE TABLE "webhook_event" (
    "id" TEXT NOT NULL,
    "provider" TEXT NOT NULL,
    "eventId" TEXT NOT NULL,
    "type" TEXT NOT NULL,
    "status" TEXT NOT NULL DEFAULT 'processed',
    "error" TEXT,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

    CONSTRAINT "webhook_event_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "webhook_event_eventId_key" ON "webhook_event"("eventId");

-- CreateIndex
CREATE INDEX "webhook_event_provider_createdAt_idx" ON "webhook_event"("provider", "createdAt");

-- CreateIndex
CREATE INDEX "episode_createdAt_idx" ON "episode"("createdAt");

-- CreateIndex
CREATE INDEX "subscription_status_idx" ON "subscription"("status");

-- CreateIndex
CREATE INDEX "subscription_createdAt_idx" ON "subscription"("createdAt");

-- CreateIndex
CREATE INDEX "user_createdAt_idx" ON "user"("createdAt");
