sendou.ink/prisma/migrations/20201013141255-init/README.md
Kalle (Sendou) f7d2a2f395 ran prettier
2020-10-16 01:05:14 +03:00

1.8 KiB

Migration 20201013141255-init

This migration has been generated by Kalle (Sendou) at 10/13/2020, 5:12:55 PM. You can check out the state of the schema after the migration.

Database Steps

CREATE TABLE "public"."User" (
"id" SERIAL,
"username" text   NOT NULL ,
"discriminator" text   NOT NULL ,
"discordId" text   NOT NULL ,
"discordAvatar" text   ,
PRIMARY KEY ("id")
)

CREATE TABLE "public"."Profile" (
"twitchName" text   ,
"youtubeId" text   ,
"country" text   ,
"sensMotion" integer   ,
"sensStick" integer   ,
"bio" text   ,
"weaponPool" text []  ,
"customUrlPath" text   ,
"userId" integer   NOT NULL
)

CREATE UNIQUE INDEX "User.discordId_unique" ON "public"."User"("discordId")

CREATE UNIQUE INDEX "Profile.customUrlPath_unique" ON "public"."Profile"("customUrlPath")

CREATE UNIQUE INDEX "Profile.userId_unique" ON "public"."Profile"("userId")

ALTER TABLE "public"."Profile" ADD FOREIGN KEY ("userId")REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE

Changes

diff --git schema.prisma schema.prisma
migration ..20201013141255-init
--- datamodel.dml
+++ datamodel.dml
@@ -1,0 +1,30 @@
+datasource db {
+  provider = "postgresql"
+  url = "***"
+}
+
+generator client {
+  provider = "prisma-client-js"
+}
+
+model User {
+  id            Int      @id @default(autoincrement())
+  username      String
+  discriminator String
+  discordId     String   @unique
+  discordAvatar String?
+  profile       Profile?
+}
+
+model Profile {
+  twitchName    String?
+  youtubeId     String?
+  country       String?
+  sensMotion    Int?
+  sensStick     Int?
+  bio           String?
+  weaponPool    String[]
+  customUrlPath String?  @unique
+  user          User     @relation(fields: [userId], references: [id])
+  userId        Int      @unique
+}