fix: make github user id unique
This commit is contained in:
parent
d032ec1596
commit
9e73fea852
@ -0,0 +1,8 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- A unique constraint covering the columns `[githubUserId]` on the table `Account` will be added. If there are existing duplicate values, this will fail.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "Account_githubUserId_key" ON "Account"("githubUserId");
|
@ -27,13 +27,13 @@ model Account {
|
|||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
settings String?
|
settings String?
|
||||||
settingsVersion Int @default(0)
|
settingsVersion Int @default(0)
|
||||||
githubUserId String?
|
githubUserId String? @unique
|
||||||
githubUser GithubUser? @relation(fields: [githubUserId], references: [id])
|
githubUser GithubUser? @relation(fields: [githubUserId], references: [id])
|
||||||
|
|
||||||
// Profile
|
// Profile
|
||||||
firstName String?
|
firstName String?
|
||||||
lastName String?
|
lastName String?
|
||||||
username String? @unique
|
username String? @unique
|
||||||
/// [ImageRef]
|
/// [ImageRef]
|
||||||
avatar Json?
|
avatar Json?
|
||||||
|
|
||||||
@ -199,16 +199,16 @@ model UsageReport {
|
|||||||
//
|
//
|
||||||
|
|
||||||
model Machine {
|
model Machine {
|
||||||
id String @id
|
id String @id
|
||||||
accountId String
|
accountId String
|
||||||
account Account @relation(fields: [accountId], references: [id])
|
account Account @relation(fields: [accountId], references: [id])
|
||||||
metadata String // Encrypted - contains static machine info
|
metadata String // Encrypted - contains static machine info
|
||||||
metadataVersion Int @default(0)
|
metadataVersion Int @default(0)
|
||||||
daemonState String? // Encrypted - contains dynamic daemon state
|
daemonState String? // Encrypted - contains dynamic daemon state
|
||||||
daemonStateVersion Int @default(0)
|
daemonStateVersion Int @default(0)
|
||||||
dataEncryptionKey Bytes?
|
dataEncryptionKey Bytes?
|
||||||
seq Int @default(0)
|
seq Int @default(0)
|
||||||
active Boolean @default(true)
|
active Boolean @default(true)
|
||||||
lastActiveAt DateTime @default(now())
|
lastActiveAt DateTime @default(now())
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
@ -257,11 +257,11 @@ model Artifact {
|
|||||||
id String @id // UUID provided by client
|
id String @id // UUID provided by client
|
||||||
accountId String
|
accountId String
|
||||||
account Account @relation(fields: [accountId], references: [id])
|
account Account @relation(fields: [accountId], references: [id])
|
||||||
header Bytes // Encrypted header (can contain JSON)
|
header Bytes // Encrypted header (can contain JSON)
|
||||||
headerVersion Int @default(0)
|
headerVersion Int @default(0)
|
||||||
body Bytes // Encrypted body
|
body Bytes // Encrypted body
|
||||||
bodyVersion Int @default(0)
|
bodyVersion Int @default(0)
|
||||||
dataEncryptionKey Bytes // Encryption key for this artifact
|
dataEncryptionKey Bytes // Encryption key for this artifact
|
||||||
seq Int @default(0)
|
seq Int @default(0)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
@ -282,7 +282,7 @@ model AccessKey {
|
|||||||
machine Machine @relation(fields: [accountId, machineId], references: [accountId, id])
|
machine Machine @relation(fields: [accountId, machineId], references: [accountId, id])
|
||||||
sessionId String
|
sessionId String
|
||||||
session Session @relation(fields: [sessionId], references: [id])
|
session Session @relation(fields: [sessionId], references: [id])
|
||||||
data String // Encrypted data
|
data String // Encrypted data
|
||||||
dataVersion Int @default(0)
|
dataVersion Int @default(0)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
@ -306,15 +306,15 @@ enum RelationshipStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model UserRelationship {
|
model UserRelationship {
|
||||||
fromUserId String
|
fromUserId String
|
||||||
fromUser Account @relation("RelationshipsFrom", fields: [fromUserId], references: [id], onDelete: Cascade)
|
fromUser Account @relation("RelationshipsFrom", fields: [fromUserId], references: [id], onDelete: Cascade)
|
||||||
toUserId String
|
toUserId String
|
||||||
toUser Account @relation("RelationshipsTo", fields: [toUserId], references: [id], onDelete: Cascade)
|
toUser Account @relation("RelationshipsTo", fields: [toUserId], references: [id], onDelete: Cascade)
|
||||||
status RelationshipStatus @default(pending)
|
status RelationshipStatus @default(pending)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
acceptedAt DateTime?
|
acceptedAt DateTime?
|
||||||
|
|
||||||
@@id([fromUserId, toUserId])
|
@@id([fromUserId, toUserId])
|
||||||
@@index([toUserId, status])
|
@@index([toUserId, status])
|
||||||
@@index([fromUserId, status])
|
@@index([fromUserId, status])
|
||||||
|
Loading…
Reference in New Issue
Block a user