-- CreateTable
CREATE TABLE "total_finance_report" (
    "id" SERIAL NOT NULL,
    "createDate" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updateDate" TIMESTAMP(3) NOT NULL,
    "dateFrom" TIMESTAMP(3) NOT NULL,
    "dateTo" TIMESTAMP(3) NOT NULL,
    "name" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "provider_base_report" (
    "id" SERIAL NOT NULL,
    "totalRevenue" DOUBLE PRECISION NOT NULL,
    "clawback" DOUBLE PRECISION NOT NULL DEFAULT 0,
    "totalFinanceReportId" INTEGER NOT NULL,
    "providerAccountId" INTEGER NOT NULL,

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

-- AddForeignKey
ALTER TABLE "provider_base_report" ADD CONSTRAINT "provider_base_report_totalFinanceReportId_fkey" FOREIGN KEY ("totalFinanceReportId") REFERENCES "total_finance_report"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "provider_base_report" ADD CONSTRAINT "provider_base_report_providerAccountId_fkey" FOREIGN KEY ("providerAccountId") REFERENCES "provider_account"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
