final touches for beta skymoney (at least i think)

This commit is contained in:
2026-01-18 00:00:44 -06:00
parent 4eae966f96
commit f4f0ae5df2
161 changed files with 26016 additions and 1966 deletions

View File

@@ -0,0 +1,32 @@
-- CreateEnum
CREATE TYPE "IncomeType" AS ENUM ('regular', 'irregular');
-- AlterTable
ALTER TABLE "User" ADD COLUMN "budgetPeriod" TEXT NOT NULL DEFAULT 'monthly',
ADD COLUMN "incomeType" "IncomeType" NOT NULL DEFAULT 'regular',
ADD COLUMN "totalBudgetCents" BIGINT;
-- CreateTable
CREATE TABLE "BudgetSession" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"periodStart" TIMESTAMP(3) NOT NULL,
"periodEnd" TIMESTAMP(3) NOT NULL,
"totalBudgetCents" BIGINT NOT NULL,
"allocatedCents" BIGINT NOT NULL DEFAULT 0,
"fundedCents" BIGINT NOT NULL DEFAULT 0,
"availableCents" BIGINT NOT NULL DEFAULT 0,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "BudgetSession_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "BudgetSession_userId_periodStart_idx" ON "BudgetSession"("userId", "periodStart");
-- CreateIndex
CREATE UNIQUE INDEX "BudgetSession_userId_periodStart_key" ON "BudgetSession"("userId", "periodStart");
-- AddForeignKey
ALTER TABLE "BudgetSession" ADD CONSTRAINT "BudgetSession_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;