-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
326 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
-- CreateEnum | ||
CREATE TYPE "Gender" AS ENUM ('male', 'female', 'intersex'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "AuthType" AS ENUM ('email', 'google', 'apple'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "Nationality" AS ENUM ('SouthKorea', 'UnitedStates', 'Unknown'); | ||
|
||
-- CreateTable | ||
CREATE TABLE "users" ( | ||
"id" UUID NOT NULL DEFAULT gen_random_uuid(), | ||
"email" TEXT, | ||
"full_name" TEXT, | ||
"name" TEXT, | ||
"avatar_url" TEXT, | ||
"phone_verified" BOOLEAN DEFAULT false, | ||
"provider_id" TEXT, | ||
"sub" TEXT, | ||
"provider" "AuthType" NOT NULL DEFAULT 'email', | ||
"description" TEXT, | ||
"birthday" TIMESTAMP(3), | ||
"gender" "Gender", | ||
"phone" TEXT, | ||
"locale" TEXT, | ||
"confirmed_at" TIMESTAMP(3), | ||
"email_confirmed_at" TIMESTAMP(3), | ||
"last_sign_in_at" TIMESTAMP(3), | ||
"created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, | ||
"updated_at" TIMESTAMP(3), | ||
"deleted_at" TIMESTAMP(3), | ||
|
||
CONSTRAINT "users_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "developers" ( | ||
"id" UUID NOT NULL DEFAULT gen_random_uuid(), | ||
"email" TEXT, | ||
"bio" TEXT, | ||
"nationality" TEXT DEFAULT 'Unknown', | ||
"organization" TEXT, | ||
"meetup_id" TEXT, | ||
"github_id" TEXT, | ||
"twitter_id" TEXT, | ||
"threads_id" TEXT, | ||
"desired_connection" TEXT, | ||
"motivation_for_event_participation" TEXT, | ||
"future_expectations" TEXT, | ||
"created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, | ||
"updated_at" TIMESTAMP(3), | ||
"deleted_at" TIMESTAMP(3), | ||
"user_id" UUID, | ||
|
||
CONSTRAINT "developers_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "tags" ( | ||
"id" VARCHAR(50) NOT NULL, | ||
"tag" VARCHAR(50) NOT NULL, | ||
|
||
CONSTRAINT "tags_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "_DeveloperToTag" ( | ||
"A" UUID NOT NULL, | ||
"B" VARCHAR(50) NOT NULL | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "developers_email_key" ON "developers"("email"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "tags_tag_key" ON "tags"("tag"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "tags_tag_idx" ON "tags"("tag"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "_DeveloperToTag_AB_unique" ON "_DeveloperToTag"("A", "B"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "_DeveloperToTag_B_index" ON "_DeveloperToTag"("B"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "developers" ADD CONSTRAINT "developers_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_DeveloperToTag" ADD CONSTRAINT "_DeveloperToTag_A_fkey" FOREIGN KEY ("A") REFERENCES "developers"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_DeveloperToTag" ADD CONSTRAINT "_DeveloperToTag_B_fkey" FOREIGN KEY ("B") REFERENCES "tags"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
output = "../node_modules/.prisma/client" | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
enum Gender { | ||
male | ||
female | ||
intersex | ||
} | ||
|
||
enum AuthType { | ||
apple | ||
} | ||
|
||
model User { | ||
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid | ||
email String? | ||
fullName String? @map("full_name") | ||
name String? | ||
avatarUrl String? @map("avatar_url") | ||
phoneVerified Boolean? @default(false) @map("phone_verified") | ||
providerId String? @map("provider_id") | ||
sub String? | ||
provider AuthType @default(email) | ||
description String? | ||
birthday DateTime? | ||
gender Gender? | ||
phone String? | ||
locale String? | ||
confirmedAt DateTime? @map("confirmed_at") | ||
emailConfirmedAt DateTime? @map("email_confirmed_at") | ||
lastSignInAt DateTime? @map("last_sign_in_at") | ||
createdAt DateTime? @default(now()) @map("created_at") | ||
updatedAt DateTime? @updatedAt @map("updated_at") | ||
deletedAt DateTime? @map("deleted_at") | ||
developers Developer[] | ||
@@map("users") | ||
} | ||
|
||
enum Nationality { | ||
SouthKorea | ||
UnitedStates | ||
Unknown | ||
} | ||
|
||
model Developer { | ||
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid | ||
email String? @unique | ||
bio String? | ||
nationality String? @default("Unknown") | ||
organization String? | ||
meetupId String? @map("meetup_id") | ||
githubId String? @map("github_id") | ||
twitterId String? @map("twitter_id") | ||
threadsId String? @map("threads_id") | ||
/// 연결되고 싶은 분 | ||
desiredConnection String? @map("desired_connection") | ||
/// 행사 참여중일 때 동기 입력 | ||
motivationForEventParticipation String? @map("motivation_for_event_participation") | ||
/// 앞으로 기대하는 것 | ||
futureExpectations String? @map("future_expectations") | ||
createdAt DateTime? @default(now()) @map("created_at") | ||
updatedAt DateTime? @updatedAt @map("updated_at") | ||
deletedAt DateTime? @map("deleted_at") | ||
tags Tag[] | ||
userId String? @map("user_id") @db.Uuid | ||
user User? @relation(fields: [userId], references: [id]) | ||
@@map("developers") | ||
} | ||
|
||
model Tag { | ||
id String @id @default(cuid()) @db.VarChar(50) | ||
tag String @unique @db.VarChar(50) | ||
developers Developer[] | ||
@@index(tag) | ||
@@map("tags") | ||
} |
Oops, something went wrong.