-- AlterEnum
ALTER TYPE "UserRole" ADD VALUE 'ANALYTICS_ADMIN';

-- AlterTable
ALTER TABLE "docs_page_views" ADD COLUMN     "city" VARCHAR(100),
ADD COLUMN     "country" VARCHAR(2),
ADD COLUMN     "ip_address_hash" VARCHAR(64),
ADD COLUMN     "latitude" DOUBLE PRECISION,
ADD COLUMN     "longitude" DOUBLE PRECISION,
ADD COLUMN     "region" VARCHAR(100);

-- AlterTable
ALTER TABLE "photo_views" ADD COLUMN     "city" VARCHAR(100),
ADD COLUMN     "country" VARCHAR(2),
ADD COLUMN     "latitude" DOUBLE PRECISION,
ADD COLUMN     "longitude" DOUBLE PRECISION,
ADD COLUMN     "region" VARCHAR(100);

-- AlterTable
ALTER TABLE "site_settings" ADD COLUMN     "analytics_geo_enabled" BOOLEAN NOT NULL DEFAULT true,
ADD COLUMN     "analytics_retention_days" INTEGER NOT NULL DEFAULT 90,
ADD COLUMN     "enable_analytics" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN     "track_authenticated_users" BOOLEAN NOT NULL DEFAULT true;

-- AlterTable
ALTER TABLE "video_views" ADD COLUMN     "city" VARCHAR(100),
ADD COLUMN     "country" VARCHAR(2),
ADD COLUMN     "latitude" DOUBLE PRECISION,
ADD COLUMN     "longitude" DOUBLE PRECISION,
ADD COLUMN     "region" VARCHAR(100);

-- CreateIndex
CREATE INDEX "docs_page_views_country_createdAt_idx" ON "docs_page_views"("country", "createdAt");

-- CreateIndex
CREATE INDEX "idx_photo_views_country_date" ON "photo_views"("country", "viewed_at");

-- CreateIndex
CREATE INDEX "idx_video_views_country_created" ON "video_views"("country", "created_at");
