-- AlterTable
ALTER TABLE "RequestWork" ADD COLUMN     "creditNoteId" TEXT;

-- AlterTable
ALTER TABLE "_NotificationToNotificationGroup" ADD CONSTRAINT "_NotificationToNotificationGroup_AB_pkey" PRIMARY KEY ("A", "B");

-- DropIndex
DROP INDEX "_NotificationToNotificationGroup_AB_unique";

-- AlterTable
ALTER TABLE "_NotificationToUser" ADD CONSTRAINT "_NotificationToUser_AB_pkey" PRIMARY KEY ("A", "B");

-- DropIndex
DROP INDEX "_NotificationToUser_AB_unique";

-- AlterTable
ALTER TABLE "_UserToUserResponsibleArea" ADD CONSTRAINT "_UserToUserResponsibleArea_AB_pkey" PRIMARY KEY ("A", "B");

-- DropIndex
DROP INDEX "_UserToUserResponsibleArea_AB_unique";

-- CreateTable
CREATE TABLE "CreditNote" (
    "id" TEXT NOT NULL,
    "quotationId" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "DebitNote" (
    "id" TEXT NOT NULL,
    "quotationId" TEXT NOT NULL,

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

-- AddForeignKey
ALTER TABLE "RequestWork" ADD CONSTRAINT "RequestWork_creditNoteId_fkey" FOREIGN KEY ("creditNoteId") REFERENCES "CreditNote"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "CreditNote" ADD CONSTRAINT "CreditNote_quotationId_fkey" FOREIGN KEY ("quotationId") REFERENCES "Quotation"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "DebitNote" ADD CONSTRAINT "DebitNote_quotationId_fkey" FOREIGN KEY ("quotationId") REFERENCES "Quotation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
