Skip to content

Commit

Permalink
Initial schema
Browse files Browse the repository at this point in the history
* Use singular for model names
* Arrange enum alphabetically
* Make description, course, and ports optional
* Add orderURL and domain columns
  • Loading branch information
cychu42 committed Feb 2, 2023
1 parent c86bbe3 commit a04aa0e
Showing 1 changed file with 58 additions and 5 deletions.
63 changes: 58 additions & 5 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,63 @@ generator client {
}

model User {
username String @id
name String
email String @unique
username String @id
firstName String
lastName String
email String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
subdomians Record[]
certificates Certificate?
}

model Record {
id Int @id @default(autoincrement())
username String
name String
type RecordType
value String
description String?
course String?
ports String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
expiresAt DateTime
status RecordStatus
user User @relation(fields: [username], references: [username])
}

model Certificate {
id Int @id @default(autoincrement())
username String @unique
subject String
certificate String
orderUrl String @unique @db.VarChar(255)
privkey String
validFrom DateTime @default(now())
validTo DateTime
user User @relation(fields: [username], references: [username])
challange Challenge[]
}

model Challenge {
id Int @id @default(autoincrement())
domain String @db.VarChar(255)
challengeKey String @db.VarChar(255)
certificateId Int
certificate Certificate @relation(fields: [certificateId], references: [id])
}

enum RecordType {
A
AAAA
CNAME
TXT
}

enum RecordStatus {
active
error
pending
}

0 comments on commit a04aa0e

Please sign in to comment.