1
0

Basic transaction system

This commit is contained in:
Ahmed Al-Taiar
2023-11-14 18:54:44 -05:00
parent f6f01594ec
commit 8060e1e452
60 changed files with 2037 additions and 507 deletions

View File

@ -0,0 +1,16 @@
-- CreateEnum
CREATE TYPE "TransactionType" AS ENUM ('in', 'out');
-- CreateTable
CREATE TABLE "Transaction" (
"id" SERIAL NOT NULL,
"date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"userId" INTEGER NOT NULL,
"type" "TransactionType" NOT NULL,
"parts" JSONB[],
CONSTRAINT "Transaction_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "Transaction" ADD CONSTRAINT "Transaction_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;