feat: expenses, report and day log commands

This commit is contained in:
2025-01-18 21:21:26 +01:00
parent a28d392342
commit 8681914be2
30 changed files with 5614 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
-- CreateTable
CREATE TABLE "Expense" (
"id" TEXT NOT NULL,
"description" TEXT NOT NULL,
"cost" DOUBLE PRECISION NOT NULL,
"deleted" BOOLEAN NOT NULL DEFAULT false,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"categoryId" TEXT NOT NULL,
CONSTRAINT "Expense_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Category" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Category_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "Expense_categoryId_idx" ON "Expense"("categoryId");
-- AddForeignKey
ALTER TABLE "Expense" ADD CONSTRAINT "Expense_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "Category"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[name]` on the table `Category` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "Category_name_key" ON "Category"("name");

View File

@@ -0,0 +1,16 @@
-- CreateTable
CREATE TABLE "DayLog" (
"id" TEXT NOT NULL,
"date" TIMESTAMP(3) NOT NULL,
"comments" JSONB NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "DayLog_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "DayLog_date_key" ON "DayLog"("date");
-- CreateIndex
CREATE INDEX "DayLog_date_idx" ON "DayLog"("date");

View File

@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "postgresql"