Adding a task generated from the account balance to products

This commit is contained in:
2026-09-21 21:25:34 +03:30
parent be97a067f9
commit 17fb33b3e7
10 changed files with 700 additions and 0 deletions
@@ -0,0 +1,33 @@
-- CreateTable
CREATE TABLE "ProductAccountingLink" (
"id" TEXT NOT NULL,
"productId" TEXT NOT NULL,
"connectionId" TEXT NOT NULL,
"externalName" TEXT NOT NULL,
"ayar" INTEGER,
"vaznSabet" DOUBLE PRECISION,
"matchMethod" TEXT NOT NULL DEFAULT 'import',
"linkedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "ProductAccountingLink_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "ProductAccountingLink_productId_idx" ON "ProductAccountingLink"("productId");
-- CreateIndex
CREATE INDEX "ProductAccountingLink_connectionId_idx" ON "ProductAccountingLink"("connectionId");
-- CreateIndex
CREATE UNIQUE INDEX "ProductAccountingLink_productId_connectionId_key" ON "ProductAccountingLink"("productId", "connectionId");
-- CreateIndex
CREATE UNIQUE INDEX "ProductAccountingLink_connectionId_externalName_key" ON "ProductAccountingLink"("connectionId", "externalName");
-- AddForeignKey
ALTER TABLE "ProductAccountingLink" ADD CONSTRAINT "ProductAccountingLink_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ProductAccountingLink" ADD CONSTRAINT "ProductAccountingLink_connectionId_fkey" FOREIGN KEY ("connectionId") REFERENCES "AccountingConnection"("id") ON DELETE CASCADE ON UPDATE CASCADE;