init: init project
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "ROLE" AS ENUM ('ADMIN', 'USER');
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Account" (
|
||||
"id" TEXT NOT NULL,
|
||||
"email" TEXT NOT NULL,
|
||||
"password" TEXT NOT NULL,
|
||||
"role" "ROLE" NOT NULL DEFAULT 'USER',
|
||||
"lastOtp" TEXT,
|
||||
"lastOtpSendingTime" TIMESTAMP(3),
|
||||
"isDeleted" BOOLEAN NOT NULL DEFAULT false,
|
||||
"isAccountVerified" BOOLEAN NOT NULL DEFAULT false,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "Account_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Profile" (
|
||||
"id" TEXT NOT NULL,
|
||||
"accountId" TEXT NOT NULL,
|
||||
"fullName" TEXT NOT NULL,
|
||||
"profilePhoto" TEXT,
|
||||
|
||||
CONSTRAINT "Profile_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Account_email_key" ON "Account"("email");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Profile_accountId_key" ON "Profile"("accountId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Profile" ADD CONSTRAINT "Profile_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "Account"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (e.g., Git)
|
||||
provider = "postgresql"
|
||||
@@ -0,0 +1,19 @@
|
||||
enum ROLE {
|
||||
ADMIN
|
||||
USER
|
||||
}
|
||||
|
||||
model Account {
|
||||
id String @id @default(uuid())
|
||||
email String @unique
|
||||
password String
|
||||
role ROLE @default(USER)
|
||||
lastOtp String?
|
||||
lastOtpSendingTime DateTime?
|
||||
isDeleted Boolean @default(false)
|
||||
isAccountVerified Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now())
|
||||
|
||||
profile Profile?
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
model Profile {
|
||||
id String @id @default(uuid())
|
||||
accountId String @unique
|
||||
account Account @relation(fields: [accountId], references: [id], onDelete: Cascade)
|
||||
|
||||
fullName String
|
||||
profilePhoto String?
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
generator client {
|
||||
provider = "prisma-client"
|
||||
output = "../generated/prisma"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
}
|
||||
Reference in New Issue
Block a user