-- AlterTable
ALTER TABLE "api_keys" ADD COLUMN     "alert_pct" INTEGER NOT NULL DEFAULT 80,
ADD COLUMN     "daily_cost_cents_limit" INTEGER,
ADD COLUMN     "daily_request_limit" INTEGER,
ADD COLUMN     "daily_token_limit" BIGINT,
ADD COLUMN     "total_cost_cents_limit" INTEGER,
ADD COLUMN     "total_request_limit" INTEGER,
ADD COLUMN     "total_token_limit" BIGINT;

-- AlterTable
ALTER TABLE "users" ADD COLUMN     "alert_pct" INTEGER NOT NULL DEFAULT 80,
ADD COLUMN     "daily_cost_cents_limit" INTEGER,
ADD COLUMN     "daily_request_limit" INTEGER,
ADD COLUMN     "daily_token_limit" BIGINT,
ADD COLUMN     "total_cost_cents_limit" INTEGER,
ADD COLUMN     "total_request_limit" INTEGER,
ADD COLUMN     "total_token_limit" BIGINT;

-- CreateTable
CREATE TABLE "quota_events" (
    "id" TEXT NOT NULL,
    "user_id" TEXT NOT NULL,
    "api_key_id" TEXT,
    "dimension" TEXT NOT NULL,
    "window_type" TEXT NOT NULL,
    "scope_type" TEXT NOT NULL,
    "threshold" INTEGER NOT NULL,
    "current" BIGINT NOT NULL,
    "action" TEXT NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

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