generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "sqlite"
  url      = "file:./database.db"
}

model AuthTicket {
  id        Int      @id @default(autoincrement())
  ticket    String
  expiresAt DateTime

  user   User @relation(references: [id], fields: [userId])
  userId Int  @unique
}

model User {
  id         Int         @id @default(autoincrement())
  username   String?     @unique
  authTicket AuthTicket?

  discordAuth DiscordAuth?
  githubAuth  GitHubAuth?
}

model DiscordAuth {
  id String @id

  user   User @relation(fields: [userId], references: [id])
  userId Int  @unique

  accessToken  String
  refreshToken String
  expiresAt    DateTime
  invalid      Boolean
}

model GitHubAuth {
  id String @id

  user   User @relation(fields: [userId], references: [id])
  userId Int  @unique

  accessToken String
  invalid     Boolean
}
