Skip to content

Commit

Permalink
feat: ✨ add prisma
Browse files Browse the repository at this point in the history
  • Loading branch information
neopromic committed Nov 6, 2024
1 parent cc256fb commit 174be7a
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
23 changes: 23 additions & 0 deletions prisma/migrations/20241106020351_init_db/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- CreateEnum
CREATE TYPE "TransactionType" AS ENUM ('DEPOSIT', 'EXPENSE', 'INVESTMENT');

-- CreateEnum
CREATE TYPE "TransactionCategory" AS ENUM ('HOUSING', 'TRANSPORTATION', 'FOOD', 'ENTERTAINMENT', 'HEALTH', 'UTILITY', 'SALARY', 'EDUCATION', 'OTHER');

-- CreateEnum
CREATE TYPE "TransactionPaymentMethod" AS ENUM ('CREDIT_CARD', 'DEBIT_CARD', 'BANK_TRANSFER', 'BANK_SLIP', 'CASH', 'PIX', 'OTHER');

-- CreateTable
CREATE TABLE "Transactions" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"type" "TransactionType" NOT NULL,
"amount" DECIMAL(10,2) NOT NULL,
"category" "TransactionCategory" NOT NULL,
"paymentMethod" "TransactionPaymentMethod" NOT NULL,
"date" TIMESTAMP(3) NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "Transactions_pkey" PRIMARY KEY ("id")
);
3 changes: 3 additions & 0 deletions prisma/migrations/migration_lock.toml
Original file line number Diff line number Diff line change
@@ -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"
54 changes: 54 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init

generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

enum TransactionType {
DEPOSIT
EXPENSE
INVESTMENT
}

enum TransactionCategory {
HOUSING
TRANSPORTATION
FOOD
ENTERTAINMENT
HEALTH
UTILITY
SALARY
EDUCATION
OTHER
}

enum TransactionPaymentMethod {
CREDIT_CARD
DEBIT_CARD
BANK_TRANSFER
BANK_SLIP
CASH
PIX
OTHER
}

model Transactions {
id String @id @default(uuid())
name String
type TransactionType
amount Decimal @db.Decimal(10, 2)
category TransactionCategory
paymentMethod TransactionPaymentMethod
date DateTime
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

0 comments on commit 174be7a

Please sign in to comment.