Advertisement
tievo

schema prisma

Mar 2nd, 2023
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.00 KB | None | 0 0
  1. generator client {
  2. provider = "prisma-client-js"
  3. }
  4.  
  5. datasource db {
  6. provider = "mysql"
  7. url = env("DATABASE_URL")
  8. }
  9.  
  10. model area {
  11. id Int @id @default(autoincrement())
  12. name String
  13. external_id Int @unique
  14. learning_map_area learning_map_area[]
  15. }
  16.  
  17. model learning_map {
  18. id Int @id @default(autoincrement())
  19. name String @db.VarChar(255)
  20. status Int
  21. created_at DateTime @default(now()) @db.DateTime(0)
  22. deleted_at DateTime @default(now()) @db.DateTime(0)
  23. updated_at DateTime @default(now()) @db.DateTime(0)
  24. organization_id Int
  25. time_feature Int @default(0)
  26. learning_map_status learning_map_status @relation(fields: [status], references: [id], onUpdate: Restrict, map: "learning_map_ibfk_1")
  27. organization organization @relation(fields: [organization_id], references: [id], onUpdate: Restrict, map: "learning_map_ibfk_2")
  28. learning_map_area learning_map_area[]
  29. learning_map_level learning_map_level[]
  30. learning_map_area_group learning_map_area_group[]
  31.  
  32. @@index([organization_id], map: "organization_id")
  33. @@index([status], map: "status")
  34. }
  35.  
  36. model learning_map_status {
  37. id Int @id @default(autoincrement())
  38. name String @db.VarChar(255)
  39. learning_map learning_map[]
  40. }
  41.  
  42. model level {
  43. id Int @id @default(autoincrement())
  44. name String
  45. external_id Int @unique
  46. learning_map_level learning_map_level[]
  47. }
  48.  
  49. model organization {
  50. id Int @id @unique
  51. learning_map learning_map[]
  52. user user[]
  53. }
  54.  
  55. model user {
  56. id Int @id @default(autoincrement())
  57. external_id Int
  58. organization_id Int
  59. organization organization @relation(fields: [organization_id], references: [id], onUpdate: Restrict, map: "user_ibfk_1")
  60.  
  61. @@index([organization_id], map: "user_ibfk_1")
  62. }
  63.  
  64. model area_group {
  65. id Int @id @default(autoincrement())
  66. name String @db.VarChar(255)
  67. areas area_group_area[]
  68. learning_map_area_group learning_map_area_group[]
  69. }
  70.  
  71. model area_group_area {
  72. id Int @id @default(autoincrement())
  73. area_group_id Int
  74. learning_map_area_id Int
  75. area_group area_group @relation(fields: [area_group_id], references: [id], onUpdate: Restrict, map: "area_group_area_ibfk_1")
  76. area learning_map_area @relation(fields: [learning_map_area_id], references: [id], onUpdate: Restrict, map: "area_group_area_ibfk_2")
  77.  
  78. @@index([area_group_id], map: "area_group_id")
  79. @@index([learning_map_area_id], map: "learning_map_area_id")
  80. }
  81.  
  82. // model organization_area {
  83. // id Int @id @default(autoincrement())
  84. // organization_id Int
  85. // area_id Int
  86. // organization organization @relation(fields: [organization_id], references: [id], onUpdate: Restrict, map: "organization_area_ibfk_1")
  87. // area area @relation(fields: [area_id], references: [id], onUpdate: Restrict, map: "organization_area_ibfk_2")
  88. // learning_map_area learning_map_area[]
  89.  
  90. // @@index([area_id], map: "area_id")
  91. // @@index([organization_id], map: "organization_id")
  92. // }
  93.  
  94. // model organization_level {
  95. // id Int @id @default(autoincrement())
  96. // organization_id Int
  97. // level_id Int
  98. // organization organization @relation(fields: [organization_id], references: [id], onUpdate: Restrict, map: "organization_level_ibfk_1")
  99. // level level @relation(fields: [level_id], references: [id], onUpdate: Restrict, map: "organization_level_ibfk_2")
  100. // learning_map_level learning_map_level[]
  101.  
  102. // @@index([level_id], map: "level_id")
  103. // @@index([organization_id], map: "organization_id")
  104. // }
  105.  
  106. model competence {
  107. id Int @id @default(autoincrement())
  108. external_id Int @unique
  109. name String @db.VarChar(255)
  110. status Int
  111. created_at DateTime @default(now()) @db.DateTime(0)
  112. deleted_at DateTime @default(now()) @db.DateTime(0)
  113. updated_at DateTime @default(now()) @db.DateTime(0)
  114. competence_assignment competence_assignment[]
  115. skills skill[]
  116. }
  117.  
  118. model competence_assignment {
  119. id Int @id @default(autoincrement())
  120. learning_map_area_id Int
  121. learning_map_level_id Int
  122. competence_id Int
  123. created_at DateTime @default(now()) @db.DateTime(0)
  124. deleted_at DateTime @default(now()) @db.DateTime(0)
  125. updated_at DateTime @default(now()) @db.DateTime(0)
  126. learning_map_area learning_map_area @relation(fields: [learning_map_area_id], references: [id], onUpdate: Restrict, map: "competence_assignment_ibfk_1")
  127. learning_map_level learning_map_level @relation(fields: [learning_map_level_id], references: [id], onUpdate: Restrict, map: "competence_assignment_ibfk_2")
  128. competence competence @relation(fields: [competence_id], references: [id], onUpdate: Restrict, map: "competence_assignment_ibfk_3")
  129.  
  130. @@index([competence_id], map: "competence_id")
  131. @@index([learning_map_area_id], map: "learning_map_area_id")
  132. @@index([learning_map_level_id], map: "learning_map_level_id")
  133. }
  134.  
  135. model learning_map_area {
  136. id Int @id @default(autoincrement())
  137. learning_map_id Int
  138. area_id Int
  139. learning_map learning_map @relation(fields: [learning_map_id], references: [id], onUpdate: Restrict, map: "learning_map_area_ibfk_1")
  140. area area @relation(fields: [area_id], references: [id], onUpdate: Restrict, map: "learning_map_area_ibfk_2")
  141. area_group_area area_group_area[]
  142. competence_assignment competence_assignment[]
  143. skill_assignment skill_assignment[]
  144.  
  145. @@index([learning_map_id], map: "learning_map_id")
  146. @@index([area_id], map: "area_id")
  147. }
  148.  
  149. model learning_map_area_group {
  150. id Int @id @default(autoincrement())
  151. learning_map_id Int
  152. area_group_id Int
  153. learning_map learning_map @relation(fields: [learning_map_id], references: [id], onUpdate: Restrict, map: "learning_map_area_group_ibfk_1")
  154. area_group area_group @relation(fields: [area_group_id], references: [id], onUpdate: Restrict, map: "learning_map_area_group_ibfk_2")
  155.  
  156. @@index([area_group_id], map: "area_group_id")
  157. @@index([learning_map_id], map: "learning_map_id")
  158. }
  159.  
  160. model learning_map_level {
  161. id Int @id @default(autoincrement())
  162. learning_map_id Int
  163. level_id Int
  164. learning_map learning_map @relation(fields: [learning_map_id], references: [id], onUpdate: Restrict, map: "learning_map_level_ibfk_1")
  165. level level @relation(fields: [level_id], references: [id], onUpdate: Restrict, map: "learning_map_level_ibfk_2")
  166. competence_assignment competence_assignment[]
  167. skill_assignment skill_assignment[]
  168.  
  169. @@index([learning_map_id], map: "learning_map_id")
  170. @@index([level_id], map: "level_id")
  171. }
  172.  
  173. model skill {
  174. id Int @id @default(autoincrement())
  175. external_id Int @unique
  176. name String @db.VarChar(255)
  177. status Int
  178. competence_id Int
  179. created_at DateTime @default(now()) @db.DateTime(0)
  180. deleted_at DateTime @default(now()) @db.DateTime(0)
  181. updated_at DateTime @default(now()) @db.DateTime(0)
  182. competence competence @relation(fields: [competence_id], references: [id], onUpdate: Restrict, map: "skill_ibfk_1")
  183. skill_assignment skill_assignment[]
  184.  
  185. @@index([competence_id], map: "competence_id")
  186. }
  187.  
  188. model skill_assignment {
  189. id Int @id @default(autoincrement())
  190. learning_map_area_id Int
  191. learning_map_level_id Int
  192. skill_id Int
  193. created_at DateTime @default(now()) @db.DateTime(0)
  194. deleted_at DateTime @default(now()) @db.DateTime(0)
  195. updated_at DateTime @default(now()) @db.DateTime(0)
  196. learning_map_area learning_map_area @relation(fields: [learning_map_area_id], references: [id], onUpdate: Restrict, map: "skill_assignment_ibfk_1")
  197. learning_map_level learning_map_level @relation(fields: [learning_map_level_id], references: [id], onUpdate: Restrict, map: "skill_assignment_ibfk_2")
  198. skill skill @relation(fields: [skill_id], references: [id], onUpdate: Restrict, map: "skill_assignment_ibfk_3")
  199.  
  200. @@index([learning_map_area_id], map: "learning_map_area_id")
  201. @@index([learning_map_level_id], map: "learning_map_level_id")
  202. @@index([skill_id], map: "skill_id")
  203. }
  204.  
  205. // model skill_competence {
  206. // id Int @id @default(autoincrement())
  207. // skill_id Int
  208. // competence_id Int
  209. // created_at DateTime @default(now()) @db.DateTime(0)
  210. // deleted_at DateTime @default(now()) @db.DateTime(0)
  211. // updated_at DateTime @default(now()) @db.DateTime(0)
  212. // skill skill @relation(fields: [skill_id], references: [id], onUpdate: Restrict, map: "skill_competence_ibfk_1")
  213. // competence competence @relation(fields: [competence_id], references: [id], onUpdate: Restrict, map: "skill_competence_ibfk_2")
  214.  
  215. // @@index([competence_id], map: "competence_id")
  216. // @@index([skill_id], map: "skill_id")
  217. // }
  218.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement