update subscription algorithm

This commit is contained in:
root
2026-05-25 03:12:19 -04:00
parent 95376d3223
commit c9cbe479aa
42 changed files with 3098 additions and 307 deletions
@@ -0,0 +1,21 @@
CREATE TABLE "pricing_configs" (
"id" TEXT NOT NULL,
"plan" TEXT NOT NULL,
"billingPeriod" TEXT NOT NULL,
"amount" INTEGER NOT NULL,
"updatedAt" TIMESTAMP(3) NOT NULL,
"updatedBy" TEXT,
CONSTRAINT "pricing_configs_pkey" PRIMARY KEY ("id")
);
CREATE UNIQUE INDEX "pricing_configs_plan_billingPeriod_key" ON "pricing_configs"("plan", "billingPeriod");
-- Seed default prices (amounts in centimes MAD)
INSERT INTO "pricing_configs" ("id", "plan", "billingPeriod", "amount", "updatedAt") VALUES
('prc_starter_monthly', 'STARTER', 'MONTHLY', 2990, NOW()),
('prc_starter_annual', 'STARTER', 'ANNUAL', 29900, NOW()),
('prc_growth_monthly', 'GROWTH', 'MONTHLY', 3990, NOW()),
('prc_growth_annual', 'GROWTH', 'ANNUAL', 39900, NOW()),
('prc_pro_monthly', 'PRO', 'MONTHLY', 99900, NOW()),
('prc_pro_annual', 'PRO', 'ANNUAL', 999000, NOW());