@coursebuilder/adapter-drizzle 0.4.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-ULEUIL2Y.js → chunk-BM5UKWXI.js} +3 -3
  6. package/dist/{chunk-IDINCRHK.js → chunk-CQNKTFXE.js} +3 -3
  7. package/dist/{chunk-N7UDJAI3.js → chunk-FRA4ZCRA.js} +462 -337
  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-XJHSXR42.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-DL3UMWB4.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-A26D3TCA.js → chunk-Z245DYMP.js} +159 -62
  23. package/dist/index.js +22 -19
  24. package/dist/lib/mysql/index.cjs +992 -650
  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 -66
  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 -129
  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 +142 -39
  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 +1 -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 index11, 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 index10, 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 index9, 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, index as index2, 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,16 +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
- couponIdCodeIndex: index2("Coupon_id_code_index").on(table.id, table.code),
286
- couponId: primaryKey4({
414
+ couponIdCodeIndex: index4("Coupon_id_code_index").on(table.id, table.code),
415
+ couponId: primaryKey5({
287
416
  columns: [
288
417
  table.id
289
418
  ],
@@ -299,7 +428,7 @@ function getCouponRelationsSchema(mysqlTable) {
299
428
  const purchase = getPurchaseSchema(mysqlTable);
300
429
  const coupon = getCouponSchema(mysqlTable);
301
430
  const merchantCoupon = getMerchantCouponSchema(mysqlTable);
302
- return relations4(coupon, ({ many, one }) => ({
431
+ return relations6(coupon, ({ many, one }) => ({
303
432
  bulkCouponPurchases: many(purchase, {
304
433
  relationName: "redeemedBulkCoupon"
305
434
  }),
@@ -336,66 +465,67 @@ __name(getCouponRelationsSchema, "getCouponRelationsSchema");
336
465
 
337
466
  // src/lib/mysql/schemas/commerce/purchase.ts
338
467
  function getPurchaseSchema(mysqlTable) {
339
- return mysqlTable("purchases", {
340
- id: varchar5("id", {
468
+ return mysqlTable("Purchase", {
469
+ id: varchar7("id", {
341
470
  length: 191
342
471
  }).notNull(),
343
- userId: varchar5("userId", {
472
+ userId: varchar7("userId", {
344
473
  length: 191
345
474
  }),
346
- createdAt: timestamp5("createdAt", {
475
+ createdAt: timestamp7("createdAt", {
347
476
  mode: "date",
348
477
  fsp: 3
349
- }).default(sql5`CURRENT_TIMESTAMP(3)`).notNull(),
478
+ }).default(sql7`CURRENT_TIMESTAMP(3)`).notNull(),
350
479
  totalAmount: decimal3("totalAmount", {
351
480
  precision: 65,
352
481
  scale: 30
353
482
  }).notNull(),
354
- ipAddress: varchar5("ip_address", {
483
+ ipAddress: varchar7("ip_address", {
355
484
  length: 191
356
485
  }),
357
- city: varchar5("city", {
486
+ city: varchar7("city", {
358
487
  length: 191
359
488
  }),
360
- state: varchar5("state", {
489
+ state: varchar7("state", {
361
490
  length: 191
362
491
  }),
363
- country: varchar5("country", {
492
+ country: varchar7("country", {
364
493
  length: 191
365
494
  }),
366
- couponId: varchar5("couponId", {
495
+ couponId: varchar7("couponId", {
367
496
  length: 191
368
497
  }),
369
- productId: varchar5("productId", {
498
+ productId: varchar7("productId", {
370
499
  length: 191
371
500
  }).notNull(),
372
- merchantChargeId: varchar5("merchantChargeId", {
501
+ merchantChargeId: varchar7("merchantChargeId", {
373
502
  length: 191
374
503
  }),
375
- upgradedFromId: varchar5("upgradedFromId", {
504
+ upgradedFromId: varchar7("upgradedFromId", {
376
505
  length: 191
377
506
  }),
378
- status: varchar5("status", {
507
+ status: varchar7("status", {
379
508
  length: 191
380
509
  }).default("Valid").notNull(),
381
- bulkCouponId: varchar5("bulkCouponId", {
510
+ bulkCouponId: varchar7("bulkCouponId", {
382
511
  length: 191
383
512
  }),
384
- merchantSessionId: varchar5("merchantSessionId", {
513
+ merchantSessionId: varchar7("merchantSessionId", {
385
514
  length: 191
386
515
  }),
387
- redeemedBulkCouponId: varchar5("redeemedBulkCouponId", {
516
+ redeemedBulkCouponId: varchar7("redeemedBulkCouponId", {
388
517
  length: 191
389
518
  }),
390
- fields: json5("fields").$type().default({})
519
+ fields: json7("fields").$type().default({})
391
520
  }, (table) => {
392
521
  return {
393
- purchaseId: primaryKey5({
522
+ purchaseId: primaryKey6({
394
523
  columns: [
395
524
  table.id
396
525
  ],
397
526
  name: "Purchase_id"
398
527
  }),
528
+ merchantChargeIdIdx: index5("idx_Purchase_on_merchantChargeId").on(table.merchantChargeId),
399
529
  purchaseUpgradedFromIdKey: unique2("Purchase_upgradedFromId_key").on(table.upgradedFromId)
400
530
  };
401
531
  });
@@ -408,7 +538,7 @@ function getPurchaseRelationsSchema(mysqlTable) {
408
538
  const merchantCharges = getMerchantChargeSchema(mysqlTable);
409
539
  const merchantSessions = getMerchantSessionSchema(mysqlTable);
410
540
  const coupons = getCouponSchema(mysqlTable);
411
- return relations5(purchases, ({ many, one }) => ({
541
+ return relations7(purchases, ({ many, one }) => ({
412
542
  redeemedBulkCoupon: one(coupons, {
413
543
  fields: [
414
544
  purchases.redeemedBulkCouponId
@@ -467,18 +597,70 @@ function getPurchaseRelationsSchema(mysqlTable) {
467
597
  }
468
598
  __name(getPurchaseRelationsSchema, "getPurchaseRelationsSchema");
469
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
+
470
652
  // src/lib/mysql/schemas/communication/communication-preferences.ts
471
- import { relations as relations6 } from "drizzle-orm";
472
- import { boolean as boolean2, index as index3, 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";
473
655
  function getCommunicationPreferencesSchema(mysqlTable) {
474
- return mysqlTable("communicationPreference", {
475
- id: varchar6("id", {
656
+ return mysqlTable("CommunicationPreference", {
657
+ id: varchar9("id", {
476
658
  length: 255
477
659
  }).notNull().primaryKey(),
478
- userId: varchar6("userId", {
660
+ userId: varchar9("userId", {
479
661
  length: 255
480
662
  }).notNull(),
481
- channelId: varchar6("channelId", {
663
+ channelId: varchar9("channelId", {
482
664
  length: 255
483
665
  }).notNull(),
484
666
  preferenceLevel: mysqlEnum("preferenceLevel", [
@@ -486,34 +668,34 @@ function getCommunicationPreferencesSchema(mysqlTable) {
486
668
  "medium",
487
669
  "high"
488
670
  ]).notNull().default("medium"),
489
- preferenceTypeId: varchar6("preferenceTypeId", {
671
+ preferenceTypeId: varchar9("preferenceTypeId", {
490
672
  length: 255
491
673
  }).notNull(),
492
674
  active: boolean2("active").notNull().default(true),
493
- createdAt: timestamp6("createdAt", {
675
+ createdAt: timestamp9("createdAt", {
494
676
  mode: "date",
495
677
  fsp: 3
496
678
  }).defaultNow(),
497
- optInAt: timestamp6("optInAt", {
679
+ optInAt: timestamp9("optInAt", {
498
680
  mode: "date",
499
681
  fsp: 3
500
682
  }),
501
- optOutAt: timestamp6("optOutAt", {
683
+ optOutAt: timestamp9("optOutAt", {
502
684
  mode: "date",
503
685
  fsp: 3
504
686
  }),
505
- updatedAt: timestamp6("updatedAt", {
687
+ updatedAt: timestamp9("updatedAt", {
506
688
  mode: "date",
507
689
  fsp: 3
508
690
  }).defaultNow(),
509
- deletedAt: timestamp6("deletedAt", {
691
+ deletedAt: timestamp9("deletedAt", {
510
692
  mode: "date",
511
693
  fsp: 3
512
694
  })
513
695
  }, (cp) => ({
514
- userIdIdx: index3("userId_idx").on(cp.userId),
515
- preferenceTypeIdx: index3("preferenceTypeId_idx").on(cp.preferenceTypeId),
516
- channelIdIdx: index3("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)
517
699
  }));
518
700
  }
519
701
  __name(getCommunicationPreferencesSchema, "getCommunicationPreferencesSchema");
@@ -522,7 +704,7 @@ function getCommunicationPreferencesRelationsSchema(mysqlTable) {
522
704
  const users = getUsersSchema(mysqlTable);
523
705
  const communicationChannel = getCommunicationChannelSchema(mysqlTable);
524
706
  const communicationPreferenceTypes = getCommunicationPreferenceTypesSchema(mysqlTable);
525
- return relations6(communicationPreferences, ({ one }) => ({
707
+ return relations9(communicationPreferences, ({ one }) => ({
526
708
  user: one(users, {
527
709
  fields: [
528
710
  communicationPreferences.userId
@@ -554,128 +736,54 @@ function getCommunicationPreferencesRelationsSchema(mysqlTable) {
554
736
  }
555
737
  __name(getCommunicationPreferencesRelationsSchema, "getCommunicationPreferencesRelationsSchema");
556
738
 
557
- // src/lib/mysql/schemas/content/content-contributions.ts
558
- import { relations as relations7 } from "drizzle-orm";
559
- import { boolean as boolean3, index as index4, timestamp as timestamp7, varchar as varchar7 } from "drizzle-orm/mysql-core";
560
- function getContentContributionsSchema(mysqlTable) {
561
- return mysqlTable("contentContribution", {
562
- id: varchar7("id", {
563
- length: 255
564
- }).notNull().primaryKey(),
565
- userId: varchar7("userId", {
566
- length: 255
567
- }).notNull(),
568
- contentId: varchar7("contentId", {
569
- length: 255
570
- }).notNull(),
571
- contributionTypeId: varchar7("contributionTypeId", {
572
- length: 255
573
- }).notNull(),
574
- active: boolean3("active").notNull().default(true),
575
- createdAt: timestamp7("createdAt", {
576
- mode: "date",
577
- fsp: 3
578
- }).defaultNow(),
579
- updatedAt: timestamp7("updatedAt", {
580
- mode: "date",
581
- fsp: 3
582
- }).defaultNow(),
583
- deletedAt: timestamp7("deletedAt", {
584
- mode: "date",
585
- fsp: 3
586
- })
587
- }, (cc) => ({
588
- userIdIdx: index4("userId_idx").on(cc.userId),
589
- contentIdIdx: index4("contentId_idx").on(cc.contentId),
590
- contributionTypeIdIdx: index4("contributionTypeId_idx").on(cc.contributionTypeId)
591
- }));
592
- }
593
- __name(getContentContributionsSchema, "getContentContributionsSchema");
594
- function getContentContributionRelationsSchema(mysqlTable) {
595
- const contentContributions = getContentContributionsSchema(mysqlTable);
596
- const users = getUsersSchema(mysqlTable);
597
- const contentResource = getContentResourceSchema(mysqlTable);
598
- const contributionTypes = getContributionTypesSchema(mysqlTable);
599
- return relations7(contentContributions, ({ one }) => ({
600
- user: one(users, {
601
- fields: [
602
- contentContributions.userId
603
- ],
604
- references: [
605
- users.id
606
- ],
607
- relationName: "user"
608
- }),
609
- content: one(contentResource, {
610
- fields: [
611
- contentContributions.contentId
612
- ],
613
- references: [
614
- contentResource.id
615
- ],
616
- relationName: "contributions"
617
- }),
618
- contributionType: one(contributionTypes, {
619
- fields: [
620
- contentContributions.contributionTypeId
621
- ],
622
- references: [
623
- contributionTypes.id
624
- ],
625
- relationName: "contributionType"
626
- })
627
- }));
628
- }
629
- __name(getContentContributionRelationsSchema, "getContentContributionRelationsSchema");
630
-
631
739
  // src/lib/mysql/schemas/auth/accounts.ts
632
- import { relations as relations8 } from "drizzle-orm";
633
- import { index as index5, 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";
634
742
  function getAccountsSchema(mysqlTable) {
635
- return mysqlTable("account", {
636
- userId: varchar8("userId", {
743
+ return mysqlTable("Account", {
744
+ userId: varchar10("userId", {
637
745
  length: 255
638
746
  }).notNull(),
639
- type: varchar8("type", {
747
+ type: varchar10("type", {
640
748
  length: 255
641
749
  }).$type().notNull(),
642
- provider: varchar8("provider", {
750
+ provider: varchar10("provider", {
643
751
  length: 255
644
752
  }).notNull(),
645
- providerAccountId: varchar8("providerAccountId", {
753
+ providerAccountId: varchar10("providerAccountId", {
646
754
  length: 255
647
755
  }).notNull(),
648
- refresh_token: text("refresh_token"),
649
- access_token: text("access_token"),
650
- oauth_token: text("oauth_token"),
651
- 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"),
652
760
  expires_at: int4("expires_at"),
653
- token_type: varchar8("token_type", {
761
+ token_type: varchar10("token_type", {
654
762
  length: 255
655
763
  }),
656
- scope: varchar8("scope", {
764
+ scope: varchar10("scope", {
657
765
  length: 255
658
766
  }),
659
- id_token: text("id_token"),
660
- session_state: varchar8("session_state", {
767
+ id_token: text2("id_token"),
768
+ session_state: varchar10("session_state", {
661
769
  length: 255
662
770
  }),
663
771
  refresh_token_expires_in: int4("refresh_token_expires_in")
664
772
  }, (account) => ({
665
- pk: primaryKey6({
773
+ pk: primaryKey8({
666
774
  columns: [
667
775
  account.provider,
668
776
  account.providerAccountId
669
777
  ]
670
778
  }),
671
- userIdIdx: index5("userId_idx").on(account.userId)
779
+ userIdIdx: index8("userId_idx").on(account.userId)
672
780
  }));
673
781
  }
674
782
  __name(getAccountsSchema, "getAccountsSchema");
675
783
  function getAccountsRelationsSchema(mysqlTable) {
676
784
  const accounts = getAccountsSchema(mysqlTable);
677
785
  const users = getUsersSchema(mysqlTable);
678
- return relations8(accounts, ({ one }) => ({
786
+ return relations10(accounts, ({ one }) => ({
679
787
  user: one(users, {
680
788
  fields: [
681
789
  accounts.userId
@@ -690,38 +798,38 @@ function getAccountsRelationsSchema(mysqlTable) {
690
798
  __name(getAccountsRelationsSchema, "getAccountsRelationsSchema");
691
799
 
692
800
  // src/lib/mysql/schemas/auth/user-permissions.ts
693
- import { relations as relations9 } from "drizzle-orm";
694
- import { boolean as boolean4, index as index6, 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";
695
803
  function getUserPermissionsSchema(mysqlTable) {
696
- return mysqlTable("userPermission", {
697
- userId: varchar9("userId", {
804
+ return mysqlTable("UserPermission", {
805
+ userId: varchar11("userId", {
698
806
  length: 255
699
807
  }).notNull(),
700
- permissionId: varchar9("permissionId", {
808
+ permissionId: varchar11("permissionId", {
701
809
  length: 255
702
810
  }).notNull(),
703
- active: boolean4("active").notNull().default(true),
704
- createdAt: timestamp8("createdAt", {
811
+ active: boolean3("active").notNull().default(true),
812
+ createdAt: timestamp10("createdAt", {
705
813
  mode: "date",
706
814
  fsp: 3
707
815
  }).defaultNow(),
708
- updatedAt: timestamp8("updatedAt", {
816
+ updatedAt: timestamp10("updatedAt", {
709
817
  mode: "date",
710
818
  fsp: 3
711
819
  }).defaultNow(),
712
- deletedAt: timestamp8("deletedAt", {
820
+ deletedAt: timestamp10("deletedAt", {
713
821
  mode: "date",
714
822
  fsp: 3
715
823
  })
716
824
  }, (up) => ({
717
- pk: primaryKey7({
825
+ pk: primaryKey9({
718
826
  columns: [
719
827
  up.userId,
720
828
  up.permissionId
721
829
  ]
722
830
  }),
723
- userIdIdx: index6("userId_idx").on(up.userId),
724
- permissionIdIdx: index6("permissionId_idx").on(up.permissionId)
831
+ userIdIdx: index9("userId_idx").on(up.userId),
832
+ permissionIdIdx: index9("permissionId_idx").on(up.permissionId)
725
833
  }));
726
834
  }
727
835
  __name(getUserPermissionsSchema, "getUserPermissionsSchema");
@@ -729,7 +837,7 @@ function getUserPermissionsRelationsSchema(mysqlTable) {
729
837
  const userPermissions = getUserPermissionsSchema(mysqlTable);
730
838
  const users = getUsersSchema(mysqlTable);
731
839
  const permissions = getPermissionsSchema(mysqlTable);
732
- return relations9(userPermissions, ({ one }) => ({
840
+ return relations11(userPermissions, ({ one }) => ({
733
841
  user: one(users, {
734
842
  fields: [
735
843
  userPermissions.userId
@@ -752,44 +860,98 @@ function getUserPermissionsRelationsSchema(mysqlTable) {
752
860
  }
753
861
  __name(getUserPermissionsRelationsSchema, "getUserPermissionsRelationsSchema");
754
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
+
755
917
  // src/lib/mysql/schemas/auth/user-roles.ts
756
- import { relations as relations11 } from "drizzle-orm";
757
- import { boolean as boolean6, index as index8, 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";
758
920
 
759
921
  // src/lib/mysql/schemas/auth/roles.ts
760
- import { relations as relations10 } from "drizzle-orm";
761
- import { boolean as boolean5, index as index7, 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";
762
924
  function getRolesSchema(mysqlTable) {
763
- return mysqlTable("role", {
764
- id: varchar10("id", {
925
+ return mysqlTable("Role", {
926
+ id: varchar13("id", {
765
927
  length: 255
766
928
  }).notNull().primaryKey(),
767
- name: varchar10("name", {
929
+ name: varchar13("name", {
768
930
  length: 255
769
931
  }).notNull().unique(),
770
- description: text2("description"),
771
- active: boolean5("active").notNull().default(true),
772
- createdAt: timestamp9("createdAt", {
932
+ description: text3("description"),
933
+ active: boolean4("active").notNull().default(true),
934
+ createdAt: timestamp12("createdAt", {
773
935
  mode: "date",
774
936
  fsp: 3
775
937
  }).defaultNow(),
776
- updatedAt: timestamp9("updatedAt", {
938
+ updatedAt: timestamp12("updatedAt", {
777
939
  mode: "date",
778
940
  fsp: 3
779
941
  }).defaultNow(),
780
- deletedAt: timestamp9("deletedAt", {
942
+ deletedAt: timestamp12("deletedAt", {
781
943
  mode: "date",
782
944
  fsp: 3
783
945
  })
784
946
  }, (role) => ({
785
- nameIdx: index7("name_idx").on(role.name)
947
+ nameIdx: index11("name_idx").on(role.name)
786
948
  }));
787
949
  }
788
950
  __name(getRolesSchema, "getRolesSchema");
789
951
  function getRolesRelationsSchema(mysqlTable) {
790
952
  const roles = getRolesSchema(mysqlTable);
791
953
  const userRoles = getUserRolesSchema(mysqlTable);
792
- return relations10(roles, ({ many }) => ({
954
+ return relations13(roles, ({ many }) => ({
793
955
  userRoles: many(userRoles, {
794
956
  relationName: "role"
795
957
  })
@@ -799,35 +961,35 @@ __name(getRolesRelationsSchema, "getRolesRelationsSchema");
799
961
 
800
962
  // src/lib/mysql/schemas/auth/user-roles.ts
801
963
  function getUserRolesSchema(mysqlTable) {
802
- return mysqlTable("userRole", {
803
- userId: varchar11("userId", {
964
+ return mysqlTable("UserRole", {
965
+ userId: varchar14("userId", {
804
966
  length: 255
805
967
  }).notNull(),
806
- roleId: varchar11("roleId", {
968
+ roleId: varchar14("roleId", {
807
969
  length: 255
808
970
  }).notNull(),
809
- active: boolean6("active").notNull().default(true),
810
- createdAt: timestamp10("createdAt", {
971
+ active: boolean5("active").notNull().default(true),
972
+ createdAt: timestamp13("createdAt", {
811
973
  mode: "date",
812
974
  fsp: 3
813
975
  }).defaultNow(),
814
- updatedAt: timestamp10("updatedAt", {
976
+ updatedAt: timestamp13("updatedAt", {
815
977
  mode: "date",
816
978
  fsp: 3
817
979
  }).defaultNow(),
818
- deletedAt: timestamp10("deletedAt", {
980
+ deletedAt: timestamp13("deletedAt", {
819
981
  mode: "date",
820
982
  fsp: 3
821
983
  })
822
984
  }, (ur) => ({
823
- pk: primaryKey8({
985
+ pk: primaryKey11({
824
986
  columns: [
825
987
  ur.userId,
826
988
  ur.roleId
827
989
  ]
828
990
  }),
829
- userIdIdx: index8("userId_idx").on(ur.userId),
830
- roleIdIdx: index8("roleId_idx").on(ur.roleId)
991
+ userIdIdx: index12("userId_idx").on(ur.userId),
992
+ roleIdIdx: index12("roleId_idx").on(ur.roleId)
831
993
  }));
832
994
  }
833
995
  __name(getUserRolesSchema, "getUserRolesSchema");
@@ -835,7 +997,7 @@ function getUserRolesRelationsSchema(mysqlTable) {
835
997
  const userRoles = getUserRolesSchema(mysqlTable);
836
998
  const users = getUsersSchema(mysqlTable);
837
999
  const roles = getRolesSchema(mysqlTable);
838
- return relations11(userRoles, ({ one }) => ({
1000
+ return relations14(userRoles, ({ one }) => ({
839
1001
  user: one(users, {
840
1002
  fields: [
841
1003
  userRoles.userId
@@ -860,35 +1022,35 @@ __name(getUserRolesRelationsSchema, "getUserRolesRelationsSchema");
860
1022
 
861
1023
  // src/lib/mysql/schemas/auth/users.ts
862
1024
  function getUsersSchema(mysqlTable) {
863
- return mysqlTable("user", {
864
- id: varchar12("id", {
1025
+ return mysqlTable("User", {
1026
+ id: varchar15("id", {
865
1027
  length: 255
866
1028
  }).notNull().primaryKey(),
867
- name: varchar12("name", {
1029
+ name: varchar15("name", {
868
1030
  length: 255
869
1031
  }),
870
- role: mysqlEnum2("role", [
871
- "user",
872
- "admin"
873
- ]).default("user"),
874
- email: varchar12("email", {
1032
+ role: varchar15("role", {
1033
+ length: 191
1034
+ }).notNull().default("user"),
1035
+ email: varchar15("email", {
875
1036
  length: 255
876
1037
  }).notNull().unique(),
877
- emailVerified: timestamp11("emailVerified", {
1038
+ fields: json10("fields").$type().default({}),
1039
+ emailVerified: timestamp14("emailVerified", {
878
1040
  mode: "date",
879
1041
  fsp: 3
880
1042
  }),
881
- image: varchar12("image", {
1043
+ image: varchar15("image", {
882
1044
  length: 255
883
1045
  }),
884
- createdAt: timestamp11("createdAt", {
1046
+ createdAt: timestamp14("createdAt", {
885
1047
  mode: "date",
886
1048
  fsp: 3
887
- }).default(sql6`CURRENT_TIMESTAMP(3)`)
1049
+ }).default(sql10`CURRENT_TIMESTAMP(3)`)
888
1050
  }, (user) => ({
889
- emailIdx: index9("email_idx").on(user.email),
890
- roleIdx: index9("role_idx").on(user.role),
891
- createdAtIdx: index9("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)
892
1054
  }));
893
1055
  }
894
1056
  __name(getUsersSchema, "getUsersSchema");
@@ -901,7 +1063,9 @@ function getUsersRelationsSchema(mysqlTable) {
901
1063
  const contentContributions = getContentContributionsSchema(mysqlTable);
902
1064
  const contentResource = getContentResourceSchema(mysqlTable);
903
1065
  const purchases = getPurchaseSchema(mysqlTable);
904
- return relations12(users, ({ many }) => ({
1066
+ const comments = getCommentsSchema(mysqlTable);
1067
+ const userPrefs = getUserPrefsSchema(mysqlTable);
1068
+ return relations15(users, ({ many }) => ({
905
1069
  accounts: many(accounts, {
906
1070
  relationName: "user"
907
1071
  }),
@@ -922,133 +1086,92 @@ function getUsersRelationsSchema(mysqlTable) {
922
1086
  }),
923
1087
  createdContent: many(contentResource, {
924
1088
  relationName: "user"
1089
+ }),
1090
+ comments: many(comments, {
1091
+ relationName: "user"
1092
+ }),
1093
+ prefs: many(userPrefs, {
1094
+ relationName: "user"
925
1095
  })
926
1096
  }));
927
1097
  }
928
1098
  __name(getUsersRelationsSchema, "getUsersRelationsSchema");
929
1099
 
930
- // src/lib/mysql/schemas/content/content-resource.ts
931
- function getContentResourceSchema(mysqlTable) {
932
- return mysqlTable("contentResource", {
933
- id: varchar13("id", {
1100
+ // src/lib/mysql/schemas/content/content-contributions.ts
1101
+ function getContentContributionsSchema(mysqlTable) {
1102
+ return mysqlTable("ContentContribution", {
1103
+ id: varchar16("id", {
934
1104
  length: 255
935
1105
  }).notNull().primaryKey(),
936
- type: varchar13("type", {
1106
+ userId: varchar16("userId", {
937
1107
  length: 255
938
1108
  }).notNull(),
939
- createdById: varchar13("createdById", {
1109
+ contentId: varchar16("contentId", {
940
1110
  length: 255
941
1111
  }).notNull(),
942
- fields: json6("fields").$type().default({}),
943
- createdAt: timestamp12("createdAt", {
1112
+ contributionTypeId: varchar16("contributionTypeId", {
1113
+ length: 255
1114
+ }).notNull(),
1115
+ active: boolean6("active").notNull().default(true),
1116
+ createdAt: timestamp15("createdAt", {
944
1117
  mode: "date",
945
1118
  fsp: 3
946
- }).default(sql7`CURRENT_TIMESTAMP(3)`),
947
- updatedAt: timestamp12("updatedAt", {
1119
+ }).defaultNow(),
1120
+ updatedAt: timestamp15("updatedAt", {
948
1121
  mode: "date",
949
1122
  fsp: 3
950
- }).default(sql7`CURRENT_TIMESTAMP(3)`),
951
- deletedAt: timestamp12("deletedAt", {
1123
+ }).defaultNow(),
1124
+ deletedAt: timestamp15("deletedAt", {
952
1125
  mode: "date",
953
1126
  fsp: 3
954
1127
  })
955
- }, (cm) => ({
956
- typeIdx: index10("type_idx").on(cm.type),
957
- createdByIdx: index10("createdById_idx").on(cm.createdById),
958
- createdAtIdx: index10("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)
959
1132
  }));
960
1133
  }
961
- __name(getContentResourceSchema, "getContentResourceSchema");
962
- function getContentResourceRelationsSchema(mysqlTable) {
963
- const contentResource = getContentResourceSchema(mysqlTable);
1134
+ __name(getContentContributionsSchema, "getContentContributionsSchema");
1135
+ function getContentContributionRelationsSchema(mysqlTable) {
1136
+ const contentContributions = getContentContributionsSchema(mysqlTable);
964
1137
  const users = getUsersSchema(mysqlTable);
965
- const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
966
- const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
967
- return relations13(contentResource, ({ one, many }) => ({
968
- createdBy: one(users, {
1138
+ const contentResource = getContentResourceSchema(mysqlTable);
1139
+ const contributionTypes = getContributionTypesSchema(mysqlTable);
1140
+ return relations16(contentContributions, ({ one }) => ({
1141
+ user: one(users, {
969
1142
  fields: [
970
- contentResource.createdById
1143
+ contentContributions.userId
971
1144
  ],
972
1145
  references: [
973
1146
  users.id
974
1147
  ],
975
1148
  relationName: "user"
976
1149
  }),
977
- resources: many(contentResourceResource, {
978
- relationName: "resourceOf"
979
- }),
980
- resourceOf: many(contentResourceResource, {
981
- relationName: "resource"
982
- }),
983
- resourceProducts: many(contentResourceProduct, {
984
- relationName: "resource"
985
- })
986
- }));
987
- }
988
- __name(getContentResourceRelationsSchema, "getContentResourceRelationsSchema");
989
-
990
- // src/lib/mysql/schemas/content/content-resource-resource.ts
991
- function getContentResourceResourceSchema(mysqlTable) {
992
- return mysqlTable("contentResourceResource", {
993
- resourceOfId: varchar14("resourceOfId", {
994
- length: 255
995
- }).notNull(),
996
- resourceId: varchar14("resourceId", {
997
- length: 255
998
- }).notNull(),
999
- position: double2("position").notNull().default(0),
1000
- metadata: json7("metadata").$type().default({}),
1001
- createdAt: timestamp13("createdAt", {
1002
- mode: "date",
1003
- fsp: 3
1004
- }).default(sql8`CURRENT_TIMESTAMP(3)`),
1005
- updatedAt: timestamp13("updatedAt", {
1006
- mode: "date",
1007
- fsp: 3
1008
- }).default(sql8`CURRENT_TIMESTAMP(3)`),
1009
- deletedAt: timestamp13("deletedAt", {
1010
- mode: "date",
1011
- fsp: 3
1012
- })
1013
- }, (crr) => ({
1014
- pk: primaryKey9({
1015
- columns: [
1016
- crr.resourceOfId,
1017
- crr.resourceId
1018
- ]
1019
- }),
1020
- contentResourceIdIdx: index11("contentResourceId_idx").on(crr.resourceOfId),
1021
- resourceIdIdx: index11("resourceId_idx").on(crr.resourceId)
1022
- }));
1023
- }
1024
- __name(getContentResourceResourceSchema, "getContentResourceResourceSchema");
1025
- function getContentResourceResourceRelationsSchema(mysqlTable) {
1026
- const contentResource = getContentResourceSchema(mysqlTable);
1027
- const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
1028
- return relations14(contentResourceResource, ({ one }) => ({
1029
- resourceOf: one(contentResource, {
1150
+ content: one(contentResource, {
1030
1151
  fields: [
1031
- contentResourceResource.resourceOfId
1152
+ contentContributions.contentId
1032
1153
  ],
1033
1154
  references: [
1034
1155
  contentResource.id
1035
1156
  ],
1036
- relationName: "resourceOf"
1157
+ relationName: "contributions"
1037
1158
  }),
1038
- resource: one(contentResource, {
1159
+ contributionType: one(contributionTypes, {
1039
1160
  fields: [
1040
- contentResourceResource.resourceId
1161
+ contentContributions.contributionTypeId
1041
1162
  ],
1042
1163
  references: [
1043
- contentResource.id
1164
+ contributionTypes.id
1044
1165
  ],
1045
- relationName: "resource"
1166
+ relationName: "contributionType"
1046
1167
  })
1047
1168
  }));
1048
1169
  }
1049
- __name(getContentResourceResourceRelationsSchema, "getContentResourceResourceRelationsSchema");
1170
+ __name(getContentContributionRelationsSchema, "getContentContributionRelationsSchema");
1050
1171
 
1051
1172
  export {
1173
+ getContentContributionsSchema,
1174
+ getContentContributionRelationsSchema,
1052
1175
  getContentResourceResourceSchema,
1053
1176
  getContentResourceResourceRelationsSchema,
1054
1177
  getContentResourceSchema,
@@ -1063,12 +1186,14 @@ export {
1063
1186
  getCouponRelationsSchema,
1064
1187
  getPurchaseSchema,
1065
1188
  getPurchaseRelationsSchema,
1189
+ getCommentsSchema,
1190
+ getCommentRelationsSchema,
1066
1191
  getCommunicationPreferencesSchema,
1067
1192
  getCommunicationPreferencesRelationsSchema,
1068
- getContentContributionsSchema,
1069
- getContentContributionRelationsSchema,
1070
1193
  getUserPermissionsSchema,
1071
1194
  getUserPermissionsRelationsSchema,
1195
+ getUserPrefsSchema,
1196
+ getUserPrefsRelationsSchema,
1072
1197
  getRolesSchema,
1073
1198
  getRolesRelationsSchema,
1074
1199
  getUserRolesSchema,
@@ -1078,4 +1203,4 @@ export {
1078
1203
  getAccountsSchema,
1079
1204
  getAccountsRelationsSchema
1080
1205
  };
1081
- //# sourceMappingURL=chunk-N7UDJAI3.js.map
1206
+ //# sourceMappingURL=chunk-FRA4ZCRA.js.map