140 lines
4.0 KiB
Plaintext
140 lines
4.0 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Contact {
|
|
id String @id @default(cuid())
|
|
ethereumAddress String @unique
|
|
ensName String?
|
|
name String?
|
|
email String?
|
|
twitter String?
|
|
discord String?
|
|
telegram String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
farcaster String?
|
|
otherSocial String?
|
|
warpcastAddress String?
|
|
ethereumAddress2 String?
|
|
ContactSource ContactSource[]
|
|
daoMemberships DaoMembership[]
|
|
nftHoldings NftHolding[]
|
|
notes Note[]
|
|
tags TagsOnContacts[]
|
|
tokenHoldings TokenHolding[]
|
|
}
|
|
|
|
model NftHolding {
|
|
id String @id @default(cuid())
|
|
contactId String
|
|
contractAddress String
|
|
tokenId String
|
|
collectionName String?
|
|
acquiredAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
contact Contact @relation(fields: [contactId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([contactId, contractAddress, tokenId])
|
|
}
|
|
|
|
model TokenHolding {
|
|
id String @id @default(cuid())
|
|
contactId String
|
|
contractAddress String
|
|
tokenSymbol String?
|
|
balance String
|
|
lastUpdated DateTime @default(now())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
contact Contact @relation(fields: [contactId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([contactId, contractAddress])
|
|
}
|
|
|
|
model DaoMembership {
|
|
id String @id @default(cuid())
|
|
contactId String
|
|
daoName String
|
|
daoType String
|
|
joinedAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
contact Contact @relation(fields: [contactId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([contactId, daoName])
|
|
}
|
|
|
|
model Note {
|
|
id String @id @default(cuid())
|
|
contactId String
|
|
content String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
contact Contact @relation(fields: [contactId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model Tag {
|
|
id String @id @default(cuid())
|
|
name String @unique
|
|
color String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
contacts TagsOnContacts[]
|
|
}
|
|
|
|
model TagsOnContacts {
|
|
contactId String
|
|
tagId String
|
|
assignedAt DateTime @default(now())
|
|
contact Contact @relation(fields: [contactId], references: [id], onDelete: Cascade)
|
|
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
|
|
|
|
@@id([contactId, tagId])
|
|
}
|
|
|
|
model DataSource {
|
|
id String @id @default(cuid())
|
|
name String @unique
|
|
type String
|
|
description String?
|
|
lastScraped DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
ContactSource ContactSource[]
|
|
}
|
|
|
|
model ScrapingJob {
|
|
id String @id @default(cuid())
|
|
sourceName String
|
|
status String
|
|
startedAt DateTime?
|
|
completedAt DateTime?
|
|
recordsProcessed Int @default(0)
|
|
recordsAdded Int @default(0)
|
|
recordsUpdated Int @default(0)
|
|
errorMessage String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model ContactSource {
|
|
id String @id
|
|
contactId String
|
|
dataSourceId String
|
|
createdAt DateTime @db.Timestamp(6)
|
|
updatedAt DateTime @db.Timestamp(6)
|
|
Contact Contact @relation(fields: [contactId], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
|
DataSource DataSource @relation(fields: [dataSourceId], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
|
|
|
@@unique([contactId, dataSourceId])
|
|
@@index([contactId])
|
|
@@index([dataSourceId])
|
|
}
|