update subscription module

This commit is contained in:
root
2026-05-25 04:58:56 -04:00
parent 1606ea0053
commit 8d0b7a5ceb
17 changed files with 4394 additions and 157 deletions
@@ -0,0 +1,22 @@
CREATE TABLE IF NOT EXISTS "pricing_promotions" (
"id" TEXT NOT NULL,
"code" TEXT NOT NULL,
"name" TEXT NOT NULL,
"description" TEXT,
"discountType" TEXT NOT NULL,
"discountValue" INTEGER NOT NULL,
"plans" TEXT[] NOT NULL DEFAULT '{}',
"periods" TEXT[] NOT NULL DEFAULT '{}',
"maxUses" INTEGER,
"usedCount" INTEGER NOT NULL DEFAULT 0,
"validFrom" TIMESTAMP(3) NOT NULL,
"validUntil" TIMESTAMP(3),
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"createdBy" TEXT,
CONSTRAINT "pricing_promotions_pkey" PRIMARY KEY ("id")
);
CREATE UNIQUE INDEX IF NOT EXISTS "pricing_promotions_code_key" ON "pricing_promotions"("code");
CREATE INDEX IF NOT EXISTS "pricing_promotions_isActive_idx" ON "pricing_promotions"("isActive");