@coursebuilder/adapter-drizzle 0.5.2 → 1.0.1

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 (287) hide show
  1. package/dist/{chunk-QQA7STVO.js → chunk-3GONHHMY.js} +2 -2
  2. package/dist/{chunk-2UU2F4DM.js → chunk-6MRFUIH5.js} +6 -2
  3. package/dist/{chunk-XIGJFVUM.js → chunk-6YPHJWS2.js} +9 -2
  4. package/dist/{chunk-3NUCFLQJ.js → chunk-BLDW3QUS.js} +7 -3
  5. package/dist/{chunk-QP6YMUQX.js → chunk-DKJO4Y3K.js} +7 -3
  6. package/dist/{chunk-P4VXXTVA.js → chunk-EHRARBRS.js} +4 -1
  7. package/dist/{chunk-YVVXDJHI.js → chunk-ET3QAIY7.js} +9 -2
  8. package/dist/{chunk-27UC2HEP.js → chunk-FPAQINSA.js} +7 -3
  9. package/dist/{chunk-XJXCDN7B.js → chunk-HWIQUI7O.js} +8 -4
  10. package/dist/{chunk-4ZWS76VQ.js → chunk-KPBVZ44W.js} +7 -3
  11. package/dist/chunk-LPJ2P2KJ.js +2122 -0
  12. package/dist/{chunk-6ON2O6UD.js → chunk-MGZMGDQ5.js} +7 -3
  13. package/dist/{chunk-ZYQYJNLK.js → chunk-MOV5TUON.js} +409 -127
  14. package/dist/{chunk-KDEWFXEP.js → chunk-MP4CUWYC.js} +6 -2
  15. package/dist/{chunk-YMFPIZMO.js → chunk-OBUGOZKM.js} +2 -2
  16. package/dist/{chunk-EFVZ7IN4.js → chunk-PBTEHA7F.js} +2 -2
  17. package/dist/{chunk-GINRTL6J.js → chunk-WJWJ6E5Y.js} +6 -2
  18. package/dist/{chunk-YGRYHMCG.js → chunk-WPJZAYX7.js} +7 -3
  19. package/dist/{chunk-6SLQW6OM.js → chunk-YQNIXCD3.js} +5 -2
  20. package/dist/index.js +19 -20
  21. package/dist/lib/mysql/index.cjs +1889 -994
  22. package/dist/lib/mysql/index.cjs.map +1 -1
  23. package/dist/lib/mysql/index.d.cts +4641 -1889
  24. package/dist/lib/mysql/index.d.ts +4641 -1889
  25. package/dist/lib/mysql/index.js +19 -20
  26. package/dist/lib/mysql/schemas/auth/accounts.cjs +121 -97
  27. package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
  28. package/dist/lib/mysql/schemas/auth/accounts.js +10 -11
  29. package/dist/lib/mysql/schemas/auth/device-access-token.cjs +116 -89
  30. package/dist/lib/mysql/schemas/auth/device-access-token.cjs.map +1 -1
  31. package/dist/lib/mysql/schemas/auth/device-access-token.d.cts +16 -0
  32. package/dist/lib/mysql/schemas/auth/device-access-token.d.ts +16 -0
  33. package/dist/lib/mysql/schemas/auth/device-access-token.js +11 -12
  34. package/dist/lib/mysql/schemas/auth/device-verification.cjs +115 -91
  35. package/dist/lib/mysql/schemas/auth/device-verification.cjs.map +1 -1
  36. package/dist/lib/mysql/schemas/auth/device-verification.js +11 -12
  37. package/dist/lib/mysql/schemas/auth/profiles.cjs +254 -0
  38. package/dist/lib/mysql/schemas/auth/profiles.cjs.map +1 -0
  39. package/dist/lib/mysql/schemas/auth/profiles.d.cts +112 -0
  40. package/dist/lib/mysql/schemas/auth/profiles.d.ts +112 -0
  41. package/dist/lib/mysql/schemas/auth/profiles.js +20 -0
  42. package/dist/lib/mysql/schemas/auth/profiles.js.map +1 -0
  43. package/dist/lib/mysql/schemas/auth/role-permissions.cjs +112 -83
  44. package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
  45. package/dist/lib/mysql/schemas/auth/role-permissions.js +11 -12
  46. package/dist/lib/mysql/schemas/auth/roles.cjs +116 -83
  47. package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
  48. package/dist/lib/mysql/schemas/auth/roles.d.cts +16 -0
  49. package/dist/lib/mysql/schemas/auth/roles.d.ts +16 -0
  50. package/dist/lib/mysql/schemas/auth/roles.js +10 -11
  51. package/dist/lib/mysql/schemas/auth/sessions.cjs +111 -87
  52. package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
  53. package/dist/lib/mysql/schemas/auth/sessions.js +11 -12
  54. package/dist/lib/mysql/schemas/auth/user-permissions.cjs +116 -88
  55. package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
  56. package/dist/lib/mysql/schemas/auth/user-permissions.d.cts +16 -0
  57. package/dist/lib/mysql/schemas/auth/user-permissions.d.ts +16 -0
  58. package/dist/lib/mysql/schemas/auth/user-permissions.js +10 -11
  59. package/dist/lib/mysql/schemas/auth/user-prefs.cjs +120 -92
  60. package/dist/lib/mysql/schemas/auth/user-prefs.cjs.map +1 -1
  61. package/dist/lib/mysql/schemas/auth/user-prefs.d.cts +16 -0
  62. package/dist/lib/mysql/schemas/auth/user-prefs.d.ts +16 -0
  63. package/dist/lib/mysql/schemas/auth/user-prefs.js +10 -11
  64. package/dist/lib/mysql/schemas/auth/user-roles.cjs +119 -86
  65. package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
  66. package/dist/lib/mysql/schemas/auth/user-roles.d.cts +16 -0
  67. package/dist/lib/mysql/schemas/auth/user-roles.d.ts +16 -0
  68. package/dist/lib/mysql/schemas/auth/user-roles.js +10 -11
  69. package/dist/lib/mysql/schemas/auth/users.cjs +355 -223
  70. package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
  71. package/dist/lib/mysql/schemas/auth/users.d.cts +2 -0
  72. package/dist/lib/mysql/schemas/auth/users.d.ts +2 -0
  73. package/dist/lib/mysql/schemas/auth/users.js +10 -11
  74. package/dist/lib/mysql/schemas/commerce/coupon.cjs +155 -111
  75. package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
  76. package/dist/lib/mysql/schemas/commerce/coupon.d.cts +16 -0
  77. package/dist/lib/mysql/schemas/commerce/coupon.d.ts +16 -0
  78. package/dist/lib/mysql/schemas/commerce/coupon.js +10 -11
  79. package/dist/lib/mysql/schemas/commerce/merchant-account.cjs +5 -1
  80. package/dist/lib/mysql/schemas/commerce/merchant-account.cjs.map +1 -1
  81. package/dist/lib/mysql/schemas/commerce/merchant-account.d.cts +16 -0
  82. package/dist/lib/mysql/schemas/commerce/merchant-account.d.ts +16 -0
  83. package/dist/lib/mysql/schemas/commerce/merchant-account.js +1 -1
  84. package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs +218 -17
  85. package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs.map +1 -1
  86. package/dist/lib/mysql/schemas/commerce/merchant-charge.d.cts +33 -0
  87. package/dist/lib/mysql/schemas/commerce/merchant-charge.d.ts +33 -0
  88. package/dist/lib/mysql/schemas/commerce/merchant-charge.js +11 -4
  89. package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs +5 -1
  90. package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs.map +1 -1
  91. package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.cts +16 -0
  92. package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.ts +16 -0
  93. package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +1 -1
  94. package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs +5 -1
  95. package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs.map +1 -1
  96. package/dist/lib/mysql/schemas/commerce/merchant-customer.d.cts +16 -0
  97. package/dist/lib/mysql/schemas/commerce/merchant-customer.d.ts +16 -0
  98. package/dist/lib/mysql/schemas/commerce/merchant-customer.js +1 -1
  99. package/dist/lib/mysql/schemas/commerce/merchant-price.cjs +5 -1
  100. package/dist/lib/mysql/schemas/commerce/merchant-price.cjs.map +1 -1
  101. package/dist/lib/mysql/schemas/commerce/merchant-price.d.cts +16 -0
  102. package/dist/lib/mysql/schemas/commerce/merchant-price.d.ts +16 -0
  103. package/dist/lib/mysql/schemas/commerce/merchant-price.js +1 -1
  104. package/dist/lib/mysql/schemas/commerce/merchant-product.cjs +5 -1
  105. package/dist/lib/mysql/schemas/commerce/merchant-product.cjs.map +1 -1
  106. package/dist/lib/mysql/schemas/commerce/merchant-product.d.cts +16 -0
  107. package/dist/lib/mysql/schemas/commerce/merchant-product.d.ts +16 -0
  108. package/dist/lib/mysql/schemas/commerce/merchant-product.js +1 -1
  109. package/dist/lib/mysql/schemas/commerce/merchant-session.cjs +5 -1
  110. package/dist/lib/mysql/schemas/commerce/merchant-session.cjs.map +1 -1
  111. package/dist/lib/mysql/schemas/commerce/merchant-session.d.cts +16 -0
  112. package/dist/lib/mysql/schemas/commerce/merchant-session.d.ts +16 -0
  113. package/dist/lib/mysql/schemas/commerce/merchant-session.js +1 -1
  114. package/dist/lib/mysql/schemas/commerce/merchant-subscription.cjs +323 -0
  115. package/dist/lib/mysql/schemas/commerce/merchant-subscription.cjs.map +1 -0
  116. package/dist/lib/mysql/schemas/commerce/merchant-subscription.d.cts +161 -0
  117. package/dist/lib/mysql/schemas/commerce/merchant-subscription.d.ts +161 -0
  118. package/dist/lib/mysql/schemas/commerce/merchant-subscription.js +20 -0
  119. package/dist/lib/mysql/schemas/commerce/merchant-subscription.js.map +1 -0
  120. package/dist/lib/mysql/schemas/commerce/price.cjs +115 -79
  121. package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
  122. package/dist/lib/mysql/schemas/commerce/price.d.cts +16 -0
  123. package/dist/lib/mysql/schemas/commerce/price.d.ts +16 -0
  124. package/dist/lib/mysql/schemas/commerce/price.js +10 -11
  125. package/dist/lib/mysql/schemas/commerce/product.cjs +134 -94
  126. package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
  127. package/dist/lib/mysql/schemas/commerce/product.d.cts +16 -0
  128. package/dist/lib/mysql/schemas/commerce/product.d.ts +16 -0
  129. package/dist/lib/mysql/schemas/commerce/product.js +10 -11
  130. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +153 -117
  131. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
  132. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.cts +16 -0
  133. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.ts +16 -0
  134. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +11 -12
  135. package/dist/lib/mysql/schemas/commerce/purchase.cjs +307 -181
  136. package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
  137. package/dist/lib/mysql/schemas/commerce/purchase.d.cts +34 -0
  138. package/dist/lib/mysql/schemas/commerce/purchase.d.ts +34 -0
  139. package/dist/lib/mysql/schemas/commerce/purchase.js +10 -11
  140. package/dist/lib/mysql/schemas/commerce/subscription.cjs +351 -0
  141. package/dist/lib/mysql/schemas/commerce/subscription.cjs.map +1 -0
  142. package/dist/lib/mysql/schemas/commerce/subscription.d.cts +130 -0
  143. package/dist/lib/mysql/schemas/commerce/subscription.d.ts +130 -0
  144. package/dist/lib/mysql/schemas/commerce/subscription.js +20 -0
  145. package/dist/lib/mysql/schemas/commerce/subscription.js.map +1 -0
  146. package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs +116 -84
  147. package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs.map +1 -1
  148. package/dist/lib/mysql/schemas/commerce/upgradable-products.d.cts +16 -0
  149. package/dist/lib/mysql/schemas/commerce/upgradable-products.d.ts +16 -0
  150. package/dist/lib/mysql/schemas/commerce/upgradable-products.js +11 -12
  151. package/dist/lib/mysql/schemas/communication/comment.cjs +161 -92
  152. package/dist/lib/mysql/schemas/communication/comment.cjs.map +1 -1
  153. package/dist/lib/mysql/schemas/communication/comment.d.cts +17 -0
  154. package/dist/lib/mysql/schemas/communication/comment.d.ts +17 -0
  155. package/dist/lib/mysql/schemas/communication/comment.js +10 -11
  156. package/dist/lib/mysql/schemas/communication/communication-channel.cjs +5 -1
  157. package/dist/lib/mysql/schemas/communication/communication-channel.cjs.map +1 -1
  158. package/dist/lib/mysql/schemas/communication/communication-channel.d.cts +16 -0
  159. package/dist/lib/mysql/schemas/communication/communication-channel.d.ts +16 -0
  160. package/dist/lib/mysql/schemas/communication/communication-channel.js +1 -1
  161. package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs +3 -0
  162. package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs.map +1 -1
  163. package/dist/lib/mysql/schemas/communication/communication-preference-types.d.cts +16 -0
  164. package/dist/lib/mysql/schemas/communication/communication-preference-types.d.ts +16 -0
  165. package/dist/lib/mysql/schemas/communication/communication-preference-types.js +1 -1
  166. package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +189 -110
  167. package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
  168. package/dist/lib/mysql/schemas/communication/communication-preferences.d.cts +33 -0
  169. package/dist/lib/mysql/schemas/communication/communication-preferences.d.ts +33 -0
  170. package/dist/lib/mysql/schemas/communication/communication-preferences.js +10 -11
  171. package/dist/lib/mysql/schemas/content/content-contributions.cjs +199 -116
  172. package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
  173. package/dist/lib/mysql/schemas/content/content-contributions.d.cts +33 -0
  174. package/dist/lib/mysql/schemas/content/content-contributions.d.ts +33 -0
  175. package/dist/lib/mysql/schemas/content/content-contributions.js +10 -11
  176. package/dist/lib/mysql/schemas/content/content-resource-product.cjs +118 -79
  177. package/dist/lib/mysql/schemas/content/content-resource-product.cjs.map +1 -1
  178. package/dist/lib/mysql/schemas/content/content-resource-product.d.cts +16 -0
  179. package/dist/lib/mysql/schemas/content/content-resource-product.d.ts +16 -0
  180. package/dist/lib/mysql/schemas/content/content-resource-product.js +10 -11
  181. package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +128 -93
  182. package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
  183. package/dist/lib/mysql/schemas/content/content-resource-resource.d.cts +16 -0
  184. package/dist/lib/mysql/schemas/content/content-resource-resource.d.ts +16 -0
  185. package/dist/lib/mysql/schemas/content/content-resource-resource.js +10 -11
  186. package/dist/lib/mysql/schemas/content/content-resource-tag.cjs +140 -101
  187. package/dist/lib/mysql/schemas/content/content-resource-tag.cjs.map +1 -1
  188. package/dist/lib/mysql/schemas/content/content-resource-tag.d.cts +16 -0
  189. package/dist/lib/mysql/schemas/content/content-resource-tag.d.ts +16 -0
  190. package/dist/lib/mysql/schemas/content/content-resource-tag.js +10 -11
  191. package/dist/lib/mysql/schemas/content/content-resource-version.cjs +142 -107
  192. package/dist/lib/mysql/schemas/content/content-resource-version.cjs.map +1 -1
  193. package/dist/lib/mysql/schemas/content/content-resource-version.d.cts +16 -0
  194. package/dist/lib/mysql/schemas/content/content-resource-version.d.ts +16 -0
  195. package/dist/lib/mysql/schemas/content/content-resource-version.js +10 -11
  196. package/dist/lib/mysql/schemas/content/content-resource.cjs +260 -161
  197. package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
  198. package/dist/lib/mysql/schemas/content/content-resource.d.cts +33 -0
  199. package/dist/lib/mysql/schemas/content/content-resource.d.ts +33 -0
  200. package/dist/lib/mysql/schemas/content/content-resource.js +10 -11
  201. package/dist/lib/mysql/schemas/content/contribution-types.cjs +5 -1
  202. package/dist/lib/mysql/schemas/content/contribution-types.cjs.map +1 -1
  203. package/dist/lib/mysql/schemas/content/contribution-types.d.cts +16 -0
  204. package/dist/lib/mysql/schemas/content/contribution-types.d.ts +16 -0
  205. package/dist/lib/mysql/schemas/content/contribution-types.js +1 -1
  206. package/dist/lib/mysql/schemas/content/lesson-progress.cjs +8 -1
  207. package/dist/lib/mysql/schemas/content/lesson-progress.cjs.map +1 -1
  208. package/dist/lib/mysql/schemas/content/lesson-progress.d.cts +32 -0
  209. package/dist/lib/mysql/schemas/content/lesson-progress.d.ts +32 -0
  210. package/dist/lib/mysql/schemas/content/lesson-progress.js +1 -1
  211. package/dist/lib/mysql/schemas/content/resource-progress.cjs +8 -1
  212. package/dist/lib/mysql/schemas/content/resource-progress.cjs.map +1 -1
  213. package/dist/lib/mysql/schemas/content/resource-progress.d.cts +32 -0
  214. package/dist/lib/mysql/schemas/content/resource-progress.d.ts +32 -0
  215. package/dist/lib/mysql/schemas/content/resource-progress.js +1 -1
  216. package/dist/lib/mysql/schemas/content/tag-tag.cjs +121 -89
  217. package/dist/lib/mysql/schemas/content/tag-tag.cjs.map +1 -1
  218. package/dist/lib/mysql/schemas/content/tag-tag.d.cts +16 -0
  219. package/dist/lib/mysql/schemas/content/tag-tag.d.ts +16 -0
  220. package/dist/lib/mysql/schemas/content/tag-tag.js +10 -11
  221. package/dist/lib/mysql/schemas/content/tag.cjs +136 -100
  222. package/dist/lib/mysql/schemas/content/tag.cjs.map +1 -1
  223. package/dist/lib/mysql/schemas/content/tag.d.cts +16 -0
  224. package/dist/lib/mysql/schemas/content/tag.d.ts +16 -0
  225. package/dist/lib/mysql/schemas/content/tag.js +10 -11
  226. package/dist/lib/mysql/schemas/org/organization-membership-roles.cjs +339 -0
  227. package/dist/lib/mysql/schemas/org/organization-membership-roles.cjs.map +1 -0
  228. package/dist/lib/mysql/schemas/org/organization-membership-roles.d.cts +130 -0
  229. package/dist/lib/mysql/schemas/org/organization-membership-roles.d.ts +130 -0
  230. package/dist/lib/mysql/schemas/org/organization-membership-roles.js +20 -0
  231. package/dist/lib/mysql/schemas/org/organization-membership-roles.js.map +1 -0
  232. package/dist/lib/mysql/schemas/org/organization-memberships.cjs +420 -0
  233. package/dist/lib/mysql/schemas/org/organization-memberships.cjs.map +1 -0
  234. package/dist/lib/mysql/schemas/org/organization-memberships.d.cts +132 -0
  235. package/dist/lib/mysql/schemas/org/organization-memberships.d.ts +132 -0
  236. package/dist/lib/mysql/schemas/org/organization-memberships.js +20 -0
  237. package/dist/lib/mysql/schemas/org/organization-memberships.js.map +1 -0
  238. package/dist/lib/mysql/schemas/org/organizations.cjs +359 -0
  239. package/dist/lib/mysql/schemas/org/organizations.cjs.map +1 -0
  240. package/dist/lib/mysql/schemas/org/organizations.d.cts +98 -0
  241. package/dist/lib/mysql/schemas/org/organizations.d.ts +98 -0
  242. package/dist/lib/mysql/schemas/org/organizations.js +20 -0
  243. package/dist/lib/mysql/schemas/org/organizations.js.map +1 -0
  244. package/package.json +4 -3
  245. package/src/lib/mysql/index.ts +354 -26
  246. package/src/lib/mysql/schemas/auth/device-access-token.ts +3 -0
  247. package/src/lib/mysql/schemas/auth/profiles.ts +50 -0
  248. package/src/lib/mysql/schemas/auth/roles.ts +9 -1
  249. package/src/lib/mysql/schemas/auth/user-permissions.ts +2 -0
  250. package/src/lib/mysql/schemas/auth/user-prefs.ts +2 -0
  251. package/src/lib/mysql/schemas/auth/user-roles.ts +2 -0
  252. package/src/lib/mysql/schemas/auth/users.ts +11 -1
  253. package/src/lib/mysql/schemas/commerce/coupon.ts +2 -0
  254. package/src/lib/mysql/schemas/commerce/merchant-account.ts +3 -0
  255. package/src/lib/mysql/schemas/commerce/merchant-charge.ts +16 -0
  256. package/src/lib/mysql/schemas/commerce/merchant-coupon.ts +3 -0
  257. package/src/lib/mysql/schemas/commerce/merchant-customer.ts +2 -0
  258. package/src/lib/mysql/schemas/commerce/merchant-price.ts +3 -0
  259. package/src/lib/mysql/schemas/commerce/merchant-product.ts +3 -0
  260. package/src/lib/mysql/schemas/commerce/merchant-session.ts +8 -1
  261. package/src/lib/mysql/schemas/commerce/merchant-subscription.ts +64 -0
  262. package/src/lib/mysql/schemas/commerce/price.ts +3 -0
  263. package/src/lib/mysql/schemas/commerce/product.ts +3 -0
  264. package/src/lib/mysql/schemas/commerce/purchase-user-transfer.ts +3 -0
  265. package/src/lib/mysql/schemas/commerce/purchase.ts +22 -0
  266. package/src/lib/mysql/schemas/commerce/subscription.ts +69 -0
  267. package/src/lib/mysql/schemas/commerce/upgradable-products.ts +2 -0
  268. package/src/lib/mysql/schemas/communication/comment.ts +13 -0
  269. package/src/lib/mysql/schemas/communication/communication-channel.ts +2 -0
  270. package/src/lib/mysql/schemas/communication/communication-preference-types.ts +1 -0
  271. package/src/lib/mysql/schemas/communication/communication-preferences.ts +14 -0
  272. package/src/lib/mysql/schemas/content/content-contributions.ts +14 -0
  273. package/src/lib/mysql/schemas/content/content-resource-product.ts +2 -0
  274. package/src/lib/mysql/schemas/content/content-resource-resource.ts +2 -0
  275. package/src/lib/mysql/schemas/content/content-resource-tag.ts +2 -0
  276. package/src/lib/mysql/schemas/content/content-resource-version.ts +2 -0
  277. package/src/lib/mysql/schemas/content/content-resource.ts +17 -0
  278. package/src/lib/mysql/schemas/content/contribution-types.ts +2 -0
  279. package/src/lib/mysql/schemas/content/lesson-progress.ts +7 -0
  280. package/src/lib/mysql/schemas/content/resource-progress.ts +7 -0
  281. package/src/lib/mysql/schemas/content/tag-tag.ts +2 -0
  282. package/src/lib/mysql/schemas/content/tag.ts +2 -0
  283. package/src/lib/mysql/schemas/org/organization-membership-roles.ts +75 -0
  284. package/src/lib/mysql/schemas/org/organization-memberships.ts +75 -0
  285. package/src/lib/mysql/schemas/org/organizations.ts +50 -0
  286. package/dist/chunk-JW2PFVLO.js +0 -1468
  287. package/dist/chunk-SRTIWWLG.js +0 -96
@@ -1,1468 +0,0 @@
1
- import {
2
- getContributionTypesSchema
3
- } from "./chunk-KDEWFXEP.js";
4
- import {
5
- getCommunicationChannelSchema
6
- } from "./chunk-GINRTL6J.js";
7
- import {
8
- getCommunicationPreferenceTypesSchema
9
- } from "./chunk-P4VXXTVA.js";
10
- import {
11
- getMerchantChargeSchema
12
- } from "./chunk-SRTIWWLG.js";
13
- import {
14
- getMerchantCouponSchema
15
- } from "./chunk-YGRYHMCG.js";
16
- import {
17
- getMerchantPriceSchema
18
- } from "./chunk-6ON2O6UD.js";
19
- import {
20
- getMerchantProductSchema
21
- } from "./chunk-4ZWS76VQ.js";
22
- import {
23
- getMerchantSessionSchema
24
- } from "./chunk-3NUCFLQJ.js";
25
- import {
26
- getPermissionsSchema
27
- } from "./chunk-LZHZDFNZ.js";
28
- import {
29
- __name
30
- } from "./chunk-H736K5TN.js";
31
-
32
- // src/lib/mysql/schemas/content/content-contributions.ts
33
- import { relations as relations20 } from "drizzle-orm";
34
- import { boolean as boolean6, index as index18, timestamp as timestamp19, varchar as varchar20 } from "drizzle-orm/mysql-core";
35
-
36
- // src/lib/mysql/schemas/auth/users.ts
37
- import { relations as relations19, sql as sql14 } from "drizzle-orm";
38
- import { index as index17, json as json13, timestamp as timestamp18, varchar as varchar19 } from "drizzle-orm/mysql-core";
39
-
40
- // src/lib/mysql/schemas/commerce/purchase.ts
41
- import { relations as relations11, sql as sql11 } from "drizzle-orm";
42
- import { decimal as decimal3, index as index9, json as json10, primaryKey as primaryKey8, timestamp as timestamp11, unique as unique3, varchar as varchar11 } from "drizzle-orm/mysql-core";
43
-
44
- // src/lib/mysql/schemas/commerce/coupon.ts
45
- import { relations as relations10, sql as sql10 } from "drizzle-orm";
46
- import { boolean, decimal as decimal2, index as index8, int as int4, json as json9, primaryKey as primaryKey7, timestamp as timestamp10, unique as unique2, varchar as varchar10 } from "drizzle-orm/mysql-core";
47
-
48
- // src/lib/mysql/schemas/commerce/product.ts
49
- import { relations as relations9, sql as sql9 } from "drizzle-orm";
50
- import { int as int3, json as json8, primaryKey as primaryKey6, timestamp as timestamp9, varchar as varchar9 } from "drizzle-orm/mysql-core";
51
-
52
- // src/lib/mysql/schemas/content/content-resource-product.ts
53
- import { relations as relations7, sql as sql7 } from "drizzle-orm";
54
- import { double as double4, index as index7, json as json6, primaryKey as primaryKey4, timestamp as timestamp7, varchar as varchar7 } from "drizzle-orm/mysql-core";
55
-
56
- // src/lib/mysql/schemas/content/content-resource.ts
57
- import { relations as relations6, sql as sql6 } from "drizzle-orm";
58
- import { index as index6, json as json5, timestamp as timestamp6, varchar as varchar6 } from "drizzle-orm/mysql-core";
59
-
60
- // src/lib/mysql/schemas/content/content-resource-resource.ts
61
- import { relations, sql } from "drizzle-orm";
62
- import { double, index, json, primaryKey, timestamp, varchar } from "drizzle-orm/mysql-core";
63
- function getContentResourceResourceSchema(mysqlTable) {
64
- return mysqlTable("ContentResourceResource", {
65
- resourceOfId: varchar("resourceOfId", {
66
- length: 255
67
- }).notNull(),
68
- resourceId: varchar("resourceId", {
69
- length: 255
70
- }).notNull(),
71
- position: double("position").notNull().default(0),
72
- metadata: json("metadata").$type().default({}),
73
- createdAt: timestamp("createdAt", {
74
- mode: "date",
75
- fsp: 3
76
- }).default(sql`CURRENT_TIMESTAMP(3)`),
77
- updatedAt: timestamp("updatedAt", {
78
- mode: "date",
79
- fsp: 3
80
- }).default(sql`CURRENT_TIMESTAMP(3)`),
81
- deletedAt: timestamp("deletedAt", {
82
- mode: "date",
83
- fsp: 3
84
- })
85
- }, (crr) => ({
86
- pk: primaryKey({
87
- columns: [
88
- crr.resourceOfId,
89
- crr.resourceId
90
- ]
91
- }),
92
- contentResourceIdIdx: index("contentResourceId_idx").on(crr.resourceOfId),
93
- resourceIdIdx: index("resourceId_idx").on(crr.resourceId)
94
- }));
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-tag.ts
124
- import { relations as relations4, sql as sql4 } from "drizzle-orm";
125
- import { double as double3, index as index4, primaryKey as primaryKey3, timestamp as timestamp4, varchar as varchar4 } from "drizzle-orm/mysql-core";
126
-
127
- // src/lib/mysql/schemas/content/tag.ts
128
- import { relations as relations3, sql as sql3 } from "drizzle-orm";
129
- import { index as index3, json as json3, timestamp as timestamp3, varchar as varchar3 } from "drizzle-orm/mysql-core";
130
-
131
- // src/lib/mysql/schemas/content/tag-tag.ts
132
- import { relations as relations2, sql as sql2 } from "drizzle-orm";
133
- import { double as double2, index as index2, json as json2, primaryKey as primaryKey2, timestamp as timestamp2, varchar as varchar2 } from "drizzle-orm/mysql-core";
134
- function getTagTagSchema(mysqlTable) {
135
- return mysqlTable("TagTag", {
136
- parentTagId: varchar2("parentTagId", {
137
- length: 255
138
- }).notNull(),
139
- childTagId: varchar2("childTagId", {
140
- length: 255
141
- }).notNull(),
142
- position: double2("position").notNull().default(0),
143
- metadata: json2("metadata").$type().default({}),
144
- createdAt: timestamp2("createdAt", {
145
- mode: "date",
146
- fsp: 3
147
- }).default(sql2`CURRENT_TIMESTAMP(3)`),
148
- updatedAt: timestamp2("updatedAt", {
149
- mode: "date",
150
- fsp: 3
151
- }).default(sql2`CURRENT_TIMESTAMP(3)`),
152
- deletedAt: timestamp2("deletedAt", {
153
- mode: "date",
154
- fsp: 3
155
- })
156
- }, (tt) => ({
157
- pk: primaryKey2({
158
- columns: [
159
- tt.parentTagId,
160
- tt.childTagId
161
- ]
162
- }),
163
- parentTagIdIdx: index2("parentTagId_idx").on(tt.parentTagId),
164
- childTagIdIdx: index2("childTagId_idx").on(tt.childTagId),
165
- positionIdx: index2("position_idx").on(tt.position)
166
- }));
167
- }
168
- __name(getTagTagSchema, "getTagTagSchema");
169
- function getTagTagRelationsSchema(mysqlTable) {
170
- const tag = getTagSchema(mysqlTable);
171
- const tagTag = getTagTagSchema(mysqlTable);
172
- return relations2(tagTag, ({ one }) => ({
173
- parentTag: one(tag, {
174
- fields: [
175
- tagTag.parentTagId
176
- ],
177
- references: [
178
- tag.id
179
- ],
180
- relationName: "parentTag"
181
- }),
182
- childTag: one(tag, {
183
- fields: [
184
- tagTag.childTagId
185
- ],
186
- references: [
187
- tag.id
188
- ],
189
- relationName: "childTag"
190
- })
191
- }));
192
- }
193
- __name(getTagTagRelationsSchema, "getTagTagRelationsSchema");
194
-
195
- // src/lib/mysql/schemas/content/tag.ts
196
- function getTagSchema(mysqlTable) {
197
- return mysqlTable("Tag", {
198
- id: varchar3("id", {
199
- length: 255
200
- }).notNull().primaryKey(),
201
- type: varchar3("type", {
202
- length: 255
203
- }).notNull(),
204
- fields: json3("fields").$type().default({}),
205
- createdAt: timestamp3("createdAt", {
206
- mode: "date",
207
- fsp: 3
208
- }).default(sql3`CURRENT_TIMESTAMP(3)`),
209
- updatedAt: timestamp3("updatedAt", {
210
- mode: "date",
211
- fsp: 3
212
- }).default(sql3`CURRENT_TIMESTAMP(3)`),
213
- deletedAt: timestamp3("deletedAt", {
214
- mode: "date",
215
- fsp: 3
216
- })
217
- }, (t) => ({
218
- typeIdx: index3("type_idx").on(t.type)
219
- }));
220
- }
221
- __name(getTagSchema, "getTagSchema");
222
- function getTagRelationsSchema(mysqlTable) {
223
- const tag = getTagSchema(mysqlTable);
224
- const contentResourceTag = getContentResourceTagSchema(mysqlTable);
225
- const tagTag = getTagTagSchema(mysqlTable);
226
- return relations3(tag, ({ many }) => ({
227
- resources: many(contentResourceTag, {
228
- relationName: "contentResource"
229
- }),
230
- parentTags: many(tagTag, {
231
- relationName: "childTag"
232
- }),
233
- childTags: many(tagTag, {
234
- relationName: "parentTag"
235
- })
236
- }));
237
- }
238
- __name(getTagRelationsSchema, "getTagRelationsSchema");
239
-
240
- // src/lib/mysql/schemas/content/content-resource-tag.ts
241
- function getContentResourceTagSchema(mysqlTable) {
242
- return mysqlTable("ContentResourceTag", {
243
- contentResourceId: varchar4("contentResourceId", {
244
- length: 255
245
- }).notNull(),
246
- tagId: varchar4("tagId", {
247
- length: 255
248
- }).notNull(),
249
- position: double3("position").notNull().default(0),
250
- createdAt: timestamp4("createdAt", {
251
- mode: "date",
252
- fsp: 3
253
- }).default(sql4`CURRENT_TIMESTAMP(3)`),
254
- updatedAt: timestamp4("updatedAt", {
255
- mode: "date",
256
- fsp: 3
257
- }).default(sql4`CURRENT_TIMESTAMP(3)`)
258
- }, (crt) => ({
259
- pk: primaryKey3({
260
- columns: [
261
- crt.contentResourceId,
262
- crt.tagId
263
- ]
264
- }),
265
- contentResourceIdIdx: index4("contentResourceId_idx").on(crt.contentResourceId),
266
- tagIdIdx: index4("tagId_idx").on(crt.tagId),
267
- positionIdx: index4("position_idx").on(crt.position)
268
- }));
269
- }
270
- __name(getContentResourceTagSchema, "getContentResourceTagSchema");
271
- function getContentResourceTagRelationsSchema(mysqlTable) {
272
- const contentResource = getContentResourceSchema(mysqlTable);
273
- const tag = getTagSchema(mysqlTable);
274
- const contentResourceTag = getContentResourceTagSchema(mysqlTable);
275
- return relations4(contentResourceTag, ({ one }) => ({
276
- contentResource: one(contentResource, {
277
- fields: [
278
- contentResourceTag.contentResourceId
279
- ],
280
- references: [
281
- contentResource.id
282
- ],
283
- relationName: "contentResource"
284
- }),
285
- tag: one(tag, {
286
- fields: [
287
- contentResourceTag.tagId
288
- ],
289
- references: [
290
- tag.id
291
- ],
292
- relationName: "tag"
293
- })
294
- }));
295
- }
296
- __name(getContentResourceTagRelationsSchema, "getContentResourceTagRelationsSchema");
297
-
298
- // src/lib/mysql/schemas/content/content-resource-version.ts
299
- import { relations as relations5, sql as sql5 } from "drizzle-orm";
300
- import { index as index5, int, json as json4, timestamp as timestamp5, unique, varchar as varchar5 } from "drizzle-orm/mysql-core";
301
- function getContentResourceVersionSchema(mysqlTable) {
302
- return mysqlTable("ContentResourceVersion", {
303
- id: varchar5("id", {
304
- length: 255
305
- }).notNull().primaryKey(),
306
- resourceId: varchar5("resourceId", {
307
- length: 255
308
- }).notNull(),
309
- parentVersionId: varchar5("parentVersionId", {
310
- length: 255
311
- }),
312
- versionNumber: int("versionNumber").notNull(),
313
- fields: json4("fields").$type().default({}),
314
- createdAt: timestamp5("createdAt", {
315
- mode: "date",
316
- fsp: 3
317
- }).default(sql5`CURRENT_TIMESTAMP(3)`),
318
- createdById: varchar5("createdById", {
319
- length: 255
320
- }).notNull()
321
- }, (crv) => ({
322
- resourceIdIdx: index5("resourceId_idx").on(crv.resourceId),
323
- parentVersionIdIdx: index5("parentVersionId_idx").on(crv.parentVersionId),
324
- resourceIdVersionNumberIdx: index5("resourceId_versionNumber_idx").on(crv.resourceId, crv.versionNumber),
325
- uniqueResourceVersion: unique("uq_resource_version_number").on(crv.resourceId, crv.versionNumber)
326
- }));
327
- }
328
- __name(getContentResourceVersionSchema, "getContentResourceVersionSchema");
329
- function getContentResourceVersionRelationsSchema(mysqlTable) {
330
- const contentResourceVersion = getContentResourceVersionSchema(mysqlTable);
331
- const contentResource = getContentResourceSchema(mysqlTable);
332
- const users = getUsersSchema(mysqlTable);
333
- return relations5(contentResourceVersion, ({ one }) => ({
334
- resource: one(contentResource, {
335
- fields: [
336
- contentResourceVersion.resourceId
337
- ],
338
- references: [
339
- contentResource.id
340
- ],
341
- relationName: "versions"
342
- }),
343
- parentVersion: one(contentResourceVersion, {
344
- fields: [
345
- contentResourceVersion.parentVersionId
346
- ],
347
- references: [
348
- contentResourceVersion.id
349
- ],
350
- relationName: "childVersions"
351
- }),
352
- createdBy: one(users, {
353
- fields: [
354
- contentResourceVersion.createdById
355
- ],
356
- references: [
357
- users.id
358
- ],
359
- relationName: "createdVersions"
360
- })
361
- }));
362
- }
363
- __name(getContentResourceVersionRelationsSchema, "getContentResourceVersionRelationsSchema");
364
-
365
- // src/lib/mysql/schemas/content/content-resource.ts
366
- function getContentResourceSchema(mysqlTable) {
367
- return mysqlTable("ContentResource", {
368
- id: varchar6("id", {
369
- length: 255
370
- }).notNull().primaryKey(),
371
- type: varchar6("type", {
372
- length: 255
373
- }).notNull(),
374
- createdById: varchar6("createdById", {
375
- length: 255
376
- }).notNull(),
377
- fields: json5("fields").$type().default({}),
378
- currentVersionId: varchar6("currentVersionId", {
379
- length: 255
380
- }),
381
- createdAt: timestamp6("createdAt", {
382
- mode: "date",
383
- fsp: 3
384
- }).default(sql6`CURRENT_TIMESTAMP(3)`),
385
- updatedAt: timestamp6("updatedAt", {
386
- mode: "date",
387
- fsp: 3
388
- }).default(sql6`CURRENT_TIMESTAMP(3)`),
389
- deletedAt: timestamp6("deletedAt", {
390
- mode: "date",
391
- fsp: 3
392
- })
393
- }, (cm) => ({
394
- typeIdx: index6("type_idx").on(cm.type),
395
- createdByIdx: index6("createdById_idx").on(cm.createdById),
396
- createdAtIdx: index6("createdAt_idx").on(cm.createdAt),
397
- currentVersionIdIdx: index6("currentVersionId_idx").on(cm.currentVersionId)
398
- }));
399
- }
400
- __name(getContentResourceSchema, "getContentResourceSchema");
401
- function getContentResourceRelationsSchema(mysqlTable) {
402
- const contentResource = getContentResourceSchema(mysqlTable);
403
- const users = getUsersSchema(mysqlTable);
404
- const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
405
- const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
406
- const contentContributions = getContentContributionsSchema(mysqlTable);
407
- const contentResourceTag = getContentResourceTagSchema(mysqlTable);
408
- const contentResourceVersion = getContentResourceVersionSchema(mysqlTable);
409
- const tag = getTagSchema(mysqlTable);
410
- return relations6(contentResource, ({ one, many }) => ({
411
- createdBy: one(users, {
412
- fields: [
413
- contentResource.createdById
414
- ],
415
- references: [
416
- users.id
417
- ],
418
- relationName: "creator"
419
- }),
420
- tags: many(contentResourceTag, {
421
- relationName: "contentResource"
422
- }),
423
- resources: many(contentResourceResource, {
424
- relationName: "resourceOf"
425
- }),
426
- resourceOf: many(contentResourceResource, {
427
- relationName: "resource"
428
- }),
429
- resourceProducts: many(contentResourceProduct, {
430
- relationName: "resource"
431
- }),
432
- contributions: many(contentContributions, {
433
- relationName: "contributions"
434
- }),
435
- currentVersion: one(contentResourceVersion, {
436
- fields: [
437
- contentResource.currentVersionId
438
- ],
439
- references: [
440
- contentResourceVersion.id
441
- ],
442
- relationName: "currentVersionResource"
443
- }),
444
- versions: many(contentResourceVersion, {
445
- relationName: "resource"
446
- })
447
- }));
448
- }
449
- __name(getContentResourceRelationsSchema, "getContentResourceRelationsSchema");
450
-
451
- // src/lib/mysql/schemas/content/content-resource-product.ts
452
- function getContentResourceProductSchema(mysqlTable) {
453
- return mysqlTable("ContentResourceProduct", {
454
- productId: varchar7("productId", {
455
- length: 255
456
- }).notNull(),
457
- resourceId: varchar7("resourceId", {
458
- length: 255
459
- }).notNull(),
460
- position: double4("position").notNull().default(0),
461
- metadata: json6("metadata").$type().default({}),
462
- createdAt: timestamp7("createdAt", {
463
- mode: "date",
464
- fsp: 3
465
- }).default(sql7`CURRENT_TIMESTAMP(3)`),
466
- updatedAt: timestamp7("updatedAt", {
467
- mode: "date",
468
- fsp: 3
469
- }).default(sql7`CURRENT_TIMESTAMP(3)`),
470
- deletedAt: timestamp7("deletedAt", {
471
- mode: "date",
472
- fsp: 3
473
- })
474
- }, (crr) => ({
475
- pk: primaryKey4({
476
- columns: [
477
- crr.productId,
478
- crr.resourceId
479
- ]
480
- }),
481
- contentResourceIdIdx: index7("contentResourceId_idx").on(crr.productId),
482
- resourceIdIdx: index7("resourceId_idx").on(crr.resourceId)
483
- }));
484
- }
485
- __name(getContentResourceProductSchema, "getContentResourceProductSchema");
486
- function getContentResourceProductRelationsSchema(mysqlTable) {
487
- const contentResource = getContentResourceSchema(mysqlTable);
488
- const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
489
- const product = getProductSchema(mysqlTable);
490
- return relations7(contentResourceProduct, ({ one }) => ({
491
- product: one(product, {
492
- fields: [
493
- contentResourceProduct.productId
494
- ],
495
- references: [
496
- product.id
497
- ],
498
- relationName: "product"
499
- }),
500
- resource: one(contentResource, {
501
- fields: [
502
- contentResourceProduct.resourceId
503
- ],
504
- references: [
505
- contentResource.id
506
- ],
507
- relationName: "resource"
508
- })
509
- }));
510
- }
511
- __name(getContentResourceProductRelationsSchema, "getContentResourceProductRelationsSchema");
512
-
513
- // src/lib/mysql/schemas/commerce/price.ts
514
- import { relations as relations8, sql as sql8 } from "drizzle-orm";
515
- import { decimal, int as int2, json as json7, primaryKey as primaryKey5, timestamp as timestamp8, varchar as varchar8 } from "drizzle-orm/mysql-core";
516
- function getPriceSchema(mysqlTable) {
517
- return mysqlTable("Price", {
518
- id: varchar8("id", {
519
- length: 191
520
- }).notNull(),
521
- productId: varchar8("productId", {
522
- length: 191
523
- }),
524
- nickname: varchar8("nickname", {
525
- length: 191
526
- }),
527
- status: int2("status").default(0).notNull(),
528
- unitAmount: decimal("unitAmount", {
529
- precision: 10,
530
- scale: 2
531
- }).notNull(),
532
- createdAt: timestamp8("createdAt", {
533
- mode: "date",
534
- fsp: 3
535
- }).default(sql8`CURRENT_TIMESTAMP(3)`).notNull(),
536
- fields: json7("fields").$type().default({})
537
- }, (table) => {
538
- return {
539
- priceId: primaryKey5({
540
- columns: [
541
- table.id
542
- ],
543
- name: "Price_id"
544
- })
545
- };
546
- });
547
- }
548
- __name(getPriceSchema, "getPriceSchema");
549
- function getProductRelationsSchema(mysqlTable) {
550
- const product = getProductSchema(mysqlTable);
551
- const price = getPriceSchema(mysqlTable);
552
- const merchantPrice = getMerchantPriceSchema(mysqlTable);
553
- return relations8(price, ({ one, many }) => ({
554
- product: one(product, {
555
- fields: [
556
- price.productId
557
- ],
558
- references: [
559
- product.id
560
- ],
561
- relationName: "user"
562
- }),
563
- merchantPrice: one(merchantPrice, {
564
- fields: [
565
- price.id
566
- ],
567
- references: [
568
- merchantPrice.priceId
569
- ],
570
- relationName: "merchantPrice"
571
- })
572
- }));
573
- }
574
- __name(getProductRelationsSchema, "getProductRelationsSchema");
575
-
576
- // src/lib/mysql/schemas/commerce/product.ts
577
- function getProductSchema(mysqlTable) {
578
- return mysqlTable("Product", {
579
- id: varchar9("id", {
580
- length: 191
581
- }).notNull(),
582
- name: varchar9("name", {
583
- length: 191
584
- }).notNull(),
585
- key: varchar9("key", {
586
- length: 191
587
- }),
588
- type: varchar9("type", {
589
- length: 191
590
- }),
591
- fields: json8("fields").$type().default({}),
592
- createdAt: timestamp9("createdAt", {
593
- mode: "date",
594
- fsp: 3
595
- }).default(sql9`CURRENT_TIMESTAMP(3)`).notNull(),
596
- status: int3("status").default(0).notNull(),
597
- quantityAvailable: int3("quantityAvailable").default(-1).notNull()
598
- }, (table) => {
599
- return {
600
- productId: primaryKey6({
601
- columns: [
602
- table.id
603
- ],
604
- name: "Product_id"
605
- })
606
- };
607
- });
608
- }
609
- __name(getProductSchema, "getProductSchema");
610
- function getProductRelationsSchema2(mysqlTable) {
611
- const product = getProductSchema(mysqlTable);
612
- const price = getPriceSchema(mysqlTable);
613
- const merchantProduct = getMerchantProductSchema(mysqlTable);
614
- const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
615
- return relations9(product, ({ one, many }) => ({
616
- price: one(price, {
617
- fields: [
618
- product.id
619
- ],
620
- references: [
621
- price.productId
622
- ],
623
- relationName: "price"
624
- }),
625
- resources: many(contentResourceProduct, {
626
- relationName: "product"
627
- }),
628
- merchantProduct: one(merchantProduct, {
629
- fields: [
630
- product.id
631
- ],
632
- references: [
633
- merchantProduct.productId
634
- ],
635
- relationName: "merchantProduct"
636
- })
637
- }));
638
- }
639
- __name(getProductRelationsSchema2, "getProductRelationsSchema");
640
-
641
- // src/lib/mysql/schemas/commerce/coupon.ts
642
- function getCouponSchema(mysqlTable) {
643
- return mysqlTable("Coupon", {
644
- id: varchar10("id", {
645
- length: 191
646
- }).notNull(),
647
- code: varchar10("code", {
648
- length: 191
649
- }),
650
- createdAt: timestamp10("createdAt", {
651
- mode: "date",
652
- fsp: 3
653
- }).default(sql10`CURRENT_TIMESTAMP(3)`).notNull(),
654
- expires: timestamp10("expires", {
655
- mode: "date",
656
- fsp: 3
657
- }),
658
- fields: json9("fields").$type().default({}),
659
- maxUses: int4("maxUses").default(-1).notNull(),
660
- default: boolean("default").default(false).notNull(),
661
- merchantCouponId: varchar10("merchantCouponId", {
662
- length: 191
663
- }),
664
- status: int4("status").default(0).notNull(),
665
- usedCount: int4("usedCount").default(0).notNull(),
666
- percentageDiscount: decimal2("percentageDiscount", {
667
- precision: 3,
668
- scale: 2
669
- }).notNull(),
670
- restrictedToProductId: varchar10("restrictedToProductId", {
671
- length: 191
672
- })
673
- }, (table) => {
674
- return {
675
- couponIdCodeIndex: index8("Coupon_id_code_index").on(table.id, table.code),
676
- couponId: primaryKey7({
677
- columns: [
678
- table.id
679
- ],
680
- name: "Coupon_id"
681
- }),
682
- couponCodeKey: unique2("Coupon_code_key").on(table.code)
683
- };
684
- });
685
- }
686
- __name(getCouponSchema, "getCouponSchema");
687
- function getCouponRelationsSchema(mysqlTable) {
688
- const purchase = getPurchaseSchema(mysqlTable);
689
- const coupon = getCouponSchema(mysqlTable);
690
- const merchantCoupon = getMerchantCouponSchema(mysqlTable);
691
- return relations10(coupon, ({ many, one }) => ({
692
- redeemedBulkCouponPurchases: many(purchase, {
693
- relationName: "redeemedBulkCoupon"
694
- }),
695
- merchantCoupon: one(merchantCoupon, {
696
- fields: [
697
- coupon.merchantCouponId
698
- ],
699
- references: [
700
- merchantCoupon.id
701
- ],
702
- relationName: "merchantCoupon"
703
- }),
704
- product: one(getProductSchema(mysqlTable), {
705
- fields: [
706
- coupon.restrictedToProductId
707
- ],
708
- references: [
709
- getProductSchema(mysqlTable).id
710
- ],
711
- relationName: "product"
712
- }),
713
- bulkPurchases: many(purchase, {
714
- relationName: "bulkCoupon"
715
- })
716
- }));
717
- }
718
- __name(getCouponRelationsSchema, "getCouponRelationsSchema");
719
-
720
- // src/lib/mysql/schemas/commerce/purchase.ts
721
- function getPurchaseSchema(mysqlTable) {
722
- return mysqlTable("Purchase", {
723
- id: varchar11("id", {
724
- length: 191
725
- }).notNull(),
726
- userId: varchar11("userId", {
727
- length: 191
728
- }),
729
- createdAt: timestamp11("createdAt", {
730
- mode: "date",
731
- fsp: 3
732
- }).default(sql11`CURRENT_TIMESTAMP(3)`).notNull(),
733
- totalAmount: decimal3("totalAmount", {
734
- precision: 65,
735
- scale: 30
736
- }).notNull(),
737
- ipAddress: varchar11("ip_address", {
738
- length: 191
739
- }),
740
- city: varchar11("city", {
741
- length: 191
742
- }),
743
- state: varchar11("state", {
744
- length: 191
745
- }),
746
- country: varchar11("country", {
747
- length: 191
748
- }),
749
- couponId: varchar11("couponId", {
750
- length: 191
751
- }),
752
- productId: varchar11("productId", {
753
- length: 191
754
- }).notNull(),
755
- merchantChargeId: varchar11("merchantChargeId", {
756
- length: 191
757
- }),
758
- upgradedFromId: varchar11("upgradedFromId", {
759
- length: 191
760
- }),
761
- status: varchar11("status", {
762
- length: 191
763
- }).default("Valid").notNull(),
764
- bulkCouponId: varchar11("bulkCouponId", {
765
- length: 191
766
- }),
767
- merchantSessionId: varchar11("merchantSessionId", {
768
- length: 191
769
- }),
770
- redeemedBulkCouponId: varchar11("redeemedBulkCouponId", {
771
- length: 191
772
- }),
773
- fields: json10("fields").$type().default({})
774
- }, (table) => {
775
- return {
776
- purchaseId: primaryKey8({
777
- columns: [
778
- table.id
779
- ],
780
- name: "Purchase_id"
781
- }),
782
- merchantChargeIdIdx: index9("idx_Purchase_on_merchantChargeId").on(table.merchantChargeId),
783
- purchaseUpgradedFromIdKey: unique3("Purchase_upgradedFromId_key").on(table.upgradedFromId)
784
- };
785
- });
786
- }
787
- __name(getPurchaseSchema, "getPurchaseSchema");
788
- function getPurchaseRelationsSchema(mysqlTable) {
789
- const purchases = getPurchaseSchema(mysqlTable);
790
- const users = getUsersSchema(mysqlTable);
791
- const products = getProductSchema(mysqlTable);
792
- const merchantCharges = getMerchantChargeSchema(mysqlTable);
793
- const merchantSessions = getMerchantSessionSchema(mysqlTable);
794
- const coupons = getCouponSchema(mysqlTable);
795
- return relations11(purchases, ({ many, one }) => ({
796
- redeemedBulkCoupon: one(coupons, {
797
- fields: [
798
- purchases.redeemedBulkCouponId
799
- ],
800
- references: [
801
- coupons.id
802
- ],
803
- relationName: "redeemedBulkCoupon"
804
- }),
805
- user: one(users, {
806
- fields: [
807
- purchases.userId
808
- ],
809
- references: [
810
- users.id
811
- ],
812
- relationName: "user"
813
- }),
814
- product: one(products, {
815
- fields: [
816
- purchases.productId
817
- ],
818
- references: [
819
- products.id
820
- ],
821
- relationName: "product"
822
- }),
823
- bulkCoupon: one(coupons, {
824
- fields: [
825
- purchases.bulkCouponId
826
- ],
827
- references: [
828
- coupons.id
829
- ],
830
- relationName: "bulkCoupon"
831
- }),
832
- merchantCharge: one(merchantCharges, {
833
- fields: [
834
- purchases.merchantChargeId
835
- ],
836
- references: [
837
- merchantCharges.id
838
- ],
839
- relationName: "merchantCharge"
840
- }),
841
- merchantSession: one(merchantSessions, {
842
- fields: [
843
- purchases.merchantSessionId
844
- ],
845
- references: [
846
- merchantSessions.id
847
- ],
848
- relationName: "merchantSession"
849
- })
850
- }));
851
- }
852
- __name(getPurchaseRelationsSchema, "getPurchaseRelationsSchema");
853
-
854
- // src/lib/mysql/schemas/communication/comment.ts
855
- import { relations as relations12, sql as sql12 } from "drizzle-orm";
856
- import { index as index10, json as json11, primaryKey as primaryKey9, text, timestamp as timestamp12, varchar as varchar12 } from "drizzle-orm/mysql-core";
857
- function getCommentsSchema(mysqlTable) {
858
- return mysqlTable("Comment", {
859
- id: varchar12("id", {
860
- length: 191
861
- }).notNull(),
862
- userId: varchar12("userId", {
863
- length: 255
864
- }).notNull(),
865
- context: json11("context").$type().default({}),
866
- text: text("text").notNull(),
867
- createdAt: timestamp12("createdAt", {
868
- mode: "date",
869
- fsp: 3
870
- }).default(sql12`CURRENT_TIMESTAMP(3)`),
871
- updatedAt: timestamp12("updatedAt", {
872
- mode: "date",
873
- fsp: 3
874
- }).default(sql12`CURRENT_TIMESTAMP(3)`),
875
- deletedAt: timestamp12("deletedAt", {
876
- mode: "date",
877
- fsp: 3
878
- })
879
- }, (crr) => ({
880
- pk: primaryKey9({
881
- columns: [
882
- crr.id
883
- ]
884
- }),
885
- crrUserIdIdKey: index10("crr_userIdId_idx").on(crr.userId)
886
- }));
887
- }
888
- __name(getCommentsSchema, "getCommentsSchema");
889
- function getCommentRelationsSchema(mysqlTable) {
890
- const comment = getCommentsSchema(mysqlTable);
891
- const user = getUsersSchema(mysqlTable);
892
- return relations12(comment, ({ one }) => ({
893
- user: one(user, {
894
- fields: [
895
- comment.userId
896
- ],
897
- references: [
898
- user.id
899
- ],
900
- relationName: "user"
901
- })
902
- }));
903
- }
904
- __name(getCommentRelationsSchema, "getCommentRelationsSchema");
905
-
906
- // src/lib/mysql/schemas/communication/communication-preferences.ts
907
- import { relations as relations13 } from "drizzle-orm";
908
- import { boolean as boolean2, index as index11, mysqlEnum, timestamp as timestamp13, varchar as varchar13 } from "drizzle-orm/mysql-core";
909
- function getCommunicationPreferencesSchema(mysqlTable) {
910
- return mysqlTable("CommunicationPreference", {
911
- id: varchar13("id", {
912
- length: 255
913
- }).notNull().primaryKey(),
914
- userId: varchar13("userId", {
915
- length: 255
916
- }).notNull(),
917
- channelId: varchar13("channelId", {
918
- length: 255
919
- }).notNull(),
920
- preferenceLevel: mysqlEnum("preferenceLevel", [
921
- "low",
922
- "medium",
923
- "high"
924
- ]).notNull().default("medium"),
925
- preferenceTypeId: varchar13("preferenceTypeId", {
926
- length: 255
927
- }).notNull(),
928
- active: boolean2("active").notNull().default(true),
929
- createdAt: timestamp13("createdAt", {
930
- mode: "date",
931
- fsp: 3
932
- }).defaultNow(),
933
- optInAt: timestamp13("optInAt", {
934
- mode: "date",
935
- fsp: 3
936
- }),
937
- optOutAt: timestamp13("optOutAt", {
938
- mode: "date",
939
- fsp: 3
940
- }),
941
- updatedAt: timestamp13("updatedAt", {
942
- mode: "date",
943
- fsp: 3
944
- }).defaultNow(),
945
- deletedAt: timestamp13("deletedAt", {
946
- mode: "date",
947
- fsp: 3
948
- })
949
- }, (cp) => ({
950
- userIdIdx: index11("userId_idx").on(cp.userId),
951
- preferenceTypeIdx: index11("preferenceTypeId_idx").on(cp.preferenceTypeId),
952
- channelIdIdx: index11("channelId_idx").on(cp.channelId)
953
- }));
954
- }
955
- __name(getCommunicationPreferencesSchema, "getCommunicationPreferencesSchema");
956
- function getCommunicationPreferencesRelationsSchema(mysqlTable) {
957
- const communicationPreferences = getCommunicationPreferencesSchema(mysqlTable);
958
- const users = getUsersSchema(mysqlTable);
959
- const communicationChannel = getCommunicationChannelSchema(mysqlTable);
960
- const communicationPreferenceTypes = getCommunicationPreferenceTypesSchema(mysqlTable);
961
- return relations13(communicationPreferences, ({ one }) => ({
962
- user: one(users, {
963
- fields: [
964
- communicationPreferences.userId
965
- ],
966
- references: [
967
- users.id
968
- ],
969
- relationName: "user"
970
- }),
971
- channel: one(communicationChannel, {
972
- fields: [
973
- communicationPreferences.channelId
974
- ],
975
- references: [
976
- communicationChannel.id
977
- ],
978
- relationName: "channel"
979
- }),
980
- preferenceType: one(communicationPreferenceTypes, {
981
- fields: [
982
- communicationPreferences.preferenceTypeId
983
- ],
984
- references: [
985
- communicationPreferenceTypes.id
986
- ],
987
- relationName: "preferenceType"
988
- })
989
- }));
990
- }
991
- __name(getCommunicationPreferencesRelationsSchema, "getCommunicationPreferencesRelationsSchema");
992
-
993
- // src/lib/mysql/schemas/auth/accounts.ts
994
- import { relations as relations14 } from "drizzle-orm";
995
- import { index as index12, int as int5, primaryKey as primaryKey10, text as text2, varchar as varchar14 } from "drizzle-orm/mysql-core";
996
- function getAccountsSchema(mysqlTable) {
997
- return mysqlTable("Account", {
998
- userId: varchar14("userId", {
999
- length: 255
1000
- }).notNull(),
1001
- type: varchar14("type", {
1002
- length: 255
1003
- }).$type().notNull(),
1004
- provider: varchar14("provider", {
1005
- length: 255
1006
- }).notNull(),
1007
- providerAccountId: varchar14("providerAccountId", {
1008
- length: 255
1009
- }).notNull(),
1010
- refresh_token: text2("refresh_token"),
1011
- access_token: text2("access_token"),
1012
- oauth_token: text2("oauth_token"),
1013
- oauth_token_secret: text2("oauth_token_secret"),
1014
- expires_at: int5("expires_at"),
1015
- token_type: varchar14("token_type", {
1016
- length: 255
1017
- }),
1018
- scope: varchar14("scope", {
1019
- length: 255
1020
- }),
1021
- id_token: text2("id_token"),
1022
- session_state: varchar14("session_state", {
1023
- length: 255
1024
- }),
1025
- refresh_token_expires_in: int5("refresh_token_expires_in")
1026
- }, (account) => ({
1027
- pk: primaryKey10({
1028
- columns: [
1029
- account.provider,
1030
- account.providerAccountId
1031
- ]
1032
- }),
1033
- userIdIdx: index12("userId_idx").on(account.userId)
1034
- }));
1035
- }
1036
- __name(getAccountsSchema, "getAccountsSchema");
1037
- function getAccountsRelationsSchema(mysqlTable) {
1038
- const accounts = getAccountsSchema(mysqlTable);
1039
- const users = getUsersSchema(mysqlTable);
1040
- return relations14(accounts, ({ one }) => ({
1041
- user: one(users, {
1042
- fields: [
1043
- accounts.userId
1044
- ],
1045
- references: [
1046
- users.id
1047
- ],
1048
- relationName: "user"
1049
- })
1050
- }));
1051
- }
1052
- __name(getAccountsRelationsSchema, "getAccountsRelationsSchema");
1053
-
1054
- // src/lib/mysql/schemas/auth/user-permissions.ts
1055
- import { relations as relations15 } from "drizzle-orm";
1056
- import { boolean as boolean3, index as index13, primaryKey as primaryKey11, timestamp as timestamp14, varchar as varchar15 } from "drizzle-orm/mysql-core";
1057
- function getUserPermissionsSchema(mysqlTable) {
1058
- return mysqlTable("UserPermission", {
1059
- userId: varchar15("userId", {
1060
- length: 255
1061
- }).notNull(),
1062
- permissionId: varchar15("permissionId", {
1063
- length: 255
1064
- }).notNull(),
1065
- active: boolean3("active").notNull().default(true),
1066
- createdAt: timestamp14("createdAt", {
1067
- mode: "date",
1068
- fsp: 3
1069
- }).defaultNow(),
1070
- updatedAt: timestamp14("updatedAt", {
1071
- mode: "date",
1072
- fsp: 3
1073
- }).defaultNow(),
1074
- deletedAt: timestamp14("deletedAt", {
1075
- mode: "date",
1076
- fsp: 3
1077
- })
1078
- }, (up) => ({
1079
- pk: primaryKey11({
1080
- columns: [
1081
- up.userId,
1082
- up.permissionId
1083
- ]
1084
- }),
1085
- userIdIdx: index13("userId_idx").on(up.userId),
1086
- permissionIdIdx: index13("permissionId_idx").on(up.permissionId)
1087
- }));
1088
- }
1089
- __name(getUserPermissionsSchema, "getUserPermissionsSchema");
1090
- function getUserPermissionsRelationsSchema(mysqlTable) {
1091
- const userPermissions = getUserPermissionsSchema(mysqlTable);
1092
- const users = getUsersSchema(mysqlTable);
1093
- const permissions = getPermissionsSchema(mysqlTable);
1094
- return relations15(userPermissions, ({ one }) => ({
1095
- user: one(users, {
1096
- fields: [
1097
- userPermissions.userId
1098
- ],
1099
- references: [
1100
- users.id
1101
- ],
1102
- relationName: "user"
1103
- }),
1104
- permission: one(permissions, {
1105
- fields: [
1106
- userPermissions.permissionId
1107
- ],
1108
- references: [
1109
- permissions.id
1110
- ],
1111
- relationName: "permission"
1112
- })
1113
- }));
1114
- }
1115
- __name(getUserPermissionsRelationsSchema, "getUserPermissionsRelationsSchema");
1116
-
1117
- // src/lib/mysql/schemas/auth/user-prefs.ts
1118
- import { relations as relations16, sql as sql13 } from "drizzle-orm";
1119
- import { index as index14, json as json12, primaryKey as primaryKey12, timestamp as timestamp15, varchar as varchar16 } from "drizzle-orm/mysql-core";
1120
- function getUserPrefsSchema(mysqlTable) {
1121
- return mysqlTable("UserPrefs", {
1122
- id: varchar16("id", {
1123
- length: 191
1124
- }).notNull(),
1125
- type: varchar16("type", {
1126
- length: 191
1127
- }).default("Global").notNull(),
1128
- userId: varchar16("userId", {
1129
- length: 255
1130
- }).notNull(),
1131
- fields: json12("fields").$type().default({}),
1132
- createdAt: timestamp15("createdAt", {
1133
- mode: "date",
1134
- fsp: 3
1135
- }).default(sql13`CURRENT_TIMESTAMP(3)`),
1136
- updatedAt: timestamp15("updatedAt", {
1137
- mode: "date",
1138
- fsp: 3
1139
- }).default(sql13`CURRENT_TIMESTAMP(3)`),
1140
- deletedAt: timestamp15("deletedAt", {
1141
- mode: "date",
1142
- fsp: 3
1143
- })
1144
- }, (crr) => ({
1145
- pk: primaryKey12({
1146
- columns: [
1147
- crr.id
1148
- ]
1149
- }),
1150
- crrUserIdIdKey: index14("crr_userIdId_idx").on(crr.userId)
1151
- }));
1152
- }
1153
- __name(getUserPrefsSchema, "getUserPrefsSchema");
1154
- function getUserPrefsRelationsSchema(mysqlTable) {
1155
- const userPrefs = getUserPrefsSchema(mysqlTable);
1156
- const user = getUsersSchema(mysqlTable);
1157
- return relations16(userPrefs, ({ one }) => ({
1158
- user: one(user, {
1159
- fields: [
1160
- userPrefs.userId
1161
- ],
1162
- references: [
1163
- user.id
1164
- ],
1165
- relationName: "user"
1166
- })
1167
- }));
1168
- }
1169
- __name(getUserPrefsRelationsSchema, "getUserPrefsRelationsSchema");
1170
-
1171
- // src/lib/mysql/schemas/auth/user-roles.ts
1172
- import { relations as relations18 } from "drizzle-orm";
1173
- import { boolean as boolean5, index as index16, primaryKey as primaryKey13, timestamp as timestamp17, varchar as varchar18 } from "drizzle-orm/mysql-core";
1174
-
1175
- // src/lib/mysql/schemas/auth/roles.ts
1176
- import { relations as relations17 } from "drizzle-orm";
1177
- import { boolean as boolean4, index as index15, text as text3, timestamp as timestamp16, varchar as varchar17 } from "drizzle-orm/mysql-core";
1178
- function getRolesSchema(mysqlTable) {
1179
- return mysqlTable("Role", {
1180
- id: varchar17("id", {
1181
- length: 255
1182
- }).notNull().primaryKey(),
1183
- name: varchar17("name", {
1184
- length: 255
1185
- }).notNull().unique(),
1186
- description: text3("description"),
1187
- active: boolean4("active").notNull().default(true),
1188
- createdAt: timestamp16("createdAt", {
1189
- mode: "date",
1190
- fsp: 3
1191
- }).defaultNow(),
1192
- updatedAt: timestamp16("updatedAt", {
1193
- mode: "date",
1194
- fsp: 3
1195
- }).defaultNow(),
1196
- deletedAt: timestamp16("deletedAt", {
1197
- mode: "date",
1198
- fsp: 3
1199
- })
1200
- }, (role) => ({
1201
- nameIdx: index15("name_idx").on(role.name)
1202
- }));
1203
- }
1204
- __name(getRolesSchema, "getRolesSchema");
1205
- function getRolesRelationsSchema(mysqlTable) {
1206
- const roles = getRolesSchema(mysqlTable);
1207
- const userRoles = getUserRolesSchema(mysqlTable);
1208
- return relations17(roles, ({ many }) => ({
1209
- userRoles: many(userRoles, {
1210
- relationName: "role"
1211
- })
1212
- }));
1213
- }
1214
- __name(getRolesRelationsSchema, "getRolesRelationsSchema");
1215
-
1216
- // src/lib/mysql/schemas/auth/user-roles.ts
1217
- function getUserRolesSchema(mysqlTable) {
1218
- return mysqlTable("UserRole", {
1219
- userId: varchar18("userId", {
1220
- length: 255
1221
- }).notNull(),
1222
- roleId: varchar18("roleId", {
1223
- length: 255
1224
- }).notNull(),
1225
- active: boolean5("active").notNull().default(true),
1226
- createdAt: timestamp17("createdAt", {
1227
- mode: "date",
1228
- fsp: 3
1229
- }).defaultNow(),
1230
- updatedAt: timestamp17("updatedAt", {
1231
- mode: "date",
1232
- fsp: 3
1233
- }).defaultNow(),
1234
- deletedAt: timestamp17("deletedAt", {
1235
- mode: "date",
1236
- fsp: 3
1237
- })
1238
- }, (ur) => ({
1239
- pk: primaryKey13({
1240
- columns: [
1241
- ur.userId,
1242
- ur.roleId
1243
- ]
1244
- }),
1245
- userIdIdx: index16("userId_idx").on(ur.userId),
1246
- roleIdIdx: index16("roleId_idx").on(ur.roleId)
1247
- }));
1248
- }
1249
- __name(getUserRolesSchema, "getUserRolesSchema");
1250
- function getUserRolesRelationsSchema(mysqlTable) {
1251
- const userRoles = getUserRolesSchema(mysqlTable);
1252
- const users = getUsersSchema(mysqlTable);
1253
- const roles = getRolesSchema(mysqlTable);
1254
- return relations18(userRoles, ({ one }) => ({
1255
- user: one(users, {
1256
- fields: [
1257
- userRoles.userId
1258
- ],
1259
- references: [
1260
- users.id
1261
- ],
1262
- relationName: "user"
1263
- }),
1264
- role: one(roles, {
1265
- fields: [
1266
- userRoles.roleId
1267
- ],
1268
- references: [
1269
- roles.id
1270
- ],
1271
- relationName: "role"
1272
- })
1273
- }));
1274
- }
1275
- __name(getUserRolesRelationsSchema, "getUserRolesRelationsSchema");
1276
-
1277
- // src/lib/mysql/schemas/auth/users.ts
1278
- function getUsersSchema(mysqlTable) {
1279
- return mysqlTable("User", {
1280
- id: varchar19("id", {
1281
- length: 255
1282
- }).notNull().primaryKey(),
1283
- name: varchar19("name", {
1284
- length: 255
1285
- }),
1286
- role: varchar19("role", {
1287
- length: 191
1288
- }).notNull().default("user"),
1289
- email: varchar19("email", {
1290
- length: 255
1291
- }).notNull().unique(),
1292
- fields: json13("fields").$type().default({}),
1293
- emailVerified: timestamp18("emailVerified", {
1294
- mode: "date",
1295
- fsp: 3
1296
- }),
1297
- image: varchar19("image", {
1298
- length: 255
1299
- }),
1300
- createdAt: timestamp18("createdAt", {
1301
- mode: "date",
1302
- fsp: 3
1303
- }).default(sql14`CURRENT_TIMESTAMP(3)`)
1304
- }, (user) => ({
1305
- emailIdx: index17("email_idx").on(user.email),
1306
- roleIdx: index17("role_idx").on(user.role),
1307
- createdAtIdx: index17("created_at_idx").on(user.createdAt)
1308
- }));
1309
- }
1310
- __name(getUsersSchema, "getUsersSchema");
1311
- function getUsersRelationsSchema(mysqlTable) {
1312
- const users = getUsersSchema(mysqlTable);
1313
- const accounts = getAccountsSchema(mysqlTable);
1314
- const communicationPreferences = getCommunicationPreferencesSchema(mysqlTable);
1315
- const userRoles = getUserRolesSchema(mysqlTable);
1316
- const userPermissions = getUserPermissionsSchema(mysqlTable);
1317
- const contentContributions = getContentContributionsSchema(mysqlTable);
1318
- const contentResource = getContentResourceSchema(mysqlTable);
1319
- const purchases = getPurchaseSchema(mysqlTable);
1320
- const comments = getCommentsSchema(mysqlTable);
1321
- const userPrefs = getUserPrefsSchema(mysqlTable);
1322
- return relations19(users, ({ many }) => ({
1323
- accounts: many(accounts, {
1324
- relationName: "user"
1325
- }),
1326
- purchases: many(purchases, {
1327
- relationName: "user"
1328
- }),
1329
- communicationPreferences: many(communicationPreferences, {
1330
- relationName: "user"
1331
- }),
1332
- roles: many(userRoles, {
1333
- relationName: "user"
1334
- }),
1335
- userPermissions: many(userPermissions, {
1336
- relationName: "user"
1337
- }),
1338
- contributions: many(contentContributions, {
1339
- relationName: "user"
1340
- }),
1341
- createdContent: many(contentResource, {
1342
- relationName: "user"
1343
- }),
1344
- comments: many(comments, {
1345
- relationName: "user"
1346
- }),
1347
- prefs: many(userPrefs, {
1348
- relationName: "user"
1349
- })
1350
- }));
1351
- }
1352
- __name(getUsersRelationsSchema, "getUsersRelationsSchema");
1353
-
1354
- // src/lib/mysql/schemas/content/content-contributions.ts
1355
- function getContentContributionsSchema(mysqlTable) {
1356
- return mysqlTable("ContentContribution", {
1357
- id: varchar20("id", {
1358
- length: 255
1359
- }).notNull().primaryKey(),
1360
- userId: varchar20("userId", {
1361
- length: 255
1362
- }).notNull(),
1363
- contentId: varchar20("contentId", {
1364
- length: 255
1365
- }).notNull(),
1366
- contributionTypeId: varchar20("contributionTypeId", {
1367
- length: 255
1368
- }).notNull(),
1369
- active: boolean6("active").notNull().default(true),
1370
- createdAt: timestamp19("createdAt", {
1371
- mode: "date",
1372
- fsp: 3
1373
- }).defaultNow(),
1374
- updatedAt: timestamp19("updatedAt", {
1375
- mode: "date",
1376
- fsp: 3
1377
- }).defaultNow(),
1378
- deletedAt: timestamp19("deletedAt", {
1379
- mode: "date",
1380
- fsp: 3
1381
- })
1382
- }, (cc) => ({
1383
- userIdIdx: index18("userId_idx").on(cc.userId),
1384
- contentIdIdx: index18("contentId_idx").on(cc.contentId),
1385
- contributionTypeIdIdx: index18("contributionTypeId_idx").on(cc.contributionTypeId)
1386
- }));
1387
- }
1388
- __name(getContentContributionsSchema, "getContentContributionsSchema");
1389
- function getContentContributionRelationsSchema(mysqlTable) {
1390
- const contentContributions = getContentContributionsSchema(mysqlTable);
1391
- const users = getUsersSchema(mysqlTable);
1392
- const contentResource = getContentResourceSchema(mysqlTable);
1393
- const contributionTypes = getContributionTypesSchema(mysqlTable);
1394
- return relations20(contentContributions, ({ one }) => ({
1395
- user: one(users, {
1396
- fields: [
1397
- contentContributions.userId
1398
- ],
1399
- references: [
1400
- users.id
1401
- ],
1402
- relationName: "user"
1403
- }),
1404
- content: one(contentResource, {
1405
- fields: [
1406
- contentContributions.contentId
1407
- ],
1408
- references: [
1409
- contentResource.id
1410
- ],
1411
- relationName: "contributions"
1412
- }),
1413
- contributionType: one(contributionTypes, {
1414
- fields: [
1415
- contentContributions.contributionTypeId
1416
- ],
1417
- references: [
1418
- contributionTypes.id
1419
- ],
1420
- relationName: "contributionType"
1421
- })
1422
- }));
1423
- }
1424
- __name(getContentContributionRelationsSchema, "getContentContributionRelationsSchema");
1425
-
1426
- export {
1427
- getContentContributionsSchema,
1428
- getContentContributionRelationsSchema,
1429
- getContentResourceResourceSchema,
1430
- getContentResourceResourceRelationsSchema,
1431
- getTagTagSchema,
1432
- getTagTagRelationsSchema,
1433
- getTagSchema,
1434
- getTagRelationsSchema,
1435
- getContentResourceTagSchema,
1436
- getContentResourceTagRelationsSchema,
1437
- getContentResourceVersionSchema,
1438
- getContentResourceVersionRelationsSchema,
1439
- getContentResourceSchema,
1440
- getContentResourceRelationsSchema,
1441
- getContentResourceProductSchema,
1442
- getContentResourceProductRelationsSchema,
1443
- getPriceSchema,
1444
- getProductRelationsSchema,
1445
- getProductSchema,
1446
- getProductRelationsSchema2,
1447
- getCouponSchema,
1448
- getCouponRelationsSchema,
1449
- getPurchaseSchema,
1450
- getPurchaseRelationsSchema,
1451
- getCommentsSchema,
1452
- getCommentRelationsSchema,
1453
- getCommunicationPreferencesSchema,
1454
- getCommunicationPreferencesRelationsSchema,
1455
- getUserPermissionsSchema,
1456
- getUserPermissionsRelationsSchema,
1457
- getUserPrefsSchema,
1458
- getUserPrefsRelationsSchema,
1459
- getRolesSchema,
1460
- getRolesRelationsSchema,
1461
- getUserRolesSchema,
1462
- getUserRolesRelationsSchema,
1463
- getUsersSchema,
1464
- getUsersRelationsSchema,
1465
- getAccountsSchema,
1466
- getAccountsRelationsSchema
1467
- };
1468
- //# sourceMappingURL=chunk-JW2PFVLO.js.map