prisma pretty noice

This commit is contained in:
ntr committed 2022-07-28 00:18:11 +10:00
1 parent eb04fdb9a5
commit adcc19564f
11 files changed
+133 -185

No files matched your search

@@ -1,13 +0,0 @@
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"discogs" TEXT,
"data" JSONB NOT NULL,
"creaedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "User_discogs_key" ON "User"("discogs");
-3
View File
@@ -1,3 +0,0 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "postgresql"
+39 -9
View File
@@ -1,6 +1,3 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
@@ -10,11 +7,44 @@ datasource db {
url = env("DATABASE_URL")
}
model User {
id String @id @default(uuid())
discogs String? @unique
data Json
model Listing {
id Int @id
seller Int
data Json
creaedAt DateTime @default(now())
updatedAt DateTime @updatedAt
wantId String @db.Uuid
want Want @relation(fields: [wantId], references: [id], onDelete: Cascade, onUpdate: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([seller])
}
model User {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
discogs String? @unique
data Json
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
wants Want[]
}
model Want {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
release Int?
data Json
userId String @db.Uuid
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
listings Listing[]
@@unique([userId, release])
@@index([release])
}