Skip to content

Commit

Permalink
Adding the migration to include the project.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxyuri13 committed Jan 26, 2024
1 parent f30daa9 commit 364fe37
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 15 deletions.
15 changes: 0 additions & 15 deletions prisma/migrations/20240124155705_user_create/migration.sql

This file was deleted.

32 changes: 32 additions & 0 deletions prisma/migrations/20240126134916_orange_db_portfolio/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"surname" TEXT NOT NULL,
"email" TEXT NOT NULL,
"password_hash" TEXT NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,

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

-- CreateTable
CREATE TABLE "AddProject" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"tags" TEXT NOT NULL,
"link" TEXT NOT NULL,
"description" TEXT NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
"user_id" TEXT NOT NULL,

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

-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");

-- AddForeignKey
ALTER TABLE "AddProject" ADD CONSTRAINT "AddProject_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
15 changes: 15 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,19 @@ model User {
password_hash String
created_at DateTime @default(now())
updated_at DateTime @updatedAt
addProjects AddProject[]
}

model AddProject {
id String @id @default(uuid())
title String
tags String
link String
description String
created_at DateTime @default(now())
updated_at DateTime @updatedAt
user User @relation(fields: [user_id], references: [id])
user_id String
}

0 comments on commit 364fe37

Please sign in to comment.