@coursebuilder/adapter-drizzle 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/dist/{chunk-57CX5SOI.js → chunk-2UU2F4DM.js} +5 -4
  2. package/dist/{chunk-V23SCQL7.js → chunk-3NUCFLQJ.js} +2 -2
  3. package/dist/{chunk-Y7QZGEPT.js → chunk-4ZWS76VQ.js} +2 -2
  4. package/dist/{chunk-PPBEA4EM.js → chunk-6ON2O6UD.js} +2 -2
  5. package/dist/{chunk-QY4TPO7D.js → chunk-BM5UKWXI.js} +3 -3
  6. package/dist/{chunk-QMDE6HUA.js → chunk-CQNKTFXE.js} +3 -3
  7. package/dist/{chunk-4PJWD6YK.js → chunk-FRA4ZCRA.js} +462 -336
  8. package/dist/{chunk-J4LBG2TH.js → chunk-GINRTL6J.js} +2 -2
  9. package/dist/chunk-JZQ666KH.js +62 -0
  10. package/dist/{chunk-GLPDG7UE.js → chunk-KDEWFXEP.js} +2 -2
  11. package/dist/{chunk-MBB4GIJI.js → chunk-LERR6HQ3.js} +2 -2
  12. package/dist/{chunk-VDVCCU7D.js → chunk-LZHZDFNZ.js} +2 -2
  13. package/dist/{chunk-MCARHGE5.js → chunk-O6JECJRY.js} +4 -4
  14. package/dist/{chunk-BX5SO2JG.js → chunk-P4VXXTVA.js} +2 -2
  15. package/dist/{chunk-VXZRMVNY.js → chunk-QP6YMUQX.js} +2 -2
  16. package/dist/chunk-QTGVGIRO.js +54 -0
  17. package/dist/{chunk-ZD3R6UPJ.js → chunk-SRTIWWLG.js} +7 -7
  18. package/dist/{chunk-PIQXK2CY.js → chunk-TBM3AK3P.js} +3 -3
  19. package/dist/{chunk-FNYW3XKR.js → chunk-XIGJFVUM.js} +8 -8
  20. package/dist/{chunk-JKOYOL7A.js → chunk-YGRYHMCG.js} +2 -2
  21. package/dist/chunk-YVVXDJHI.js +56 -0
  22. package/dist/{chunk-J63FMGT7.js → chunk-Z245DYMP.js} +314 -190
  23. package/dist/index.js +22 -19
  24. package/dist/lib/mysql/index.cjs +1144 -774
  25. package/dist/lib/mysql/index.cjs.map +1 -1
  26. package/dist/lib/mysql/index.d.cts +2064 -1148
  27. package/dist/lib/mysql/index.d.ts +2064 -1148
  28. package/dist/lib/mysql/index.js +22 -19
  29. package/dist/lib/mysql/schemas/auth/accounts.cjs +85 -77
  30. package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
  31. package/dist/lib/mysql/schemas/auth/accounts.d.cts +17 -17
  32. package/dist/lib/mysql/schemas/auth/accounts.d.ts +17 -17
  33. package/dist/lib/mysql/schemas/auth/accounts.js +12 -12
  34. package/dist/lib/mysql/schemas/auth/device-access-token.cjs +214 -0
  35. package/dist/lib/mysql/schemas/auth/device-access-token.cjs.map +1 -0
  36. package/dist/lib/mysql/schemas/auth/device-access-token.d.cts +52 -0
  37. package/dist/lib/mysql/schemas/auth/device-access-token.d.ts +52 -0
  38. package/dist/lib/mysql/schemas/auth/device-access-token.js +22 -0
  39. package/dist/lib/mysql/schemas/auth/device-access-token.js.map +1 -0
  40. package/dist/lib/mysql/schemas/auth/device-verification.cjs +222 -0
  41. package/dist/lib/mysql/schemas/auth/device-verification.cjs.map +1 -0
  42. package/dist/lib/mysql/schemas/auth/device-verification.d.cts +88 -0
  43. package/dist/lib/mysql/schemas/auth/device-verification.d.ts +88 -0
  44. package/dist/lib/mysql/schemas/auth/device-verification.js +22 -0
  45. package/dist/lib/mysql/schemas/auth/device-verification.js.map +1 -0
  46. package/dist/lib/mysql/schemas/auth/permissions.cjs +1 -1
  47. package/dist/lib/mysql/schemas/auth/permissions.cjs.map +1 -1
  48. package/dist/lib/mysql/schemas/auth/permissions.d.cts +9 -9
  49. package/dist/lib/mysql/schemas/auth/permissions.d.ts +9 -9
  50. package/dist/lib/mysql/schemas/auth/permissions.js +1 -1
  51. package/dist/lib/mysql/schemas/auth/role-permissions.cjs +74 -66
  52. package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
  53. package/dist/lib/mysql/schemas/auth/role-permissions.d.cts +10 -10
  54. package/dist/lib/mysql/schemas/auth/role-permissions.d.ts +10 -10
  55. package/dist/lib/mysql/schemas/auth/role-permissions.js +13 -13
  56. package/dist/lib/mysql/schemas/auth/roles.cjs +72 -64
  57. package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
  58. package/dist/lib/mysql/schemas/auth/roles.d.cts +10 -10
  59. package/dist/lib/mysql/schemas/auth/roles.d.ts +10 -10
  60. package/dist/lib/mysql/schemas/auth/roles.js +12 -12
  61. package/dist/lib/mysql/schemas/auth/sessions.cjs +75 -67
  62. package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
  63. package/dist/lib/mysql/schemas/auth/sessions.d.cts +6 -6
  64. package/dist/lib/mysql/schemas/auth/sessions.d.ts +6 -6
  65. package/dist/lib/mysql/schemas/auth/sessions.js +13 -13
  66. package/dist/lib/mysql/schemas/auth/user-permissions.cjs +77 -69
  67. package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
  68. package/dist/lib/mysql/schemas/auth/user-permissions.d.cts +10 -10
  69. package/dist/lib/mysql/schemas/auth/user-permissions.d.ts +10 -10
  70. package/dist/lib/mysql/schemas/auth/user-permissions.js +12 -12
  71. package/dist/lib/mysql/schemas/auth/user-prefs.cjs +222 -0
  72. package/dist/lib/mysql/schemas/auth/user-prefs.cjs.map +1 -0
  73. package/dist/lib/mysql/schemas/auth/user-prefs.d.cts +100 -0
  74. package/dist/lib/mysql/schemas/auth/user-prefs.d.ts +100 -0
  75. package/dist/lib/mysql/schemas/auth/user-prefs.js +21 -0
  76. package/dist/lib/mysql/schemas/auth/user-prefs.js.map +1 -0
  77. package/dist/lib/mysql/schemas/auth/user-roles.cjs +77 -69
  78. package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
  79. package/dist/lib/mysql/schemas/auth/user-roles.d.cts +10 -10
  80. package/dist/lib/mysql/schemas/auth/user-roles.d.ts +10 -10
  81. package/dist/lib/mysql/schemas/auth/user-roles.js +12 -12
  82. package/dist/lib/mysql/schemas/auth/users.cjs +263 -180
  83. package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
  84. package/dist/lib/mysql/schemas/auth/users.d.cts +35 -21
  85. package/dist/lib/mysql/schemas/auth/users.d.ts +35 -21
  86. package/dist/lib/mysql/schemas/auth/users.js +12 -12
  87. package/dist/lib/mysql/schemas/auth/verification-tokens.cjs +1 -1
  88. package/dist/lib/mysql/schemas/auth/verification-tokens.cjs.map +1 -1
  89. package/dist/lib/mysql/schemas/auth/verification-tokens.d.cts +5 -5
  90. package/dist/lib/mysql/schemas/auth/verification-tokens.d.ts +5 -5
  91. package/dist/lib/mysql/schemas/auth/verification-tokens.js +1 -1
  92. package/dist/lib/mysql/schemas/commerce/coupon.cjs +75 -65
  93. package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
  94. package/dist/lib/mysql/schemas/commerce/coupon.d.cts +19 -19
  95. package/dist/lib/mysql/schemas/commerce/coupon.d.ts +19 -19
  96. package/dist/lib/mysql/schemas/commerce/coupon.js +12 -12
  97. package/dist/lib/mysql/schemas/commerce/merchant-account.cjs +1 -1
  98. package/dist/lib/mysql/schemas/commerce/merchant-account.cjs.map +1 -1
  99. package/dist/lib/mysql/schemas/commerce/merchant-account.d.cts +6 -6
  100. package/dist/lib/mysql/schemas/commerce/merchant-account.d.ts +6 -6
  101. package/dist/lib/mysql/schemas/commerce/merchant-account.js +1 -1
  102. package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs +6 -5
  103. package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs.map +1 -1
  104. package/dist/lib/mysql/schemas/commerce/merchant-charge.d.cts +13 -13
  105. package/dist/lib/mysql/schemas/commerce/merchant-charge.d.ts +13 -13
  106. package/dist/lib/mysql/schemas/commerce/merchant-charge.js +4 -4
  107. package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs +1 -1
  108. package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs.map +1 -1
  109. package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.cts +7 -7
  110. package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.ts +7 -7
  111. package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +1 -1
  112. package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs +3 -2
  113. package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs.map +1 -1
  114. package/dist/lib/mysql/schemas/commerce/merchant-customer.d.cts +7 -7
  115. package/dist/lib/mysql/schemas/commerce/merchant-customer.d.ts +7 -7
  116. package/dist/lib/mysql/schemas/commerce/merchant-customer.js +1 -1
  117. package/dist/lib/mysql/schemas/commerce/merchant-price.cjs +1 -1
  118. package/dist/lib/mysql/schemas/commerce/merchant-price.cjs.map +1 -1
  119. package/dist/lib/mysql/schemas/commerce/merchant-price.d.cts +8 -8
  120. package/dist/lib/mysql/schemas/commerce/merchant-price.d.ts +8 -8
  121. package/dist/lib/mysql/schemas/commerce/merchant-price.js +1 -1
  122. package/dist/lib/mysql/schemas/commerce/merchant-product.cjs +1 -1
  123. package/dist/lib/mysql/schemas/commerce/merchant-product.cjs.map +1 -1
  124. package/dist/lib/mysql/schemas/commerce/merchant-product.d.cts +7 -7
  125. package/dist/lib/mysql/schemas/commerce/merchant-product.d.ts +7 -7
  126. package/dist/lib/mysql/schemas/commerce/merchant-product.js +1 -1
  127. package/dist/lib/mysql/schemas/commerce/merchant-session.cjs +1 -1
  128. package/dist/lib/mysql/schemas/commerce/merchant-session.cjs.map +1 -1
  129. package/dist/lib/mysql/schemas/commerce/merchant-session.d.cts +4 -4
  130. package/dist/lib/mysql/schemas/commerce/merchant-session.d.ts +4 -4
  131. package/dist/lib/mysql/schemas/commerce/merchant-session.js +1 -1
  132. package/dist/lib/mysql/schemas/commerce/price.cjs +60 -52
  133. package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
  134. package/dist/lib/mysql/schemas/commerce/price.d.cts +11 -11
  135. package/dist/lib/mysql/schemas/commerce/price.d.ts +11 -11
  136. package/dist/lib/mysql/schemas/commerce/price.js +12 -12
  137. package/dist/lib/mysql/schemas/commerce/product.cjs +75 -67
  138. package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
  139. package/dist/lib/mysql/schemas/commerce/product.d.cts +13 -13
  140. package/dist/lib/mysql/schemas/commerce/product.d.ts +13 -13
  141. package/dist/lib/mysql/schemas/commerce/product.js +12 -12
  142. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +105 -96
  143. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
  144. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.cts +15 -15
  145. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.ts +15 -15
  146. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +13 -13
  147. package/dist/lib/mysql/schemas/commerce/purchase.cjs +138 -128
  148. package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
  149. package/dist/lib/mysql/schemas/commerce/purchase.d.cts +25 -25
  150. package/dist/lib/mysql/schemas/commerce/purchase.d.ts +25 -25
  151. package/dist/lib/mysql/schemas/commerce/purchase.js +12 -12
  152. package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs +66 -58
  153. package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs.map +1 -1
  154. package/dist/lib/mysql/schemas/commerce/upgradable-products.d.cts +11 -11
  155. package/dist/lib/mysql/schemas/commerce/upgradable-products.d.ts +11 -11
  156. package/dist/lib/mysql/schemas/commerce/upgradable-products.js +13 -13
  157. package/dist/lib/mysql/schemas/communication/comment.cjs +220 -0
  158. package/dist/lib/mysql/schemas/communication/comment.cjs.map +1 -0
  159. package/dist/lib/mysql/schemas/communication/comment.d.cts +100 -0
  160. package/dist/lib/mysql/schemas/communication/comment.d.ts +100 -0
  161. package/dist/lib/mysql/schemas/communication/comment.js +21 -0
  162. package/dist/lib/mysql/schemas/communication/comment.js.map +1 -0
  163. package/dist/lib/mysql/schemas/communication/communication-channel.cjs +1 -1
  164. package/dist/lib/mysql/schemas/communication/communication-channel.cjs.map +1 -1
  165. package/dist/lib/mysql/schemas/communication/communication-channel.d.cts +8 -8
  166. package/dist/lib/mysql/schemas/communication/communication-channel.d.ts +8 -8
  167. package/dist/lib/mysql/schemas/communication/communication-channel.js +1 -1
  168. package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs +1 -1
  169. package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs.map +1 -1
  170. package/dist/lib/mysql/schemas/communication/communication-preference-types.d.cts +8 -8
  171. package/dist/lib/mysql/schemas/communication/communication-preference-types.d.ts +8 -8
  172. package/dist/lib/mysql/schemas/communication/communication-preference-types.js +1 -1
  173. package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +99 -91
  174. package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
  175. package/dist/lib/mysql/schemas/communication/communication-preferences.d.cts +16 -16
  176. package/dist/lib/mysql/schemas/communication/communication-preferences.d.ts +16 -16
  177. package/dist/lib/mysql/schemas/communication/communication-preferences.js +12 -12
  178. package/dist/lib/mysql/schemas/content/content-contributions.cjs +67 -59
  179. package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
  180. package/dist/lib/mysql/schemas/content/content-contributions.d.cts +13 -13
  181. package/dist/lib/mysql/schemas/content/content-contributions.d.ts +13 -13
  182. package/dist/lib/mysql/schemas/content/content-contributions.js +12 -12
  183. package/dist/lib/mysql/schemas/content/content-resource-product.cjs +61 -53
  184. package/dist/lib/mysql/schemas/content/content-resource-product.cjs.map +1 -1
  185. package/dist/lib/mysql/schemas/content/content-resource-product.d.cts +11 -11
  186. package/dist/lib/mysql/schemas/content/content-resource-product.d.ts +11 -11
  187. package/dist/lib/mysql/schemas/content/content-resource-product.js +12 -12
  188. package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +58 -50
  189. package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
  190. package/dist/lib/mysql/schemas/content/content-resource-resource.d.cts +11 -11
  191. package/dist/lib/mysql/schemas/content/content-resource-resource.d.ts +11 -11
  192. package/dist/lib/mysql/schemas/content/content-resource-resource.js +12 -12
  193. package/dist/lib/mysql/schemas/content/content-resource.cjs +114 -66
  194. package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
  195. package/dist/lib/mysql/schemas/content/content-resource.d.cts +14 -13
  196. package/dist/lib/mysql/schemas/content/content-resource.d.ts +14 -13
  197. package/dist/lib/mysql/schemas/content/content-resource.js +12 -12
  198. package/dist/lib/mysql/schemas/content/contribution-types.cjs +1 -1
  199. package/dist/lib/mysql/schemas/content/contribution-types.cjs.map +1 -1
  200. package/dist/lib/mysql/schemas/content/contribution-types.d.cts +10 -10
  201. package/dist/lib/mysql/schemas/content/contribution-types.d.ts +10 -10
  202. package/dist/lib/mysql/schemas/content/contribution-types.js +1 -1
  203. package/dist/lib/mysql/schemas/content/lesson-progress.cjs +77 -0
  204. package/dist/lib/mysql/schemas/content/lesson-progress.cjs.map +1 -0
  205. package/dist/lib/mysql/schemas/content/lesson-progress.d.cts +132 -0
  206. package/dist/lib/mysql/schemas/content/lesson-progress.d.ts +132 -0
  207. package/dist/lib/mysql/schemas/content/lesson-progress.js +8 -0
  208. package/dist/lib/mysql/schemas/content/lesson-progress.js.map +1 -0
  209. package/dist/lib/mysql/schemas/content/resource-progress.cjs +7 -7
  210. package/dist/lib/mysql/schemas/content/resource-progress.cjs.map +1 -1
  211. package/dist/lib/mysql/schemas/content/resource-progress.d.cts +9 -9
  212. package/dist/lib/mysql/schemas/content/resource-progress.d.ts +9 -9
  213. package/dist/lib/mysql/schemas/content/resource-progress.js +1 -1
  214. package/package.json +5 -5
  215. package/src/lib/mysql/index.ts +186 -54
  216. package/src/lib/mysql/schemas/auth/accounts.ts +1 -1
  217. package/src/lib/mysql/schemas/auth/device-access-token.ts +40 -0
  218. package/src/lib/mysql/schemas/auth/device-verification.ts +48 -0
  219. package/src/lib/mysql/schemas/auth/permissions.ts +1 -1
  220. package/src/lib/mysql/schemas/auth/role-permissions.ts +1 -1
  221. package/src/lib/mysql/schemas/auth/roles.ts +1 -1
  222. package/src/lib/mysql/schemas/auth/sessions.ts +1 -1
  223. package/src/lib/mysql/schemas/auth/user-permissions.ts +1 -1
  224. package/src/lib/mysql/schemas/auth/user-prefs.ts +52 -0
  225. package/src/lib/mysql/schemas/auth/user-roles.ts +1 -1
  226. package/src/lib/mysql/schemas/auth/users.ts +14 -2
  227. package/src/lib/mysql/schemas/auth/verification-tokens.ts +1 -1
  228. package/src/lib/mysql/schemas/commerce/coupon.ts +6 -4
  229. package/src/lib/mysql/schemas/commerce/merchant-account.ts +1 -1
  230. package/src/lib/mysql/schemas/commerce/merchant-charge.ts +1 -1
  231. package/src/lib/mysql/schemas/commerce/merchant-coupon.ts +1 -1
  232. package/src/lib/mysql/schemas/commerce/merchant-customer.ts +3 -1
  233. package/src/lib/mysql/schemas/commerce/merchant-price.ts +1 -1
  234. package/src/lib/mysql/schemas/commerce/merchant-product.ts +1 -1
  235. package/src/lib/mysql/schemas/commerce/merchant-session.ts +1 -1
  236. package/src/lib/mysql/schemas/commerce/price.ts +1 -1
  237. package/src/lib/mysql/schemas/commerce/product.ts +1 -1
  238. package/src/lib/mysql/schemas/commerce/purchase-user-transfer.ts +1 -1
  239. package/src/lib/mysql/schemas/commerce/purchase.ts +5 -4
  240. package/src/lib/mysql/schemas/commerce/upgradable-products.ts +1 -1
  241. package/src/lib/mysql/schemas/communication/comment.ts +52 -0
  242. package/src/lib/mysql/schemas/communication/communication-channel.ts +1 -1
  243. package/src/lib/mysql/schemas/communication/communication-preference-types.ts +1 -1
  244. package/src/lib/mysql/schemas/communication/communication-preferences.ts +1 -1
  245. package/src/lib/mysql/schemas/content/content-contributions.ts +1 -1
  246. package/src/lib/mysql/schemas/content/content-resource-product.ts +1 -1
  247. package/src/lib/mysql/schemas/content/content-resource-resource.ts +1 -1
  248. package/src/lib/mysql/schemas/content/content-resource.ts +6 -2
  249. package/src/lib/mysql/schemas/content/contribution-types.ts +1 -1
  250. package/src/lib/mysql/schemas/content/lesson-progress.ts +39 -0
  251. package/src/lib/mysql/schemas/content/resource-progress.ts +6 -8
@@ -1,64 +1,68 @@
1
1
  import {
2
2
  getContributionTypesSchema
3
- } from "./chunk-GLPDG7UE.js";
3
+ } from "./chunk-KDEWFXEP.js";
4
4
  import {
5
5
  getCommunicationChannelSchema
6
- } from "./chunk-J4LBG2TH.js";
6
+ } from "./chunk-GINRTL6J.js";
7
7
  import {
8
8
  getCommunicationPreferenceTypesSchema
9
- } from "./chunk-BX5SO2JG.js";
9
+ } from "./chunk-P4VXXTVA.js";
10
+ import {
11
+ getMerchantChargeSchema
12
+ } from "./chunk-SRTIWWLG.js";
10
13
  import {
11
14
  getMerchantCouponSchema
12
- } from "./chunk-JKOYOL7A.js";
15
+ } from "./chunk-YGRYHMCG.js";
13
16
  import {
14
17
  getMerchantPriceSchema
15
- } from "./chunk-PPBEA4EM.js";
16
- import {
17
- getMerchantSessionSchema
18
- } from "./chunk-V23SCQL7.js";
19
- import {
20
- getMerchantChargeSchema
21
- } from "./chunk-ZD3R6UPJ.js";
18
+ } from "./chunk-6ON2O6UD.js";
22
19
  import {
23
20
  getMerchantProductSchema
24
- } from "./chunk-Y7QZGEPT.js";
21
+ } from "./chunk-4ZWS76VQ.js";
22
+ import {
23
+ getMerchantSessionSchema
24
+ } from "./chunk-3NUCFLQJ.js";
25
25
  import {
26
26
  getPermissionsSchema
27
- } from "./chunk-VDVCCU7D.js";
27
+ } from "./chunk-LZHZDFNZ.js";
28
28
  import {
29
29
  __name
30
30
  } from "./chunk-H736K5TN.js";
31
31
 
32
- // src/lib/mysql/schemas/content/content-resource-resource.ts
33
- import { relations as relations14, sql as sql8 } from "drizzle-orm";
34
- import { double as double2, index as index10, json as json7, primaryKey as primaryKey9, timestamp as timestamp13, varchar as varchar14 } from "drizzle-orm/mysql-core";
35
-
36
- // src/lib/mysql/schemas/content/content-resource.ts
37
- import { relations as relations13, sql as sql7 } from "drizzle-orm";
38
- import { index as index9, json as json6, timestamp as timestamp12, varchar as varchar13 } from "drizzle-orm/mysql-core";
32
+ // src/lib/mysql/schemas/content/content-contributions.ts
33
+ import { relations as relations16 } from "drizzle-orm";
34
+ import { boolean as boolean6, index as index14, timestamp as timestamp15, varchar as varchar16 } from "drizzle-orm/mysql-core";
39
35
 
40
36
  // src/lib/mysql/schemas/auth/users.ts
41
- import { relations as relations12, sql as sql6 } from "drizzle-orm";
42
- import { index as index8, mysqlEnum as mysqlEnum2, timestamp as timestamp11, varchar as varchar12 } from "drizzle-orm/mysql-core";
37
+ import { relations as relations15, sql as sql10 } from "drizzle-orm";
38
+ import { index as index13, json as json10, timestamp as timestamp14, varchar as varchar15 } from "drizzle-orm/mysql-core";
43
39
 
44
40
  // src/lib/mysql/schemas/commerce/purchase.ts
45
- import { relations as relations5, sql as sql5 } from "drizzle-orm";
46
- import { decimal as decimal3, json as json5, primaryKey as primaryKey5, timestamp as timestamp5, unique as unique2, varchar as varchar5 } from "drizzle-orm/mysql-core";
41
+ import { relations as relations7, sql as sql7 } from "drizzle-orm";
42
+ import { decimal as decimal3, index as index5, json as json7, primaryKey as primaryKey6, timestamp as timestamp7, unique as unique2, varchar as varchar7 } from "drizzle-orm/mysql-core";
47
43
 
48
44
  // src/lib/mysql/schemas/commerce/coupon.ts
49
- import { relations as relations4, sql as sql4 } from "drizzle-orm";
50
- import { boolean, decimal as decimal2, int as int3, json as json4, primaryKey as primaryKey4, timestamp as timestamp4, unique, varchar as varchar4 } from "drizzle-orm/mysql-core";
45
+ import { relations as relations6, sql as sql6 } from "drizzle-orm";
46
+ import { boolean, decimal as decimal2, index as index4, int as int3, json as json6, primaryKey as primaryKey5, timestamp as timestamp6, unique, varchar as varchar6 } from "drizzle-orm/mysql-core";
51
47
 
52
48
  // src/lib/mysql/schemas/commerce/product.ts
53
- import { relations as relations3, sql as sql3 } from "drizzle-orm";
54
- import { int as int2, json as json3, primaryKey as primaryKey3, timestamp as timestamp3, varchar as varchar3 } from "drizzle-orm/mysql-core";
49
+ import { relations as relations5, sql as sql5 } from "drizzle-orm";
50
+ import { int as int2, json as json5, primaryKey as primaryKey4, timestamp as timestamp5, varchar as varchar5 } from "drizzle-orm/mysql-core";
55
51
 
56
52
  // src/lib/mysql/schemas/content/content-resource-product.ts
53
+ import { relations as relations3, sql as sql3 } from "drizzle-orm";
54
+ import { double as double2, index as index3, json as json3, primaryKey as primaryKey2, timestamp as timestamp3, varchar as varchar3 } from "drizzle-orm/mysql-core";
55
+
56
+ // src/lib/mysql/schemas/content/content-resource.ts
57
+ import { relations as relations2, sql as sql2 } from "drizzle-orm";
58
+ import { index as index2, json as json2, timestamp as timestamp2, varchar as varchar2 } from "drizzle-orm/mysql-core";
59
+
60
+ // src/lib/mysql/schemas/content/content-resource-resource.ts
57
61
  import { relations, sql } from "drizzle-orm";
58
62
  import { double, index, json, primaryKey, timestamp, varchar } from "drizzle-orm/mysql-core";
59
- function getContentResourceProductSchema(mysqlTable) {
60
- return mysqlTable("contentResourceProduct", {
61
- productId: varchar("productId", {
63
+ function getContentResourceResourceSchema(mysqlTable) {
64
+ return mysqlTable("ContentResourceResource", {
65
+ resourceOfId: varchar("resourceOfId", {
62
66
  length: 255
63
67
  }).notNull(),
64
68
  resourceId: varchar("resourceId", {
@@ -81,20 +85,145 @@ function getContentResourceProductSchema(mysqlTable) {
81
85
  }, (crr) => ({
82
86
  pk: primaryKey({
83
87
  columns: [
84
- crr.productId,
88
+ crr.resourceOfId,
85
89
  crr.resourceId
86
90
  ]
87
91
  }),
88
- contentResourceIdIdx: index("contentResourceId_idx").on(crr.productId),
92
+ contentResourceIdIdx: index("contentResourceId_idx").on(crr.resourceOfId),
89
93
  resourceIdIdx: index("resourceId_idx").on(crr.resourceId)
90
94
  }));
91
95
  }
96
+ __name(getContentResourceResourceSchema, "getContentResourceResourceSchema");
97
+ function getContentResourceResourceRelationsSchema(mysqlTable) {
98
+ const contentResource = getContentResourceSchema(mysqlTable);
99
+ const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
100
+ return relations(contentResourceResource, ({ one }) => ({
101
+ resourceOf: one(contentResource, {
102
+ fields: [
103
+ contentResourceResource.resourceOfId
104
+ ],
105
+ references: [
106
+ contentResource.id
107
+ ],
108
+ relationName: "resourceOf"
109
+ }),
110
+ resource: one(contentResource, {
111
+ fields: [
112
+ contentResourceResource.resourceId
113
+ ],
114
+ references: [
115
+ contentResource.id
116
+ ],
117
+ relationName: "resource"
118
+ })
119
+ }));
120
+ }
121
+ __name(getContentResourceResourceRelationsSchema, "getContentResourceResourceRelationsSchema");
122
+
123
+ // src/lib/mysql/schemas/content/content-resource.ts
124
+ function getContentResourceSchema(mysqlTable) {
125
+ return mysqlTable("ContentResource", {
126
+ id: varchar2("id", {
127
+ length: 255
128
+ }).notNull().primaryKey(),
129
+ type: varchar2("type", {
130
+ length: 255
131
+ }).notNull(),
132
+ createdById: varchar2("createdById", {
133
+ length: 255
134
+ }).notNull(),
135
+ fields: json2("fields").$type().default({}),
136
+ createdAt: timestamp2("createdAt", {
137
+ mode: "date",
138
+ fsp: 3
139
+ }).default(sql2`CURRENT_TIMESTAMP(3)`),
140
+ updatedAt: timestamp2("updatedAt", {
141
+ mode: "date",
142
+ fsp: 3
143
+ }).default(sql2`CURRENT_TIMESTAMP(3)`),
144
+ deletedAt: timestamp2("deletedAt", {
145
+ mode: "date",
146
+ fsp: 3
147
+ })
148
+ }, (cm) => ({
149
+ typeIdx: index2("type_idx").on(cm.type),
150
+ createdByIdx: index2("createdById_idx").on(cm.createdById),
151
+ createdAtIdx: index2("createdAt_idx").on(cm.createdAt)
152
+ }));
153
+ }
154
+ __name(getContentResourceSchema, "getContentResourceSchema");
155
+ function getContentResourceRelationsSchema(mysqlTable) {
156
+ const contentResource = getContentResourceSchema(mysqlTable);
157
+ const users = getUsersSchema(mysqlTable);
158
+ const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
159
+ const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
160
+ const contentContributions = getContentContributionsSchema(mysqlTable);
161
+ return relations2(contentResource, ({ one, many }) => ({
162
+ createdBy: one(users, {
163
+ fields: [
164
+ contentResource.createdById
165
+ ],
166
+ references: [
167
+ users.id
168
+ ],
169
+ relationName: "creator"
170
+ }),
171
+ resources: many(contentResourceResource, {
172
+ relationName: "resourceOf"
173
+ }),
174
+ resourceOf: many(contentResourceResource, {
175
+ relationName: "resource"
176
+ }),
177
+ resourceProducts: many(contentResourceProduct, {
178
+ relationName: "resource"
179
+ }),
180
+ contributions: many(contentContributions, {
181
+ relationName: "contributions"
182
+ })
183
+ }));
184
+ }
185
+ __name(getContentResourceRelationsSchema, "getContentResourceRelationsSchema");
186
+
187
+ // src/lib/mysql/schemas/content/content-resource-product.ts
188
+ function getContentResourceProductSchema(mysqlTable) {
189
+ return mysqlTable("ContentResourceProduct", {
190
+ productId: varchar3("productId", {
191
+ length: 255
192
+ }).notNull(),
193
+ resourceId: varchar3("resourceId", {
194
+ length: 255
195
+ }).notNull(),
196
+ position: double2("position").notNull().default(0),
197
+ metadata: json3("metadata").$type().default({}),
198
+ createdAt: timestamp3("createdAt", {
199
+ mode: "date",
200
+ fsp: 3
201
+ }).default(sql3`CURRENT_TIMESTAMP(3)`),
202
+ updatedAt: timestamp3("updatedAt", {
203
+ mode: "date",
204
+ fsp: 3
205
+ }).default(sql3`CURRENT_TIMESTAMP(3)`),
206
+ deletedAt: timestamp3("deletedAt", {
207
+ mode: "date",
208
+ fsp: 3
209
+ })
210
+ }, (crr) => ({
211
+ pk: primaryKey2({
212
+ columns: [
213
+ crr.productId,
214
+ crr.resourceId
215
+ ]
216
+ }),
217
+ contentResourceIdIdx: index3("contentResourceId_idx").on(crr.productId),
218
+ resourceIdIdx: index3("resourceId_idx").on(crr.resourceId)
219
+ }));
220
+ }
92
221
  __name(getContentResourceProductSchema, "getContentResourceProductSchema");
93
222
  function getContentResourceProductRelationsSchema(mysqlTable) {
94
223
  const contentResource = getContentResourceSchema(mysqlTable);
95
224
  const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
96
225
  const product = getProductSchema(mysqlTable);
97
- return relations(contentResourceProduct, ({ one }) => ({
226
+ return relations3(contentResourceProduct, ({ one }) => ({
98
227
  product: one(product, {
99
228
  fields: [
100
229
  contentResourceProduct.productId
@@ -118,17 +247,17 @@ function getContentResourceProductRelationsSchema(mysqlTable) {
118
247
  __name(getContentResourceProductRelationsSchema, "getContentResourceProductRelationsSchema");
119
248
 
120
249
  // src/lib/mysql/schemas/commerce/price.ts
121
- import { relations as relations2, sql as sql2 } from "drizzle-orm";
122
- import { decimal, int, json as json2, primaryKey as primaryKey2, timestamp as timestamp2, varchar as varchar2 } from "drizzle-orm/mysql-core";
250
+ import { relations as relations4, sql as sql4 } from "drizzle-orm";
251
+ import { decimal, int, json as json4, primaryKey as primaryKey3, timestamp as timestamp4, varchar as varchar4 } from "drizzle-orm/mysql-core";
123
252
  function getPriceSchema(mysqlTable) {
124
- return mysqlTable("prices", {
125
- id: varchar2("id", {
253
+ return mysqlTable("Price", {
254
+ id: varchar4("id", {
126
255
  length: 191
127
256
  }).notNull(),
128
- productId: varchar2("productId", {
257
+ productId: varchar4("productId", {
129
258
  length: 191
130
259
  }),
131
- nickname: varchar2("nickname", {
260
+ nickname: varchar4("nickname", {
132
261
  length: 191
133
262
  }),
134
263
  status: int("status").default(0).notNull(),
@@ -136,14 +265,14 @@ function getPriceSchema(mysqlTable) {
136
265
  precision: 10,
137
266
  scale: 2
138
267
  }).notNull(),
139
- createdAt: timestamp2("createdAt", {
268
+ createdAt: timestamp4("createdAt", {
140
269
  mode: "date",
141
270
  fsp: 3
142
- }).default(sql2`CURRENT_TIMESTAMP(3)`).notNull(),
143
- fields: json2("fields").$type().default({})
271
+ }).default(sql4`CURRENT_TIMESTAMP(3)`).notNull(),
272
+ fields: json4("fields").$type().default({})
144
273
  }, (table) => {
145
274
  return {
146
- priceId: primaryKey2({
275
+ priceId: primaryKey3({
147
276
  columns: [
148
277
  table.id
149
278
  ],
@@ -157,7 +286,7 @@ function getProductRelationsSchema(mysqlTable) {
157
286
  const product = getProductSchema(mysqlTable);
158
287
  const price = getPriceSchema(mysqlTable);
159
288
  const merchantPrice = getMerchantPriceSchema(mysqlTable);
160
- return relations2(price, ({ one, many }) => ({
289
+ return relations4(price, ({ one, many }) => ({
161
290
  product: one(product, {
162
291
  fields: [
163
292
  price.productId
@@ -182,29 +311,29 @@ __name(getProductRelationsSchema, "getProductRelationsSchema");
182
311
 
183
312
  // src/lib/mysql/schemas/commerce/product.ts
184
313
  function getProductSchema(mysqlTable) {
185
- return mysqlTable("products", {
186
- id: varchar3("id", {
314
+ return mysqlTable("Product", {
315
+ id: varchar5("id", {
187
316
  length: 191
188
317
  }).notNull(),
189
- name: varchar3("name", {
318
+ name: varchar5("name", {
190
319
  length: 191
191
320
  }).notNull(),
192
- key: varchar3("key", {
321
+ key: varchar5("key", {
193
322
  length: 191
194
323
  }),
195
- type: varchar3("type", {
324
+ type: varchar5("type", {
196
325
  length: 191
197
326
  }),
198
- fields: json3("fields").$type().default({}),
199
- createdAt: timestamp3("createdAt", {
327
+ fields: json5("fields").$type().default({}),
328
+ createdAt: timestamp5("createdAt", {
200
329
  mode: "date",
201
330
  fsp: 3
202
- }).default(sql3`CURRENT_TIMESTAMP(3)`).notNull(),
331
+ }).default(sql5`CURRENT_TIMESTAMP(3)`).notNull(),
203
332
  status: int2("status").default(0).notNull(),
204
333
  quantityAvailable: int2("quantityAvailable").default(-1).notNull()
205
334
  }, (table) => {
206
335
  return {
207
- productId: primaryKey3({
336
+ productId: primaryKey4({
208
337
  columns: [
209
338
  table.id
210
339
  ],
@@ -219,7 +348,7 @@ function getProductRelationsSchema2(mysqlTable) {
219
348
  const price = getPriceSchema(mysqlTable);
220
349
  const merchantProduct = getMerchantProductSchema(mysqlTable);
221
350
  const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
222
- return relations3(product, ({ one, many }) => ({
351
+ return relations5(product, ({ one, many }) => ({
223
352
  price: one(price, {
224
353
  fields: [
225
354
  product.id
@@ -247,25 +376,25 @@ __name(getProductRelationsSchema2, "getProductRelationsSchema");
247
376
 
248
377
  // src/lib/mysql/schemas/commerce/coupon.ts
249
378
  function getCouponSchema(mysqlTable) {
250
- return mysqlTable("coupons", {
251
- id: varchar4("id", {
379
+ return mysqlTable("Coupon", {
380
+ id: varchar6("id", {
252
381
  length: 191
253
382
  }).notNull(),
254
- code: varchar4("code", {
383
+ code: varchar6("code", {
255
384
  length: 191
256
385
  }),
257
- createdAt: timestamp4("createdAt", {
386
+ createdAt: timestamp6("createdAt", {
258
387
  mode: "date",
259
388
  fsp: 3
260
- }).default(sql4`CURRENT_TIMESTAMP(3)`).notNull(),
261
- expires: timestamp4("expires", {
389
+ }).default(sql6`CURRENT_TIMESTAMP(3)`).notNull(),
390
+ expires: timestamp6("expires", {
262
391
  mode: "date",
263
392
  fsp: 3
264
393
  }),
265
- fields: json4("fields").$type().default({}),
394
+ fields: json6("fields").$type().default({}),
266
395
  maxUses: int3("maxUses").default(-1).notNull(),
267
396
  default: boolean("default").default(false).notNull(),
268
- merchantCouponId: varchar4("merchantCouponId", {
397
+ merchantCouponId: varchar6("merchantCouponId", {
269
398
  length: 191
270
399
  }),
271
400
  status: int3("status").default(0).notNull(),
@@ -274,15 +403,16 @@ function getCouponSchema(mysqlTable) {
274
403
  precision: 3,
275
404
  scale: 2
276
405
  }).notNull(),
277
- restrictedToProductId: varchar4("restrictedToProductId", {
406
+ restrictedToProductId: varchar6("restrictedToProductId", {
278
407
  length: 191
279
408
  }),
280
- bulkPurchaseId: varchar4("bulkPurchaseId", {
409
+ bulkPurchaseId: varchar6("bulkPurchaseId", {
281
410
  length: 191
282
411
  })
283
412
  }, (table) => {
284
413
  return {
285
- couponId: primaryKey4({
414
+ couponIdCodeIndex: index4("Coupon_id_code_index").on(table.id, table.code),
415
+ couponId: primaryKey5({
286
416
  columns: [
287
417
  table.id
288
418
  ],
@@ -298,7 +428,7 @@ function getCouponRelationsSchema(mysqlTable) {
298
428
  const purchase = getPurchaseSchema(mysqlTable);
299
429
  const coupon = getCouponSchema(mysqlTable);
300
430
  const merchantCoupon = getMerchantCouponSchema(mysqlTable);
301
- return relations4(coupon, ({ many, one }) => ({
431
+ return relations6(coupon, ({ many, one }) => ({
302
432
  bulkCouponPurchases: many(purchase, {
303
433
  relationName: "redeemedBulkCoupon"
304
434
  }),
@@ -335,66 +465,67 @@ __name(getCouponRelationsSchema, "getCouponRelationsSchema");
335
465
 
336
466
  // src/lib/mysql/schemas/commerce/purchase.ts
337
467
  function getPurchaseSchema(mysqlTable) {
338
- return mysqlTable("purchases", {
339
- id: varchar5("id", {
468
+ return mysqlTable("Purchase", {
469
+ id: varchar7("id", {
340
470
  length: 191
341
471
  }).notNull(),
342
- userId: varchar5("userId", {
472
+ userId: varchar7("userId", {
343
473
  length: 191
344
474
  }),
345
- createdAt: timestamp5("createdAt", {
475
+ createdAt: timestamp7("createdAt", {
346
476
  mode: "date",
347
477
  fsp: 3
348
- }).default(sql5`CURRENT_TIMESTAMP(3)`).notNull(),
478
+ }).default(sql7`CURRENT_TIMESTAMP(3)`).notNull(),
349
479
  totalAmount: decimal3("totalAmount", {
350
480
  precision: 65,
351
481
  scale: 30
352
482
  }).notNull(),
353
- ipAddress: varchar5("ip_address", {
483
+ ipAddress: varchar7("ip_address", {
354
484
  length: 191
355
485
  }),
356
- city: varchar5("city", {
486
+ city: varchar7("city", {
357
487
  length: 191
358
488
  }),
359
- state: varchar5("state", {
489
+ state: varchar7("state", {
360
490
  length: 191
361
491
  }),
362
- country: varchar5("country", {
492
+ country: varchar7("country", {
363
493
  length: 191
364
494
  }),
365
- couponId: varchar5("couponId", {
495
+ couponId: varchar7("couponId", {
366
496
  length: 191
367
497
  }),
368
- productId: varchar5("productId", {
498
+ productId: varchar7("productId", {
369
499
  length: 191
370
500
  }).notNull(),
371
- merchantChargeId: varchar5("merchantChargeId", {
501
+ merchantChargeId: varchar7("merchantChargeId", {
372
502
  length: 191
373
503
  }),
374
- upgradedFromId: varchar5("upgradedFromId", {
504
+ upgradedFromId: varchar7("upgradedFromId", {
375
505
  length: 191
376
506
  }),
377
- status: varchar5("status", {
507
+ status: varchar7("status", {
378
508
  length: 191
379
509
  }).default("Valid").notNull(),
380
- bulkCouponId: varchar5("bulkCouponId", {
510
+ bulkCouponId: varchar7("bulkCouponId", {
381
511
  length: 191
382
512
  }),
383
- merchantSessionId: varchar5("merchantSessionId", {
513
+ merchantSessionId: varchar7("merchantSessionId", {
384
514
  length: 191
385
515
  }),
386
- redeemedBulkCouponId: varchar5("redeemedBulkCouponId", {
516
+ redeemedBulkCouponId: varchar7("redeemedBulkCouponId", {
387
517
  length: 191
388
518
  }),
389
- fields: json5("fields").$type().default({})
519
+ fields: json7("fields").$type().default({})
390
520
  }, (table) => {
391
521
  return {
392
- purchaseId: primaryKey5({
522
+ purchaseId: primaryKey6({
393
523
  columns: [
394
524
  table.id
395
525
  ],
396
526
  name: "Purchase_id"
397
527
  }),
528
+ merchantChargeIdIdx: index5("idx_Purchase_on_merchantChargeId").on(table.merchantChargeId),
398
529
  purchaseUpgradedFromIdKey: unique2("Purchase_upgradedFromId_key").on(table.upgradedFromId)
399
530
  };
400
531
  });
@@ -407,7 +538,7 @@ function getPurchaseRelationsSchema(mysqlTable) {
407
538
  const merchantCharges = getMerchantChargeSchema(mysqlTable);
408
539
  const merchantSessions = getMerchantSessionSchema(mysqlTable);
409
540
  const coupons = getCouponSchema(mysqlTable);
410
- return relations5(purchases, ({ many, one }) => ({
541
+ return relations7(purchases, ({ many, one }) => ({
411
542
  redeemedBulkCoupon: one(coupons, {
412
543
  fields: [
413
544
  purchases.redeemedBulkCouponId
@@ -466,18 +597,70 @@ function getPurchaseRelationsSchema(mysqlTable) {
466
597
  }
467
598
  __name(getPurchaseRelationsSchema, "getPurchaseRelationsSchema");
468
599
 
600
+ // src/lib/mysql/schemas/communication/comment.ts
601
+ import { relations as relations8, sql as sql8 } from "drizzle-orm";
602
+ import { index as index6, json as json8, primaryKey as primaryKey7, text, timestamp as timestamp8, varchar as varchar8 } from "drizzle-orm/mysql-core";
603
+ function getCommentsSchema(mysqlTable) {
604
+ return mysqlTable("Comment", {
605
+ id: varchar8("id", {
606
+ length: 191
607
+ }).notNull(),
608
+ userId: varchar8("userId", {
609
+ length: 255
610
+ }).notNull(),
611
+ context: json8("context").$type().default({}),
612
+ text: text("text").notNull(),
613
+ createdAt: timestamp8("createdAt", {
614
+ mode: "date",
615
+ fsp: 3
616
+ }).default(sql8`CURRENT_TIMESTAMP(3)`),
617
+ updatedAt: timestamp8("updatedAt", {
618
+ mode: "date",
619
+ fsp: 3
620
+ }).default(sql8`CURRENT_TIMESTAMP(3)`),
621
+ deletedAt: timestamp8("deletedAt", {
622
+ mode: "date",
623
+ fsp: 3
624
+ })
625
+ }, (crr) => ({
626
+ pk: primaryKey7({
627
+ columns: [
628
+ crr.id
629
+ ]
630
+ }),
631
+ crrUserIdIdKey: index6("crr_userIdId_idx").on(crr.userId)
632
+ }));
633
+ }
634
+ __name(getCommentsSchema, "getCommentsSchema");
635
+ function getCommentRelationsSchema(mysqlTable) {
636
+ const comment = getCommentsSchema(mysqlTable);
637
+ const user = getUsersSchema(mysqlTable);
638
+ return relations8(comment, ({ one }) => ({
639
+ user: one(user, {
640
+ fields: [
641
+ comment.userId
642
+ ],
643
+ references: [
644
+ user.id
645
+ ],
646
+ relationName: "user"
647
+ })
648
+ }));
649
+ }
650
+ __name(getCommentRelationsSchema, "getCommentRelationsSchema");
651
+
469
652
  // src/lib/mysql/schemas/communication/communication-preferences.ts
470
- import { relations as relations6 } from "drizzle-orm";
471
- import { boolean as boolean2, index as index2, mysqlEnum, timestamp as timestamp6, varchar as varchar6 } from "drizzle-orm/mysql-core";
653
+ import { relations as relations9 } from "drizzle-orm";
654
+ import { boolean as boolean2, index as index7, mysqlEnum, timestamp as timestamp9, varchar as varchar9 } from "drizzle-orm/mysql-core";
472
655
  function getCommunicationPreferencesSchema(mysqlTable) {
473
- return mysqlTable("communicationPreference", {
474
- id: varchar6("id", {
656
+ return mysqlTable("CommunicationPreference", {
657
+ id: varchar9("id", {
475
658
  length: 255
476
659
  }).notNull().primaryKey(),
477
- userId: varchar6("userId", {
660
+ userId: varchar9("userId", {
478
661
  length: 255
479
662
  }).notNull(),
480
- channelId: varchar6("channelId", {
663
+ channelId: varchar9("channelId", {
481
664
  length: 255
482
665
  }).notNull(),
483
666
  preferenceLevel: mysqlEnum("preferenceLevel", [
@@ -485,34 +668,34 @@ function getCommunicationPreferencesSchema(mysqlTable) {
485
668
  "medium",
486
669
  "high"
487
670
  ]).notNull().default("medium"),
488
- preferenceTypeId: varchar6("preferenceTypeId", {
671
+ preferenceTypeId: varchar9("preferenceTypeId", {
489
672
  length: 255
490
673
  }).notNull(),
491
674
  active: boolean2("active").notNull().default(true),
492
- createdAt: timestamp6("createdAt", {
675
+ createdAt: timestamp9("createdAt", {
493
676
  mode: "date",
494
677
  fsp: 3
495
678
  }).defaultNow(),
496
- optInAt: timestamp6("optInAt", {
679
+ optInAt: timestamp9("optInAt", {
497
680
  mode: "date",
498
681
  fsp: 3
499
682
  }),
500
- optOutAt: timestamp6("optOutAt", {
683
+ optOutAt: timestamp9("optOutAt", {
501
684
  mode: "date",
502
685
  fsp: 3
503
686
  }),
504
- updatedAt: timestamp6("updatedAt", {
687
+ updatedAt: timestamp9("updatedAt", {
505
688
  mode: "date",
506
689
  fsp: 3
507
690
  }).defaultNow(),
508
- deletedAt: timestamp6("deletedAt", {
691
+ deletedAt: timestamp9("deletedAt", {
509
692
  mode: "date",
510
693
  fsp: 3
511
694
  })
512
695
  }, (cp) => ({
513
- userIdIdx: index2("userId_idx").on(cp.userId),
514
- preferenceTypeIdx: index2("preferenceTypeId_idx").on(cp.preferenceTypeId),
515
- channelIdIdx: index2("channelId_idx").on(cp.channelId)
696
+ userIdIdx: index7("userId_idx").on(cp.userId),
697
+ preferenceTypeIdx: index7("preferenceTypeId_idx").on(cp.preferenceTypeId),
698
+ channelIdIdx: index7("channelId_idx").on(cp.channelId)
516
699
  }));
517
700
  }
518
701
  __name(getCommunicationPreferencesSchema, "getCommunicationPreferencesSchema");
@@ -521,7 +704,7 @@ function getCommunicationPreferencesRelationsSchema(mysqlTable) {
521
704
  const users = getUsersSchema(mysqlTable);
522
705
  const communicationChannel = getCommunicationChannelSchema(mysqlTable);
523
706
  const communicationPreferenceTypes = getCommunicationPreferenceTypesSchema(mysqlTable);
524
- return relations6(communicationPreferences, ({ one }) => ({
707
+ return relations9(communicationPreferences, ({ one }) => ({
525
708
  user: one(users, {
526
709
  fields: [
527
710
  communicationPreferences.userId
@@ -553,128 +736,54 @@ function getCommunicationPreferencesRelationsSchema(mysqlTable) {
553
736
  }
554
737
  __name(getCommunicationPreferencesRelationsSchema, "getCommunicationPreferencesRelationsSchema");
555
738
 
556
- // src/lib/mysql/schemas/content/content-contributions.ts
557
- import { relations as relations7 } from "drizzle-orm";
558
- import { boolean as boolean3, index as index3, timestamp as timestamp7, varchar as varchar7 } from "drizzle-orm/mysql-core";
559
- function getContentContributionsSchema(mysqlTable) {
560
- return mysqlTable("contentContribution", {
561
- id: varchar7("id", {
562
- length: 255
563
- }).notNull().primaryKey(),
564
- userId: varchar7("userId", {
565
- length: 255
566
- }).notNull(),
567
- contentId: varchar7("contentId", {
568
- length: 255
569
- }).notNull(),
570
- contributionTypeId: varchar7("contributionTypeId", {
571
- length: 255
572
- }).notNull(),
573
- active: boolean3("active").notNull().default(true),
574
- createdAt: timestamp7("createdAt", {
575
- mode: "date",
576
- fsp: 3
577
- }).defaultNow(),
578
- updatedAt: timestamp7("updatedAt", {
579
- mode: "date",
580
- fsp: 3
581
- }).defaultNow(),
582
- deletedAt: timestamp7("deletedAt", {
583
- mode: "date",
584
- fsp: 3
585
- })
586
- }, (cc) => ({
587
- userIdIdx: index3("userId_idx").on(cc.userId),
588
- contentIdIdx: index3("contentId_idx").on(cc.contentId),
589
- contributionTypeIdIdx: index3("contributionTypeId_idx").on(cc.contributionTypeId)
590
- }));
591
- }
592
- __name(getContentContributionsSchema, "getContentContributionsSchema");
593
- function getContentContributionRelationsSchema(mysqlTable) {
594
- const contentContributions = getContentContributionsSchema(mysqlTable);
595
- const users = getUsersSchema(mysqlTable);
596
- const contentResource = getContentResourceSchema(mysqlTable);
597
- const contributionTypes = getContributionTypesSchema(mysqlTable);
598
- return relations7(contentContributions, ({ one }) => ({
599
- user: one(users, {
600
- fields: [
601
- contentContributions.userId
602
- ],
603
- references: [
604
- users.id
605
- ],
606
- relationName: "user"
607
- }),
608
- content: one(contentResource, {
609
- fields: [
610
- contentContributions.contentId
611
- ],
612
- references: [
613
- contentResource.id
614
- ],
615
- relationName: "contributions"
616
- }),
617
- contributionType: one(contributionTypes, {
618
- fields: [
619
- contentContributions.contributionTypeId
620
- ],
621
- references: [
622
- contributionTypes.id
623
- ],
624
- relationName: "contributionType"
625
- })
626
- }));
627
- }
628
- __name(getContentContributionRelationsSchema, "getContentContributionRelationsSchema");
629
-
630
739
  // src/lib/mysql/schemas/auth/accounts.ts
631
- import { relations as relations8 } from "drizzle-orm";
632
- import { index as index4, int as int4, primaryKey as primaryKey6, text, varchar as varchar8 } from "drizzle-orm/mysql-core";
740
+ import { relations as relations10 } from "drizzle-orm";
741
+ import { index as index8, int as int4, primaryKey as primaryKey8, text as text2, varchar as varchar10 } from "drizzle-orm/mysql-core";
633
742
  function getAccountsSchema(mysqlTable) {
634
- return mysqlTable("account", {
635
- userId: varchar8("userId", {
743
+ return mysqlTable("Account", {
744
+ userId: varchar10("userId", {
636
745
  length: 255
637
746
  }).notNull(),
638
- type: varchar8("type", {
747
+ type: varchar10("type", {
639
748
  length: 255
640
749
  }).$type().notNull(),
641
- provider: varchar8("provider", {
750
+ provider: varchar10("provider", {
642
751
  length: 255
643
752
  }).notNull(),
644
- providerAccountId: varchar8("providerAccountId", {
753
+ providerAccountId: varchar10("providerAccountId", {
645
754
  length: 255
646
755
  }).notNull(),
647
- refresh_token: text("refresh_token"),
648
- access_token: text("access_token"),
649
- oauth_token: text("oauth_token"),
650
- oauth_token_secret: text("oauth_token_secret"),
756
+ refresh_token: text2("refresh_token"),
757
+ access_token: text2("access_token"),
758
+ oauth_token: text2("oauth_token"),
759
+ oauth_token_secret: text2("oauth_token_secret"),
651
760
  expires_at: int4("expires_at"),
652
- token_type: varchar8("token_type", {
761
+ token_type: varchar10("token_type", {
653
762
  length: 255
654
763
  }),
655
- scope: varchar8("scope", {
764
+ scope: varchar10("scope", {
656
765
  length: 255
657
766
  }),
658
- id_token: text("id_token"),
659
- session_state: varchar8("session_state", {
767
+ id_token: text2("id_token"),
768
+ session_state: varchar10("session_state", {
660
769
  length: 255
661
770
  }),
662
771
  refresh_token_expires_in: int4("refresh_token_expires_in")
663
772
  }, (account) => ({
664
- pk: primaryKey6({
773
+ pk: primaryKey8({
665
774
  columns: [
666
775
  account.provider,
667
776
  account.providerAccountId
668
777
  ]
669
778
  }),
670
- userIdIdx: index4("userId_idx").on(account.userId)
779
+ userIdIdx: index8("userId_idx").on(account.userId)
671
780
  }));
672
781
  }
673
782
  __name(getAccountsSchema, "getAccountsSchema");
674
783
  function getAccountsRelationsSchema(mysqlTable) {
675
784
  const accounts = getAccountsSchema(mysqlTable);
676
785
  const users = getUsersSchema(mysqlTable);
677
- return relations8(accounts, ({ one }) => ({
786
+ return relations10(accounts, ({ one }) => ({
678
787
  user: one(users, {
679
788
  fields: [
680
789
  accounts.userId
@@ -689,38 +798,38 @@ function getAccountsRelationsSchema(mysqlTable) {
689
798
  __name(getAccountsRelationsSchema, "getAccountsRelationsSchema");
690
799
 
691
800
  // src/lib/mysql/schemas/auth/user-permissions.ts
692
- import { relations as relations9 } from "drizzle-orm";
693
- import { boolean as boolean4, index as index5, primaryKey as primaryKey7, timestamp as timestamp8, varchar as varchar9 } from "drizzle-orm/mysql-core";
801
+ import { relations as relations11 } from "drizzle-orm";
802
+ import { boolean as boolean3, index as index9, primaryKey as primaryKey9, timestamp as timestamp10, varchar as varchar11 } from "drizzle-orm/mysql-core";
694
803
  function getUserPermissionsSchema(mysqlTable) {
695
- return mysqlTable("userPermission", {
696
- userId: varchar9("userId", {
804
+ return mysqlTable("UserPermission", {
805
+ userId: varchar11("userId", {
697
806
  length: 255
698
807
  }).notNull(),
699
- permissionId: varchar9("permissionId", {
808
+ permissionId: varchar11("permissionId", {
700
809
  length: 255
701
810
  }).notNull(),
702
- active: boolean4("active").notNull().default(true),
703
- createdAt: timestamp8("createdAt", {
811
+ active: boolean3("active").notNull().default(true),
812
+ createdAt: timestamp10("createdAt", {
704
813
  mode: "date",
705
814
  fsp: 3
706
815
  }).defaultNow(),
707
- updatedAt: timestamp8("updatedAt", {
816
+ updatedAt: timestamp10("updatedAt", {
708
817
  mode: "date",
709
818
  fsp: 3
710
819
  }).defaultNow(),
711
- deletedAt: timestamp8("deletedAt", {
820
+ deletedAt: timestamp10("deletedAt", {
712
821
  mode: "date",
713
822
  fsp: 3
714
823
  })
715
824
  }, (up) => ({
716
- pk: primaryKey7({
825
+ pk: primaryKey9({
717
826
  columns: [
718
827
  up.userId,
719
828
  up.permissionId
720
829
  ]
721
830
  }),
722
- userIdIdx: index5("userId_idx").on(up.userId),
723
- permissionIdIdx: index5("permissionId_idx").on(up.permissionId)
831
+ userIdIdx: index9("userId_idx").on(up.userId),
832
+ permissionIdIdx: index9("permissionId_idx").on(up.permissionId)
724
833
  }));
725
834
  }
726
835
  __name(getUserPermissionsSchema, "getUserPermissionsSchema");
@@ -728,7 +837,7 @@ function getUserPermissionsRelationsSchema(mysqlTable) {
728
837
  const userPermissions = getUserPermissionsSchema(mysqlTable);
729
838
  const users = getUsersSchema(mysqlTable);
730
839
  const permissions = getPermissionsSchema(mysqlTable);
731
- return relations9(userPermissions, ({ one }) => ({
840
+ return relations11(userPermissions, ({ one }) => ({
732
841
  user: one(users, {
733
842
  fields: [
734
843
  userPermissions.userId
@@ -751,44 +860,98 @@ function getUserPermissionsRelationsSchema(mysqlTable) {
751
860
  }
752
861
  __name(getUserPermissionsRelationsSchema, "getUserPermissionsRelationsSchema");
753
862
 
863
+ // src/lib/mysql/schemas/auth/user-prefs.ts
864
+ import { relations as relations12, sql as sql9 } from "drizzle-orm";
865
+ import { index as index10, json as json9, primaryKey as primaryKey10, timestamp as timestamp11, varchar as varchar12 } from "drizzle-orm/mysql-core";
866
+ function getUserPrefsSchema(mysqlTable) {
867
+ return mysqlTable("UserPrefs", {
868
+ id: varchar12("id", {
869
+ length: 191
870
+ }).notNull(),
871
+ type: varchar12("type", {
872
+ length: 191
873
+ }).default("Global").notNull(),
874
+ userId: varchar12("userId", {
875
+ length: 255
876
+ }).notNull(),
877
+ fields: json9("fields").$type().default({}),
878
+ createdAt: timestamp11("createdAt", {
879
+ mode: "date",
880
+ fsp: 3
881
+ }).default(sql9`CURRENT_TIMESTAMP(3)`),
882
+ updatedAt: timestamp11("updatedAt", {
883
+ mode: "date",
884
+ fsp: 3
885
+ }).default(sql9`CURRENT_TIMESTAMP(3)`),
886
+ deletedAt: timestamp11("deletedAt", {
887
+ mode: "date",
888
+ fsp: 3
889
+ })
890
+ }, (crr) => ({
891
+ pk: primaryKey10({
892
+ columns: [
893
+ crr.id
894
+ ]
895
+ }),
896
+ crrUserIdIdKey: index10("crr_userIdId_idx").on(crr.userId)
897
+ }));
898
+ }
899
+ __name(getUserPrefsSchema, "getUserPrefsSchema");
900
+ function getUserPrefsRelationsSchema(mysqlTable) {
901
+ const userPrefs = getUserPrefsSchema(mysqlTable);
902
+ const user = getUsersSchema(mysqlTable);
903
+ return relations12(userPrefs, ({ one }) => ({
904
+ user: one(user, {
905
+ fields: [
906
+ userPrefs.userId
907
+ ],
908
+ references: [
909
+ user.id
910
+ ],
911
+ relationName: "user"
912
+ })
913
+ }));
914
+ }
915
+ __name(getUserPrefsRelationsSchema, "getUserPrefsRelationsSchema");
916
+
754
917
  // src/lib/mysql/schemas/auth/user-roles.ts
755
- import { relations as relations11 } from "drizzle-orm";
756
- import { boolean as boolean6, index as index7, primaryKey as primaryKey8, timestamp as timestamp10, varchar as varchar11 } from "drizzle-orm/mysql-core";
918
+ import { relations as relations14 } from "drizzle-orm";
919
+ import { boolean as boolean5, index as index12, primaryKey as primaryKey11, timestamp as timestamp13, varchar as varchar14 } from "drizzle-orm/mysql-core";
757
920
 
758
921
  // src/lib/mysql/schemas/auth/roles.ts
759
- import { relations as relations10 } from "drizzle-orm";
760
- import { boolean as boolean5, index as index6, text as text2, timestamp as timestamp9, varchar as varchar10 } from "drizzle-orm/mysql-core";
922
+ import { relations as relations13 } from "drizzle-orm";
923
+ import { boolean as boolean4, index as index11, text as text3, timestamp as timestamp12, varchar as varchar13 } from "drizzle-orm/mysql-core";
761
924
  function getRolesSchema(mysqlTable) {
762
- return mysqlTable("role", {
763
- id: varchar10("id", {
925
+ return mysqlTable("Role", {
926
+ id: varchar13("id", {
764
927
  length: 255
765
928
  }).notNull().primaryKey(),
766
- name: varchar10("name", {
929
+ name: varchar13("name", {
767
930
  length: 255
768
931
  }).notNull().unique(),
769
- description: text2("description"),
770
- active: boolean5("active").notNull().default(true),
771
- createdAt: timestamp9("createdAt", {
932
+ description: text3("description"),
933
+ active: boolean4("active").notNull().default(true),
934
+ createdAt: timestamp12("createdAt", {
772
935
  mode: "date",
773
936
  fsp: 3
774
937
  }).defaultNow(),
775
- updatedAt: timestamp9("updatedAt", {
938
+ updatedAt: timestamp12("updatedAt", {
776
939
  mode: "date",
777
940
  fsp: 3
778
941
  }).defaultNow(),
779
- deletedAt: timestamp9("deletedAt", {
942
+ deletedAt: timestamp12("deletedAt", {
780
943
  mode: "date",
781
944
  fsp: 3
782
945
  })
783
946
  }, (role) => ({
784
- nameIdx: index6("name_idx").on(role.name)
947
+ nameIdx: index11("name_idx").on(role.name)
785
948
  }));
786
949
  }
787
950
  __name(getRolesSchema, "getRolesSchema");
788
951
  function getRolesRelationsSchema(mysqlTable) {
789
952
  const roles = getRolesSchema(mysqlTable);
790
953
  const userRoles = getUserRolesSchema(mysqlTable);
791
- return relations10(roles, ({ many }) => ({
954
+ return relations13(roles, ({ many }) => ({
792
955
  userRoles: many(userRoles, {
793
956
  relationName: "role"
794
957
  })
@@ -798,35 +961,35 @@ __name(getRolesRelationsSchema, "getRolesRelationsSchema");
798
961
 
799
962
  // src/lib/mysql/schemas/auth/user-roles.ts
800
963
  function getUserRolesSchema(mysqlTable) {
801
- return mysqlTable("userRole", {
802
- userId: varchar11("userId", {
964
+ return mysqlTable("UserRole", {
965
+ userId: varchar14("userId", {
803
966
  length: 255
804
967
  }).notNull(),
805
- roleId: varchar11("roleId", {
968
+ roleId: varchar14("roleId", {
806
969
  length: 255
807
970
  }).notNull(),
808
- active: boolean6("active").notNull().default(true),
809
- createdAt: timestamp10("createdAt", {
971
+ active: boolean5("active").notNull().default(true),
972
+ createdAt: timestamp13("createdAt", {
810
973
  mode: "date",
811
974
  fsp: 3
812
975
  }).defaultNow(),
813
- updatedAt: timestamp10("updatedAt", {
976
+ updatedAt: timestamp13("updatedAt", {
814
977
  mode: "date",
815
978
  fsp: 3
816
979
  }).defaultNow(),
817
- deletedAt: timestamp10("deletedAt", {
980
+ deletedAt: timestamp13("deletedAt", {
818
981
  mode: "date",
819
982
  fsp: 3
820
983
  })
821
984
  }, (ur) => ({
822
- pk: primaryKey8({
985
+ pk: primaryKey11({
823
986
  columns: [
824
987
  ur.userId,
825
988
  ur.roleId
826
989
  ]
827
990
  }),
828
- userIdIdx: index7("userId_idx").on(ur.userId),
829
- roleIdIdx: index7("roleId_idx").on(ur.roleId)
991
+ userIdIdx: index12("userId_idx").on(ur.userId),
992
+ roleIdIdx: index12("roleId_idx").on(ur.roleId)
830
993
  }));
831
994
  }
832
995
  __name(getUserRolesSchema, "getUserRolesSchema");
@@ -834,7 +997,7 @@ function getUserRolesRelationsSchema(mysqlTable) {
834
997
  const userRoles = getUserRolesSchema(mysqlTable);
835
998
  const users = getUsersSchema(mysqlTable);
836
999
  const roles = getRolesSchema(mysqlTable);
837
- return relations11(userRoles, ({ one }) => ({
1000
+ return relations14(userRoles, ({ one }) => ({
838
1001
  user: one(users, {
839
1002
  fields: [
840
1003
  userRoles.userId
@@ -859,35 +1022,35 @@ __name(getUserRolesRelationsSchema, "getUserRolesRelationsSchema");
859
1022
 
860
1023
  // src/lib/mysql/schemas/auth/users.ts
861
1024
  function getUsersSchema(mysqlTable) {
862
- return mysqlTable("user", {
863
- id: varchar12("id", {
1025
+ return mysqlTable("User", {
1026
+ id: varchar15("id", {
864
1027
  length: 255
865
1028
  }).notNull().primaryKey(),
866
- name: varchar12("name", {
1029
+ name: varchar15("name", {
867
1030
  length: 255
868
1031
  }),
869
- role: mysqlEnum2("role", [
870
- "user",
871
- "admin"
872
- ]).default("user"),
873
- email: varchar12("email", {
1032
+ role: varchar15("role", {
1033
+ length: 191
1034
+ }).notNull().default("user"),
1035
+ email: varchar15("email", {
874
1036
  length: 255
875
1037
  }).notNull().unique(),
876
- emailVerified: timestamp11("emailVerified", {
1038
+ fields: json10("fields").$type().default({}),
1039
+ emailVerified: timestamp14("emailVerified", {
877
1040
  mode: "date",
878
1041
  fsp: 3
879
1042
  }),
880
- image: varchar12("image", {
1043
+ image: varchar15("image", {
881
1044
  length: 255
882
1045
  }),
883
- createdAt: timestamp11("createdAt", {
1046
+ createdAt: timestamp14("createdAt", {
884
1047
  mode: "date",
885
1048
  fsp: 3
886
- }).default(sql6`CURRENT_TIMESTAMP(3)`)
1049
+ }).default(sql10`CURRENT_TIMESTAMP(3)`)
887
1050
  }, (user) => ({
888
- emailIdx: index8("email_idx").on(user.email),
889
- roleIdx: index8("role_idx").on(user.role),
890
- createdAtIdx: index8("created_at_idx").on(user.createdAt)
1051
+ emailIdx: index13("email_idx").on(user.email),
1052
+ roleIdx: index13("role_idx").on(user.role),
1053
+ createdAtIdx: index13("created_at_idx").on(user.createdAt)
891
1054
  }));
892
1055
  }
893
1056
  __name(getUsersSchema, "getUsersSchema");
@@ -900,7 +1063,9 @@ function getUsersRelationsSchema(mysqlTable) {
900
1063
  const contentContributions = getContentContributionsSchema(mysqlTable);
901
1064
  const contentResource = getContentResourceSchema(mysqlTable);
902
1065
  const purchases = getPurchaseSchema(mysqlTable);
903
- return relations12(users, ({ many }) => ({
1066
+ const comments = getCommentsSchema(mysqlTable);
1067
+ const userPrefs = getUserPrefsSchema(mysqlTable);
1068
+ return relations15(users, ({ many }) => ({
904
1069
  accounts: many(accounts, {
905
1070
  relationName: "user"
906
1071
  }),
@@ -921,133 +1086,92 @@ function getUsersRelationsSchema(mysqlTable) {
921
1086
  }),
922
1087
  createdContent: many(contentResource, {
923
1088
  relationName: "user"
1089
+ }),
1090
+ comments: many(comments, {
1091
+ relationName: "user"
1092
+ }),
1093
+ prefs: many(userPrefs, {
1094
+ relationName: "user"
924
1095
  })
925
1096
  }));
926
1097
  }
927
1098
  __name(getUsersRelationsSchema, "getUsersRelationsSchema");
928
1099
 
929
- // src/lib/mysql/schemas/content/content-resource.ts
930
- function getContentResourceSchema(mysqlTable) {
931
- return mysqlTable("contentResource", {
932
- id: varchar13("id", {
1100
+ // src/lib/mysql/schemas/content/content-contributions.ts
1101
+ function getContentContributionsSchema(mysqlTable) {
1102
+ return mysqlTable("ContentContribution", {
1103
+ id: varchar16("id", {
933
1104
  length: 255
934
1105
  }).notNull().primaryKey(),
935
- type: varchar13("type", {
1106
+ userId: varchar16("userId", {
936
1107
  length: 255
937
1108
  }).notNull(),
938
- createdById: varchar13("createdById", {
1109
+ contentId: varchar16("contentId", {
939
1110
  length: 255
940
1111
  }).notNull(),
941
- fields: json6("fields").$type().default({}),
942
- createdAt: timestamp12("createdAt", {
1112
+ contributionTypeId: varchar16("contributionTypeId", {
1113
+ length: 255
1114
+ }).notNull(),
1115
+ active: boolean6("active").notNull().default(true),
1116
+ createdAt: timestamp15("createdAt", {
943
1117
  mode: "date",
944
1118
  fsp: 3
945
- }).default(sql7`CURRENT_TIMESTAMP(3)`),
946
- updatedAt: timestamp12("updatedAt", {
1119
+ }).defaultNow(),
1120
+ updatedAt: timestamp15("updatedAt", {
947
1121
  mode: "date",
948
1122
  fsp: 3
949
- }).default(sql7`CURRENT_TIMESTAMP(3)`),
950
- deletedAt: timestamp12("deletedAt", {
1123
+ }).defaultNow(),
1124
+ deletedAt: timestamp15("deletedAt", {
951
1125
  mode: "date",
952
1126
  fsp: 3
953
1127
  })
954
- }, (cm) => ({
955
- typeIdx: index9("type_idx").on(cm.type),
956
- createdByIdx: index9("createdById_idx").on(cm.createdById),
957
- createdAtIdx: index9("createdAt_idx").on(cm.createdAt)
1128
+ }, (cc) => ({
1129
+ userIdIdx: index14("userId_idx").on(cc.userId),
1130
+ contentIdIdx: index14("contentId_idx").on(cc.contentId),
1131
+ contributionTypeIdIdx: index14("contributionTypeId_idx").on(cc.contributionTypeId)
958
1132
  }));
959
1133
  }
960
- __name(getContentResourceSchema, "getContentResourceSchema");
961
- function getContentResourceRelationsSchema(mysqlTable) {
962
- const contentResource = getContentResourceSchema(mysqlTable);
1134
+ __name(getContentContributionsSchema, "getContentContributionsSchema");
1135
+ function getContentContributionRelationsSchema(mysqlTable) {
1136
+ const contentContributions = getContentContributionsSchema(mysqlTable);
963
1137
  const users = getUsersSchema(mysqlTable);
964
- const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
965
- const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
966
- return relations13(contentResource, ({ one, many }) => ({
967
- createdBy: one(users, {
1138
+ const contentResource = getContentResourceSchema(mysqlTable);
1139
+ const contributionTypes = getContributionTypesSchema(mysqlTable);
1140
+ return relations16(contentContributions, ({ one }) => ({
1141
+ user: one(users, {
968
1142
  fields: [
969
- contentResource.createdById
1143
+ contentContributions.userId
970
1144
  ],
971
1145
  references: [
972
1146
  users.id
973
1147
  ],
974
1148
  relationName: "user"
975
1149
  }),
976
- resources: many(contentResourceResource, {
977
- relationName: "resourceOf"
978
- }),
979
- resourceOf: many(contentResourceResource, {
980
- relationName: "resource"
981
- }),
982
- resourceProducts: many(contentResourceProduct, {
983
- relationName: "resource"
984
- })
985
- }));
986
- }
987
- __name(getContentResourceRelationsSchema, "getContentResourceRelationsSchema");
988
-
989
- // src/lib/mysql/schemas/content/content-resource-resource.ts
990
- function getContentResourceResourceSchema(mysqlTable) {
991
- return mysqlTable("contentResourceResource", {
992
- resourceOfId: varchar14("resourceOfId", {
993
- length: 255
994
- }).notNull(),
995
- resourceId: varchar14("resourceId", {
996
- length: 255
997
- }).notNull(),
998
- position: double2("position").notNull().default(0),
999
- metadata: json7("metadata").$type().default({}),
1000
- createdAt: timestamp13("createdAt", {
1001
- mode: "date",
1002
- fsp: 3
1003
- }).default(sql8`CURRENT_TIMESTAMP(3)`),
1004
- updatedAt: timestamp13("updatedAt", {
1005
- mode: "date",
1006
- fsp: 3
1007
- }).default(sql8`CURRENT_TIMESTAMP(3)`),
1008
- deletedAt: timestamp13("deletedAt", {
1009
- mode: "date",
1010
- fsp: 3
1011
- })
1012
- }, (crr) => ({
1013
- pk: primaryKey9({
1014
- columns: [
1015
- crr.resourceOfId,
1016
- crr.resourceId
1017
- ]
1018
- }),
1019
- contentResourceIdIdx: index10("contentResourceId_idx").on(crr.resourceOfId),
1020
- resourceIdIdx: index10("resourceId_idx").on(crr.resourceId)
1021
- }));
1022
- }
1023
- __name(getContentResourceResourceSchema, "getContentResourceResourceSchema");
1024
- function getContentResourceResourceRelationsSchema(mysqlTable) {
1025
- const contentResource = getContentResourceSchema(mysqlTable);
1026
- const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
1027
- return relations14(contentResourceResource, ({ one }) => ({
1028
- resourceOf: one(contentResource, {
1150
+ content: one(contentResource, {
1029
1151
  fields: [
1030
- contentResourceResource.resourceOfId
1152
+ contentContributions.contentId
1031
1153
  ],
1032
1154
  references: [
1033
1155
  contentResource.id
1034
1156
  ],
1035
- relationName: "resourceOf"
1157
+ relationName: "contributions"
1036
1158
  }),
1037
- resource: one(contentResource, {
1159
+ contributionType: one(contributionTypes, {
1038
1160
  fields: [
1039
- contentResourceResource.resourceId
1161
+ contentContributions.contributionTypeId
1040
1162
  ],
1041
1163
  references: [
1042
- contentResource.id
1164
+ contributionTypes.id
1043
1165
  ],
1044
- relationName: "resource"
1166
+ relationName: "contributionType"
1045
1167
  })
1046
1168
  }));
1047
1169
  }
1048
- __name(getContentResourceResourceRelationsSchema, "getContentResourceResourceRelationsSchema");
1170
+ __name(getContentContributionRelationsSchema, "getContentContributionRelationsSchema");
1049
1171
 
1050
1172
  export {
1173
+ getContentContributionsSchema,
1174
+ getContentContributionRelationsSchema,
1051
1175
  getContentResourceResourceSchema,
1052
1176
  getContentResourceResourceRelationsSchema,
1053
1177
  getContentResourceSchema,
@@ -1062,12 +1186,14 @@ export {
1062
1186
  getCouponRelationsSchema,
1063
1187
  getPurchaseSchema,
1064
1188
  getPurchaseRelationsSchema,
1189
+ getCommentsSchema,
1190
+ getCommentRelationsSchema,
1065
1191
  getCommunicationPreferencesSchema,
1066
1192
  getCommunicationPreferencesRelationsSchema,
1067
- getContentContributionsSchema,
1068
- getContentContributionRelationsSchema,
1069
1193
  getUserPermissionsSchema,
1070
1194
  getUserPermissionsRelationsSchema,
1195
+ getUserPrefsSchema,
1196
+ getUserPrefsRelationsSchema,
1071
1197
  getRolesSchema,
1072
1198
  getRolesRelationsSchema,
1073
1199
  getUserRolesSchema,
@@ -1077,4 +1203,4 @@ export {
1077
1203
  getAccountsSchema,
1078
1204
  getAccountsRelationsSchema
1079
1205
  };
1080
- //# sourceMappingURL=chunk-4PJWD6YK.js.map
1206
+ //# sourceMappingURL=chunk-FRA4ZCRA.js.map