You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.3 KiB

  1. // This is your Prisma schema file,
  2. // learn more about it in the docs: https://pris.ly/d/prisma-schema
  3. generator client {
  4. provider = "prisma-client-js"
  5. }
  6. datasource db {
  7. provider = "sqlite"
  8. url = env("DATABASE_URL")
  9. }
  10. model User {
  11. id Bytes @id
  12. username String @unique
  13. password String
  14. createdAt DateTime @default(now())
  15. properties Property[]
  16. userOrgs UserOrg[]
  17. }
  18. model Property {
  19. id Bytes @id
  20. userId Bytes
  21. user User @relation(fields: [userId], references: [id])
  22. name String
  23. value String
  24. }
  25. model Org {
  26. id Bytes @id
  27. name String @unique
  28. description String
  29. createdAt DateTime @default(now())
  30. orgUsers UserOrg[]
  31. }
  32. model UserOrg {
  33. id Int @id @default(autoincrement())
  34. userId Bytes
  35. user User @relation(fields: [userId], references: [id])
  36. orgId Bytes
  37. org Org @relation(fields: [orgId], references: [id])
  38. }
  39. model Repo {
  40. id Bytes @id
  41. name String
  42. visibility Int
  43. ownerId Bytes
  44. ownerType Int
  45. createdAt DateTime @default(now())
  46. }
  47. model Log {
  48. id Int @id @default(autoincrement())
  49. subjectUserId Bytes
  50. subjectUsername String
  51. action String
  52. createdAt DateTime @default(now())
  53. parameters LogParameter[]
  54. }
  55. model LogParameter {
  56. id Int @id @default(autoincrement())
  57. logId Int
  58. log Log @relation(fields: [logId], references: [id])
  59. key String
  60. value String
  61. }