Web API for code.
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.
 
 

84 lines
1.6 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. sessions Session[]
  18. createdOrgs Org[]
  19. }
  20. model Property {
  21. id Bytes @id
  22. userId Bytes
  23. user User @relation(fields: [userId], references: [id])
  24. name String
  25. value String
  26. }
  27. model Org {
  28. id Bytes @id
  29. name String @unique
  30. description String
  31. createdAt DateTime @default(now())
  32. creatorUserId Bytes
  33. creatorUser User @relation(fields: [creatorUserId], references: [id])
  34. orgUsers UserOrg[]
  35. }
  36. model UserOrg {
  37. id Int @id @default(autoincrement())
  38. userId Bytes
  39. user User @relation(fields: [userId], references: [id])
  40. orgId Bytes
  41. org Org @relation(fields: [orgId], references: [id])
  42. }
  43. model Repo {
  44. id Bytes @id
  45. name String
  46. visibility String
  47. ownerId Bytes
  48. ownerType String
  49. createdAt DateTime @default(now())
  50. }
  51. model Log {
  52. id Int @id @default(autoincrement())
  53. subjectUserId Bytes
  54. subjectUsername String
  55. action String
  56. createdAt DateTime @default(now())
  57. parameters LogParameter[]
  58. }
  59. model LogParameter {
  60. id Int @id @default(autoincrement())
  61. logId Int
  62. log Log @relation(fields: [logId], references: [id])
  63. key String
  64. value String
  65. }
  66. model Session {
  67. id Bytes @id
  68. createdAt DateTime
  69. validUntil DateTime
  70. userId Bytes
  71. user User @relation(fields: [userId], references: [id])
  72. }