-- CreateEnum
CREATE TYPE "public"."InsightType" AS ENUM ('WEEKLY', 'MONTHLY');

-- AlterTable
ALTER TABLE "public"."astrology_charts" ADD COLUMN     "ascendantDescription" TEXT,
ADD COLUMN     "moonDescription" TEXT,
ADD COLUMN     "sunDescription" TEXT;

-- CreateTable
CREATE TABLE "public"."AstrologyInsight" (
    "id" TEXT NOT NULL,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" TIMESTAMP(3) NOT NULL,
    "userId" TEXT NOT NULL,
    "insightType" "public"."InsightType" NOT NULL,
    "weeklyTitle" TEXT,
    "weeklyPeriod" TEXT,
    "weeklyOverview" TEXT,
    "weeklyEnergy" TEXT,
    "weeklyKeyThemes" TEXT[],
    "weeklyLuckyDays" TEXT[],
    "weeklyChallenges" TEXT,
    "monthlyTitle" TEXT,
    "monthlyPeriod" TEXT,
    "monthlyOverview" TEXT,
    "monthlyEnergy" TEXT,
    "monthlyKeyThemes" TEXT[],
    "monthlyLuckyDays" TEXT[],
    "monthlyChallenges" TEXT,
    "personalAspects" JSONB,
    "generatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "expiresAt" TIMESTAMP(3) NOT NULL,
    "isDeleted" BOOLEAN NOT NULL DEFAULT false,

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

-- CreateIndex
CREATE INDEX "AstrologyInsight_userId_idx" ON "public"."AstrologyInsight"("userId");

-- CreateIndex
CREATE INDEX "AstrologyInsight_insightType_idx" ON "public"."AstrologyInsight"("insightType");

-- CreateIndex
CREATE INDEX "AstrologyInsight_generatedAt_idx" ON "public"."AstrologyInsight"("generatedAt");

-- CreateIndex
CREATE INDEX "AstrologyInsight_expiresAt_idx" ON "public"."AstrologyInsight"("expiresAt");

-- CreateIndex
CREATE INDEX "AstrologyInsight_isDeleted_idx" ON "public"."AstrologyInsight"("isDeleted");

-- CreateIndex
CREATE INDEX "Admin_email_idx" ON "public"."Admin"("email");

-- AddForeignKey
ALTER TABLE "public"."AstrologyInsight" ADD CONSTRAINT "AstrologyInsight_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
