Skip to content

Commit

Permalink
Add prisma
Browse files Browse the repository at this point in the history
  • Loading branch information
d1str0 committed Nov 27, 2024
1 parent cf680cc commit 19b72f0
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.env

# Logs
logs
*.log
Expand Down
90 changes: 90 additions & 0 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@aws-sdk/client-ec2": "^3.699.0",
"@fastify/autoload": "^6.0.0",
"@fastify/sensible": "^6.0.0",
"@prisma/client": "^5.22.0",
"fastify": "^5.0.0",
"fastify-cli": "^7.0.1",
"fastify-plugin": "^5.0.0",
Expand All @@ -35,6 +36,7 @@
"@types/jest": "^29.5.14",
"@types/node": "^22.9.3",
"jest": "^29.7.0",
"prisma": "^5.22.0",
"ts-jest": "^29.2.5",
"ts-node-dev": "^2.0.0",
"typescript": "^5.7.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- CreateTable
CREATE TABLE "User" (
"id" SERIAL NOT NULL,
"email" TEXT NOT NULL,
"name" TEXT,

CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
3 changes: 3 additions & 0 deletions api/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"
20 changes: 20 additions & 0 deletions api/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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")
}

model User {
id Int @id @default(autoincrement())
email String @unique
name String?
}
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# docker-compose.yml

services:
postgres:
image: postgres:14
container_name: postgres
environment:
POSTGRES_USER: api_user
POSTGRES_PASSWORD: randompassword
POSTGRES_DB: agave
ports:
- '5432:5432'
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U api_user -d mydb']
interval: 10s
timeout: 5s
retries: 5

volumes:
postgres_data:

0 comments on commit 19b72f0

Please sign in to comment.