final touches for beta skymoney (at least i think)
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "passwordHash" TEXT,
|
||||
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
@@ -0,0 +1,9 @@
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Transaction"
|
||||
ADD CONSTRAINT "Transaction_categoryId_fkey"
|
||||
FOREIGN KEY ("categoryId") REFERENCES "VariableCategory"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Transaction"
|
||||
ADD CONSTRAINT "Transaction_planId_fkey"
|
||||
FOREIGN KEY ("planId") REFERENCES "FixedPlan"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,5 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ALTER COLUMN "updatedAt" DROP DEFAULT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "VariableCategory" ADD COLUMN "savingsTargetCents" BIGINT;
|
||||
@@ -0,0 +1,4 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Transaction" ADD COLUMN "isReconciled" BOOLEAN NOT NULL DEFAULT false,
|
||||
ADD COLUMN "note" TEXT,
|
||||
ADD COLUMN "receiptUrl" TEXT;
|
||||
@@ -0,0 +1,4 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "FixedPlan" ADD COLUMN "autoRollover" BOOLEAN NOT NULL DEFAULT true,
|
||||
ADD COLUMN "lastRollover" TIMESTAMP(3),
|
||||
ADD COLUMN "periodDays" INTEGER NOT NULL DEFAULT 30;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "displayName" TEXT;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "IncomeEvent" ADD COLUMN "note" TEXT;
|
||||
@@ -0,0 +1,6 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "FixedPlan" ADD COLUMN "autoPayEnabled" BOOLEAN NOT NULL DEFAULT false,
|
||||
ADD COLUMN "lastAutoPayment" TIMESTAMP(3),
|
||||
ADD COLUMN "maxRetryAttempts" INTEGER NOT NULL DEFAULT 3,
|
||||
ADD COLUMN "nextPaymentDate" TIMESTAMP(3),
|
||||
ADD COLUMN "paymentSchedule" JSONB;
|
||||
@@ -0,0 +1,14 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "FundingStrategy" AS ENUM ('tight', 'moderate', 'comfortable');
|
||||
|
||||
-- CreateEnum
|
||||
CREATE TYPE "IncomeFrequency" AS ENUM ('weekly', 'biweekly', 'monthly', 'irregular');
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "FixedPlan" ADD COLUMN "currentFundedCents" BIGINT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN "lastFundingDate" TIMESTAMP(3);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "fundingStrategy" "FundingStrategy" NOT NULL DEFAULT 'moderate',
|
||||
ADD COLUMN "incomeFrequency" "IncomeFrequency" NOT NULL DEFAULT 'irregular',
|
||||
ADD COLUMN "typicalIncomeCents" BIGINT;
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- The values [irregular] on the enum `IncomeFrequency` will be removed. If these variants are still used in the database, this will fail.
|
||||
- You are about to drop the column `fundingStrategy` on the `User` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `typicalIncomeCents` on the `User` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterEnum
|
||||
BEGIN;
|
||||
CREATE TYPE "IncomeFrequency_new" AS ENUM ('weekly', 'biweekly', 'monthly');
|
||||
ALTER TABLE "User" ALTER COLUMN "incomeFrequency" DROP DEFAULT;
|
||||
ALTER TABLE "User" ALTER COLUMN "incomeFrequency" TYPE "IncomeFrequency_new" USING ("incomeFrequency"::text::"IncomeFrequency_new");
|
||||
ALTER TYPE "IncomeFrequency" RENAME TO "IncomeFrequency_old";
|
||||
ALTER TYPE "IncomeFrequency_new" RENAME TO "IncomeFrequency";
|
||||
DROP TYPE "IncomeFrequency_old";
|
||||
ALTER TABLE "User" ALTER COLUMN "incomeFrequency" SET DEFAULT 'biweekly';
|
||||
COMMIT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" DROP COLUMN "fundingStrategy",
|
||||
DROP COLUMN "typicalIncomeCents",
|
||||
ALTER COLUMN "incomeFrequency" SET DEFAULT 'biweekly';
|
||||
|
||||
-- DropEnum
|
||||
DROP TYPE "FundingStrategy";
|
||||
@@ -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;
|
||||
@@ -0,0 +1,3 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "FixedPlan" ADD COLUMN "lastFundedPayPeriod" TIMESTAMP(3),
|
||||
ADD COLUMN "needsFundingThisPeriod" BOOLEAN NOT NULL DEFAULT true;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "firstIncomeDate" TIMESTAMP(3);
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "VariableCategory" ADD COLUMN "isLocked" BOOLEAN NOT NULL DEFAULT false;
|
||||
@@ -0,0 +1 @@
|
||||
-- This is an empty migration.
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `isLocked` on the `VariableCategory` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "VariableCategory" DROP COLUMN "isLocked";
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "FixedPlan" ADD COLUMN "frequency" TEXT;
|
||||
@@ -0,0 +1,5 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "IncomeEvent" ADD COLUMN "isScheduledIncome" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "pendingScheduledIncome" BOOLEAN NOT NULL DEFAULT false;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "timezone" TEXT NOT NULL DEFAULT 'America/New_York';
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Add overdue tracking fields to FixedPlan
|
||||
ALTER TABLE "FixedPlan" ADD COLUMN "isOverdue" BOOLEAN NOT NULL DEFAULT false;
|
||||
ALTER TABLE "FixedPlan" ADD COLUMN "overdueAmount" BIGINT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE "FixedPlan" ADD COLUMN "overdueSince" TIMESTAMP(3);
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Transaction" ADD COLUMN "isAutoPayment" BOOLEAN NOT NULL DEFAULT false;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "fixedExpensePercentage" INTEGER NOT NULL DEFAULT 40;
|
||||
Reference in New Issue
Block a user