-- CreateTable
CREATE TABLE "monthly_user_roi" (
    "id" TEXT NOT NULL,
    "userId" TEXT NOT NULL,
    "month" INTEGER NOT NULL,
    "year" INTEGER NOT NULL,
    "userSalary" DECIMAL(12,2) NOT NULL,
    "overheadPerUser" DECIMAL(12,2) NOT NULL,
    "totalCost" DECIMAL(12,2) NOT NULL,
    "profitTarget" DECIMAL(12,2) NOT NULL,
    "revenueGenerated" DECIMAL(12,2) NOT NULL,
    "netProfit" DECIMAL(12,2) NOT NULL,
    "roiPercentage" DECIMAL(5,2) NOT NULL,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

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

-- CreateIndex
CREATE UNIQUE INDEX "monthly_user_roi_userId_month_year_key" ON "monthly_user_roi"("userId", "month", "year");

-- AddForeignKey
ALTER TABLE "monthly_user_roi" ADD CONSTRAINT "monthly_user_roi_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
