first MVP
This commit is contained in:
51
prisma/schema.prisma
Normal file
51
prisma/schema.prisma
Normal file
@@ -0,0 +1,51 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
||||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model Person {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
company String?
|
||||
role String?
|
||||
email String?
|
||||
location String?
|
||||
sectors String[] @default([])
|
||||
interests String[] @default([])
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
// Relations (undirected connections modeled as two directed FKs)
|
||||
connectionsA Connection[] @relation("ConnectionsA")
|
||||
connectionsB Connection[] @relation("ConnectionsB")
|
||||
|
||||
@@index([name])
|
||||
}
|
||||
|
||||
model Connection {
|
||||
id String @id @default(uuid())
|
||||
personAId String
|
||||
personBId String
|
||||
personA Person @relation("ConnectionsA", fields: [personAId], references: [id], onDelete: Cascade)
|
||||
personB Person @relation("ConnectionsB", fields: [personBId], references: [id], onDelete: Cascade)
|
||||
introducedByChain String[] @default([])
|
||||
eventLabels String[] @default([])
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([personAId])
|
||||
@@index([personBId])
|
||||
// Uniqueness of undirected pair (A,B) and self-edge prevention enforced via SQL migration with
|
||||
// a functional unique index on (LEAST(personAId, personBId), GREATEST(personAId, personBId))
|
||||
// and a CHECK (personAId <> personBId).
|
||||
}
|
||||
Reference in New Issue
Block a user