@coursebuilder/adapter-drizzle 0.0.4 → 0.0.6

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 (196) hide show
  1. package/dist/{chunk-RMRO5TA7.js → chunk-22KIKVBY.js} +2 -2
  2. package/dist/chunk-4HDU7QIB.js +747 -0
  3. package/dist/{chunk-QM6AYTGN.js → chunk-6CBAFOL3.js} +5 -7
  4. package/dist/{chunk-NCDVIRG4.js → chunk-AIDEJDKJ.js} +5 -7
  5. package/dist/{chunk-34QNODEZ.js → chunk-BRGTUNY2.js} +5 -7
  6. package/dist/{chunk-VID6JINS.js → chunk-FRNVLW7N.js} +690 -330
  7. package/dist/{chunk-LLWSIKQV.js → chunk-GFUUJRX7.js} +1 -1
  8. package/dist/{chunk-WULUGMHP.js → chunk-H4MXNDWO.js} +5 -7
  9. package/dist/{chunk-JWWIIUV3.js → chunk-ICL7XZ2Y.js} +5 -7
  10. package/dist/{chunk-SBGLYMAH.js → chunk-JD4KFACE.js} +5 -7
  11. package/dist/{chunk-ZUKX3WXB.js → chunk-KI47TR7F.js} +5 -7
  12. package/dist/{chunk-FZHAOQVB.js → chunk-KVN3JV7C.js} +5 -7
  13. package/dist/{chunk-H7XEMCP4.js → chunk-MBQ3TMHH.js} +5 -7
  14. package/dist/chunk-PFN4YUQZ.js +47 -0
  15. package/dist/{chunk-ABVLEWR5.js → chunk-SFJM6FKE.js} +5 -7
  16. package/dist/{chunk-QRRP7Y2V.js → chunk-TA6VLEV5.js} +5 -7
  17. package/dist/{chunk-BZPXYS6A.js → chunk-TMQIGK3N.js} +5 -7
  18. package/dist/{chunk-VWMY6XV7.js → chunk-US2EXVMI.js} +5 -7
  19. package/dist/{chunk-KFQAWBFP.js → chunk-UY3DVPP3.js} +5 -7
  20. package/dist/{chunk-M5NL4CY4.js → chunk-VEFCDI73.js} +5 -7
  21. package/dist/{chunk-EFO2N6T7.js → chunk-VZABQCFH.js} +5 -7
  22. package/dist/index.d.ts +1 -31
  23. package/dist/index.js +21 -32
  24. package/dist/lib/mysql/index.cjs +1606 -1100
  25. package/dist/lib/mysql/index.cjs.map +1 -1
  26. package/dist/lib/mysql/index.d.ts +4649 -745
  27. package/dist/lib/mysql/index.js +21 -117
  28. package/dist/lib/mysql/schemas/auth/accounts.cjs +125 -22
  29. package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
  30. package/dist/lib/mysql/schemas/auth/accounts.d.ts +180 -178
  31. package/dist/lib/mysql/schemas/auth/accounts.js +5 -1
  32. package/dist/lib/mysql/schemas/auth/permissions.cjs +108 -14
  33. package/dist/lib/mysql/schemas/auth/permissions.cjs.map +1 -1
  34. package/dist/lib/mysql/schemas/auth/permissions.d.ts +96 -94
  35. package/dist/lib/mysql/schemas/auth/permissions.js +5 -1
  36. package/dist/lib/mysql/schemas/auth/role-permissions.cjs +146 -13
  37. package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
  38. package/dist/lib/mysql/schemas/auth/role-permissions.d.ts +85 -82
  39. package/dist/lib/mysql/schemas/auth/role-permissions.js +5 -1
  40. package/dist/lib/mysql/schemas/auth/roles.cjs +110 -14
  41. package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
  42. package/dist/lib/mysql/schemas/auth/roles.d.ts +96 -94
  43. package/dist/lib/mysql/schemas/auth/roles.js +5 -1
  44. package/dist/lib/mysql/schemas/auth/sessions.cjs +117 -10
  45. package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
  46. package/dist/lib/mysql/schemas/auth/sessions.d.ts +48 -46
  47. package/dist/lib/mysql/schemas/auth/sessions.js +6 -1
  48. package/dist/lib/mysql/schemas/auth/user-permissions.cjs +156 -15
  49. package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
  50. package/dist/lib/mysql/schemas/auth/user-permissions.d.ts +85 -82
  51. package/dist/lib/mysql/schemas/auth/user-permissions.js +5 -1
  52. package/dist/lib/mysql/schemas/auth/user-roles.cjs +152 -13
  53. package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
  54. package/dist/lib/mysql/schemas/auth/user-roles.d.ts +85 -82
  55. package/dist/lib/mysql/schemas/auth/user-roles.js +5 -1
  56. package/dist/lib/mysql/schemas/auth/users.cjs +311 -14
  57. package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
  58. package/dist/lib/mysql/schemas/auth/users.d.ts +101 -94
  59. package/dist/lib/mysql/schemas/auth/users.js +5 -1
  60. package/dist/lib/mysql/schemas/auth/verification-tokens.cjs +4 -6
  61. package/dist/lib/mysql/schemas/auth/verification-tokens.cjs.map +1 -1
  62. package/dist/lib/mysql/schemas/auth/verification-tokens.d.ts +55 -57
  63. package/dist/lib/mysql/schemas/auth/verification-tokens.js +1 -1
  64. package/dist/lib/mysql/schemas/commerce/coupon.cjs +4 -6
  65. package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
  66. package/dist/lib/mysql/schemas/commerce/coupon.d.ts +163 -165
  67. package/dist/lib/mysql/schemas/commerce/coupon.js +1 -1
  68. package/dist/lib/mysql/schemas/commerce/merchant-account.cjs +4 -6
  69. package/dist/lib/mysql/schemas/commerce/merchant-account.cjs.map +1 -1
  70. package/dist/lib/mysql/schemas/commerce/merchant-account.d.ts +67 -69
  71. package/dist/lib/mysql/schemas/commerce/merchant-account.js +1 -1
  72. package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs +4 -6
  73. package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs.map +1 -1
  74. package/dist/lib/mysql/schemas/commerce/merchant-charge.d.ts +103 -105
  75. package/dist/lib/mysql/schemas/commerce/merchant-charge.js +1 -1
  76. package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs +4 -6
  77. package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs.map +1 -1
  78. package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.ts +79 -81
  79. package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +1 -1
  80. package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs +4 -6
  81. package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs.map +1 -1
  82. package/dist/lib/mysql/schemas/commerce/merchant-customer.d.ts +79 -81
  83. package/dist/lib/mysql/schemas/commerce/merchant-customer.js +1 -1
  84. package/dist/lib/mysql/schemas/commerce/merchant-price.cjs +4 -6
  85. package/dist/lib/mysql/schemas/commerce/merchant-price.cjs.map +1 -1
  86. package/dist/lib/mysql/schemas/commerce/merchant-price.d.ts +91 -93
  87. package/dist/lib/mysql/schemas/commerce/merchant-price.js +1 -1
  88. package/dist/lib/mysql/schemas/commerce/merchant-product.cjs +4 -6
  89. package/dist/lib/mysql/schemas/commerce/merchant-product.cjs.map +1 -1
  90. package/dist/lib/mysql/schemas/commerce/merchant-product.d.ts +79 -81
  91. package/dist/lib/mysql/schemas/commerce/merchant-product.js +1 -1
  92. package/dist/lib/mysql/schemas/commerce/merchant-session.cjs +4 -6
  93. package/dist/lib/mysql/schemas/commerce/merchant-session.cjs.map +1 -1
  94. package/dist/lib/mysql/schemas/commerce/merchant-session.d.ts +43 -45
  95. package/dist/lib/mysql/schemas/commerce/merchant-session.js +1 -1
  96. package/dist/lib/mysql/schemas/commerce/price.cjs +4 -6
  97. package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
  98. package/dist/lib/mysql/schemas/commerce/price.d.ts +91 -93
  99. package/dist/lib/mysql/schemas/commerce/price.js +1 -1
  100. package/dist/lib/mysql/schemas/commerce/product.cjs +4 -6
  101. package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
  102. package/dist/lib/mysql/schemas/commerce/product.d.ts +91 -93
  103. package/dist/lib/mysql/schemas/commerce/product.js +1 -1
  104. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +4 -6
  105. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
  106. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.ts +127 -129
  107. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +1 -1
  108. package/dist/lib/mysql/schemas/commerce/purchase.cjs +4 -6
  109. package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
  110. package/dist/lib/mysql/schemas/commerce/purchase.d.ts +211 -213
  111. package/dist/lib/mysql/schemas/commerce/purchase.js +1 -1
  112. package/dist/lib/mysql/schemas/communication/communication-channel.cjs +4 -6
  113. package/dist/lib/mysql/schemas/communication/communication-channel.cjs.map +1 -1
  114. package/dist/lib/mysql/schemas/communication/communication-channel.d.ts +91 -93
  115. package/dist/lib/mysql/schemas/communication/communication-channel.js +1 -1
  116. package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs +4 -6
  117. package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs.map +1 -1
  118. package/dist/lib/mysql/schemas/communication/communication-preference-types.d.ts +91 -93
  119. package/dist/lib/mysql/schemas/communication/communication-preference-types.js +1 -1
  120. package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +193 -20
  121. package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
  122. package/dist/lib/mysql/schemas/communication/communication-preferences.d.ts +146 -142
  123. package/dist/lib/mysql/schemas/communication/communication-preferences.js +5 -1
  124. package/dist/lib/mysql/schemas/content/content-contributions.cjs +202 -17
  125. package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
  126. package/dist/lib/mysql/schemas/content/content-contributions.d.ts +110 -106
  127. package/dist/lib/mysql/schemas/content/content-contributions.js +5 -1
  128. package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +128 -18
  129. package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
  130. package/dist/lib/mysql/schemas/content/content-resource-resource.d.ts +97 -94
  131. package/dist/lib/mysql/schemas/content/content-resource-resource.js +5 -1
  132. package/dist/lib/mysql/schemas/content/content-resource.cjs +199 -18
  133. package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
  134. package/dist/lib/mysql/schemas/content/content-resource.d.ts +99 -94
  135. package/dist/lib/mysql/schemas/content/content-resource.js +5 -1
  136. package/dist/lib/mysql/schemas/content/contribution-types.cjs +113 -16
  137. package/dist/lib/mysql/schemas/content/contribution-types.cjs.map +1 -1
  138. package/dist/lib/mysql/schemas/content/contribution-types.d.ts +108 -106
  139. package/dist/lib/mysql/schemas/content/contribution-types.js +5 -1
  140. package/dist/lib/mysql/schemas/content/resource-progress.cjs +4 -6
  141. package/dist/lib/mysql/schemas/content/resource-progress.cjs.map +1 -1
  142. package/dist/lib/mysql/schemas/content/resource-progress.d.ts +79 -81
  143. package/dist/lib/mysql/schemas/content/resource-progress.js +1 -1
  144. package/dist/lib/pg.d.ts +1 -1
  145. package/dist/lib/sqlite.cjs.map +1 -1
  146. package/dist/lib/sqlite.d.ts +45 -46
  147. package/dist/lib/sqlite.js +2 -2
  148. package/dist/lib/utils.cjs.map +1 -1
  149. package/dist/lib/utils.d.ts +1 -31
  150. package/dist/lib/utils.js +1 -1
  151. package/package.json +9 -5
  152. package/src/index.ts +1 -1
  153. package/src/lib/mysql/index.ts +115 -77
  154. package/src/lib/mysql/schemas/auth/accounts.ts +12 -3
  155. package/src/lib/mysql/schemas/auth/permissions.ts +10 -3
  156. package/src/lib/mysql/schemas/auth/role-permissions.ts +21 -3
  157. package/src/lib/mysql/schemas/auth/roles.ts +12 -3
  158. package/src/lib/mysql/schemas/auth/sessions.ts +12 -3
  159. package/src/lib/mysql/schemas/auth/user-permissions.ts +21 -3
  160. package/src/lib/mysql/schemas/auth/user-roles.ts +21 -3
  161. package/src/lib/mysql/schemas/auth/users.ts +27 -3
  162. package/src/lib/mysql/schemas/auth/verification-tokens.ts +2 -4
  163. package/src/lib/mysql/schemas/commerce/coupon.ts +2 -4
  164. package/src/lib/mysql/schemas/commerce/merchant-account.ts +2 -4
  165. package/src/lib/mysql/schemas/commerce/merchant-charge.ts +2 -4
  166. package/src/lib/mysql/schemas/commerce/merchant-coupon.ts +2 -4
  167. package/src/lib/mysql/schemas/commerce/merchant-customer.ts +2 -4
  168. package/src/lib/mysql/schemas/commerce/merchant-price.ts +2 -4
  169. package/src/lib/mysql/schemas/commerce/merchant-product.ts +2 -4
  170. package/src/lib/mysql/schemas/commerce/merchant-session.ts +2 -4
  171. package/src/lib/mysql/schemas/commerce/price.ts +2 -4
  172. package/src/lib/mysql/schemas/commerce/product.ts +2 -4
  173. package/src/lib/mysql/schemas/commerce/purchase-user-transfer.ts +2 -4
  174. package/src/lib/mysql/schemas/commerce/purchase.ts +2 -4
  175. package/src/lib/mysql/schemas/communication/communication-channel.ts +2 -4
  176. package/src/lib/mysql/schemas/communication/communication-preference-types.ts +20 -25
  177. package/src/lib/mysql/schemas/communication/communication-preferences.ts +30 -3
  178. package/src/lib/mysql/schemas/content/content-contributions.ts +31 -3
  179. package/src/lib/mysql/schemas/content/content-resource-resource.ts +23 -4
  180. package/src/lib/mysql/schemas/content/content-resource.ts +22 -4
  181. package/src/lib/mysql/schemas/content/contribution-types.ts +13 -3
  182. package/src/lib/mysql/schemas/content/resource-progress.ts +2 -4
  183. package/src/lib/utils.ts +1 -1
  184. package/dist/chunk-7Z72PW3G.js +0 -60
  185. package/dist/chunk-C2G2KMWQ.js +0 -48
  186. package/dist/chunk-GJZCLS2Y.js +0 -29
  187. package/dist/chunk-HHQK736S.js +0 -40
  188. package/dist/chunk-I4NIW2NF.js +0 -46
  189. package/dist/chunk-IHQ3ARH4.js +0 -44
  190. package/dist/chunk-KEJBPPZC.js +0 -45
  191. package/dist/chunk-L3XBKPYA.js +0 -47
  192. package/dist/chunk-MHZHMZ5C.js +0 -47
  193. package/dist/chunk-MOO56C62.js +0 -46
  194. package/dist/chunk-RLTOQRJB.js +0 -40
  195. package/dist/chunk-SWOTLIQI.js +0 -46
  196. package/dist/chunk-XM4CEU6B.js +0 -54
@@ -11,8 +11,8 @@ import {
11
11
  varchar,
12
12
  } from 'drizzle-orm/mysql-core'
13
13
 
14
- export const getCouponSchema = (mysqlTable: MySqlTableFn) => {
15
- const coupon = mysqlTable(
14
+ export function getCouponSchema(mysqlTable: MySqlTableFn) {
15
+ return mysqlTable(
16
16
  'coupons',
17
17
  {
18
18
  id: varchar('id', { length: 191 }).notNull(),
@@ -44,6 +44,4 @@ export const getCouponSchema = (mysqlTable: MySqlTableFn) => {
44
44
  }
45
45
  },
46
46
  )
47
-
48
- return { coupon }
49
47
  }
@@ -7,8 +7,8 @@ import {
7
7
  varchar,
8
8
  } from 'drizzle-orm/mysql-core'
9
9
 
10
- export const getMerchantAccountSchema = (mysqlTable: MySqlTableFn) => {
11
- const merchantAccount = mysqlTable(
10
+ export function getMerchantAccountSchema(mysqlTable: MySqlTableFn) {
11
+ return mysqlTable(
12
12
  'merchantAccounts',
13
13
  {
14
14
  id: varchar('id', { length: 191 }).notNull(),
@@ -28,6 +28,4 @@ export const getMerchantAccountSchema = (mysqlTable: MySqlTableFn) => {
28
28
  }
29
29
  },
30
30
  )
31
-
32
- return { merchantAccount }
33
31
  }
@@ -8,8 +8,8 @@ import {
8
8
  varchar,
9
9
  } from 'drizzle-orm/mysql-core'
10
10
 
11
- export const getMerchantChargeSchema = (mysqlTable: MySqlTableFn) => {
12
- const merchantCharge = mysqlTable(
11
+ export function getMerchantChargeSchema(mysqlTable: MySqlTableFn) {
12
+ return mysqlTable(
13
13
  'merchantCharges',
14
14
  {
15
15
  id: varchar('id', { length: 191 }).notNull(),
@@ -41,6 +41,4 @@ export const getMerchantChargeSchema = (mysqlTable: MySqlTableFn) => {
41
41
  }
42
42
  },
43
43
  )
44
-
45
- return { merchantCharge }
46
44
  }
@@ -7,8 +7,8 @@ import {
7
7
  varchar,
8
8
  } from 'drizzle-orm/mysql-core'
9
9
 
10
- export const getMerchantCouponSchema = (mysqlTable: MySqlTableFn) => {
11
- const merchantCoupon = mysqlTable(
10
+ export function getMerchantCouponSchema(mysqlTable: MySqlTableFn) {
11
+ return mysqlTable(
12
12
  'merchantCoupons',
13
13
  {
14
14
  id: varchar('id', { length: 191 }).notNull(),
@@ -35,6 +35,4 @@ export const getMerchantCouponSchema = (mysqlTable: MySqlTableFn) => {
35
35
  }
36
36
  },
37
37
  )
38
-
39
- return { merchantCoupon }
40
38
  }
@@ -8,8 +8,8 @@ import {
8
8
  varchar,
9
9
  } from 'drizzle-orm/mysql-core'
10
10
 
11
- export const getMerchantCustomerSchema = (mysqlTable: MySqlTableFn) => {
12
- const merchantCustomer = mysqlTable(
11
+ export function getMerchantCustomerSchema(mysqlTable: MySqlTableFn) {
12
+ return mysqlTable(
13
13
  'merchantCustomers',
14
14
  {
15
15
  id: varchar('id', { length: 191 }).notNull(),
@@ -35,6 +35,4 @@ export const getMerchantCustomerSchema = (mysqlTable: MySqlTableFn) => {
35
35
  }
36
36
  },
37
37
  )
38
-
39
- return { merchantCustomer }
40
38
  }
@@ -8,8 +8,8 @@ import {
8
8
  varchar,
9
9
  } from 'drizzle-orm/mysql-core'
10
10
 
11
- export const getMerchantPriceSchema = (mysqlTable: MySqlTableFn) => {
12
- const merchantPrice = mysqlTable(
11
+ export function getMerchantPriceSchema(mysqlTable: MySqlTableFn) {
12
+ return mysqlTable(
13
13
  'merchantPrices',
14
14
  {
15
15
  id: varchar('id', { length: 191 }).notNull(),
@@ -38,6 +38,4 @@ export const getMerchantPriceSchema = (mysqlTable: MySqlTableFn) => {
38
38
  }
39
39
  },
40
40
  )
41
-
42
- return { merchantPrice }
43
41
  }
@@ -8,8 +8,8 @@ import {
8
8
  varchar,
9
9
  } from 'drizzle-orm/mysql-core'
10
10
 
11
- export const getMerchantProductSchema = (mysqlTable: MySqlTableFn) => {
12
- const merchantProduct = mysqlTable(
11
+ export function getMerchantProductSchema(mysqlTable: MySqlTableFn) {
12
+ return mysqlTable(
13
13
  'merchantProducts',
14
14
  {
15
15
  id: varchar('id', { length: 191 }).notNull(),
@@ -35,6 +35,4 @@ export const getMerchantProductSchema = (mysqlTable: MySqlTableFn) => {
35
35
  }
36
36
  },
37
37
  )
38
-
39
- return { merchantProduct }
40
38
  }
@@ -1,7 +1,7 @@
1
1
  import { MySqlTableFn, primaryKey, varchar } from 'drizzle-orm/mysql-core'
2
2
 
3
- export const getMerchantSessionSchema = (mysqlTable: MySqlTableFn) => {
4
- const merchantSession = mysqlTable(
3
+ export function getMerchantSessionSchema(mysqlTable: MySqlTableFn) {
4
+ return mysqlTable(
5
5
  'merchantSessions',
6
6
  {
7
7
  id: varchar('id', { length: 191 }).notNull(),
@@ -19,6 +19,4 @@ export const getMerchantSessionSchema = (mysqlTable: MySqlTableFn) => {
19
19
  }
20
20
  },
21
21
  )
22
-
23
- return { merchantSession }
24
22
  }
@@ -9,8 +9,8 @@ import {
9
9
  varchar,
10
10
  } from 'drizzle-orm/mysql-core'
11
11
 
12
- export const getPriceSchema = (mysqlTable: MySqlTableFn) => {
13
- const price = mysqlTable(
12
+ export function getPriceSchema(mysqlTable: MySqlTableFn) {
13
+ return mysqlTable(
14
14
  'prices',
15
15
  {
16
16
  id: varchar('id', { length: 191 }).notNull(),
@@ -29,6 +29,4 @@ export const getPriceSchema = (mysqlTable: MySqlTableFn) => {
29
29
  }
30
30
  },
31
31
  )
32
-
33
- return { price }
34
32
  }
@@ -8,8 +8,8 @@ import {
8
8
  varchar,
9
9
  } from 'drizzle-orm/mysql-core'
10
10
 
11
- export const getProductSchema = (mysqlTable: MySqlTableFn) => {
12
- const product = mysqlTable(
11
+ export function getProductSchema(mysqlTable: MySqlTableFn) {
12
+ return mysqlTable(
13
13
  'products',
14
14
  {
15
15
  id: varchar('id', { length: 191 }).notNull(),
@@ -28,6 +28,4 @@ export const getProductSchema = (mysqlTable: MySqlTableFn) => {
28
28
  }
29
29
  },
30
30
  )
31
-
32
- return { product }
33
31
  }
@@ -7,8 +7,8 @@ import {
7
7
  varchar,
8
8
  } from 'drizzle-orm/mysql-core'
9
9
 
10
- export const getPurchaseUserTransferSchema = (mysqlTable: MySqlTableFn) => {
11
- const purchaseUserTransfer = mysqlTable(
10
+ export function getPurchaseUserTransferSchema(mysqlTable: MySqlTableFn) {
11
+ return mysqlTable(
12
12
  'purchaseUserTransfers',
13
13
  {
14
14
  id: varchar('id', { length: 191 }).notNull(),
@@ -43,6 +43,4 @@ export const getPurchaseUserTransferSchema = (mysqlTable: MySqlTableFn) => {
43
43
  }
44
44
  },
45
45
  )
46
-
47
- return { purchaseUserTransfer }
48
46
  }
@@ -9,8 +9,8 @@ import {
9
9
  varchar,
10
10
  } from 'drizzle-orm/mysql-core'
11
11
 
12
- export const getPurchaseSchema = (mysqlTable: MySqlTableFn) => {
13
- const purchase = mysqlTable(
12
+ export function getPurchaseSchema(mysqlTable: MySqlTableFn) {
13
+ return mysqlTable(
14
14
  'purchases',
15
15
  {
16
16
  id: varchar('id', { length: 191 }).notNull(),
@@ -45,6 +45,4 @@ export const getPurchaseSchema = (mysqlTable: MySqlTableFn) => {
45
45
  }
46
46
  },
47
47
  )
48
-
49
- return { purchase }
50
48
  }
@@ -7,8 +7,8 @@ import {
7
7
  varchar,
8
8
  } from 'drizzle-orm/mysql-core'
9
9
 
10
- export const getCommunicationChannelSchema = (mysqlTable: MySqlTableFn) => {
11
- const communicationChannel = mysqlTable(
10
+ export function getCommunicationChannelSchema(mysqlTable: MySqlTableFn) {
11
+ return mysqlTable(
12
12
  'communicationChannel',
13
13
  {
14
14
  id: varchar('id', { length: 255 }).notNull().primaryKey(),
@@ -32,6 +32,4 @@ export const getCommunicationChannelSchema = (mysqlTable: MySqlTableFn) => {
32
32
  nameIdx: index('name_idx').on(cc.name),
33
33
  }),
34
34
  )
35
-
36
- return { communicationChannel }
37
35
  }
@@ -6,30 +6,25 @@ import {
6
6
  varchar,
7
7
  } from 'drizzle-orm/mysql-core'
8
8
 
9
- export const getCommunicationPreferenceTypesSchema = (
9
+ export function getCommunicationPreferenceTypesSchema(
10
10
  mysqlTable: MySqlTableFn,
11
- ) => {
12
- const communicationPreferenceTypes = mysqlTable(
13
- 'communicationPreferenceType',
14
- {
15
- id: varchar('id', { length: 255 }).notNull().primaryKey(),
16
- name: varchar('name', { length: 255 }).notNull(),
17
- description: text('description'),
18
- active: boolean('active').notNull().default(true),
19
- createdAt: timestamp('createdAt', {
20
- mode: 'date',
21
- fsp: 3,
22
- }).defaultNow(),
23
- updatedAt: timestamp('updatedAt', {
24
- mode: 'date',
25
- fsp: 3,
26
- }),
27
- deletedAt: timestamp('deletedAt', {
28
- mode: 'date',
29
- fsp: 3,
30
- }),
31
- },
32
- )
33
-
34
- return { communicationPreferenceTypes }
11
+ ) {
12
+ return mysqlTable('communicationPreferenceType', {
13
+ id: varchar('id', { length: 255 }).notNull().primaryKey(),
14
+ name: varchar('name', { length: 255 }).notNull(),
15
+ description: text('description'),
16
+ active: boolean('active').notNull().default(true),
17
+ createdAt: timestamp('createdAt', {
18
+ mode: 'date',
19
+ fsp: 3,
20
+ }).defaultNow(),
21
+ updatedAt: timestamp('updatedAt', {
22
+ mode: 'date',
23
+ fsp: 3,
24
+ }),
25
+ deletedAt: timestamp('deletedAt', {
26
+ mode: 'date',
27
+ fsp: 3,
28
+ }),
29
+ })
35
30
  }
@@ -1,3 +1,4 @@
1
+ import { relations } from 'drizzle-orm'
1
2
  import {
2
3
  boolean,
3
4
  index,
@@ -7,8 +8,12 @@ import {
7
8
  varchar,
8
9
  } from 'drizzle-orm/mysql-core'
9
10
 
10
- export const getCommunicationPreferencesSchema = (mysqlTable: MySqlTableFn) => {
11
- const communicationPreferences = mysqlTable(
11
+ import { getUsersSchema } from '../auth/users.js'
12
+ import { getCommunicationChannelSchema } from './communication-channel.js'
13
+ import { getCommunicationPreferenceTypesSchema } from './communication-preference-types.js'
14
+
15
+ export function getCommunicationPreferencesSchema(mysqlTable: MySqlTableFn) {
16
+ return mysqlTable(
12
17
  'communicationPreference',
13
18
  {
14
19
  id: varchar('id', { length: 255 }).notNull().primaryKey(),
@@ -46,6 +51,28 @@ export const getCommunicationPreferencesSchema = (mysqlTable: MySqlTableFn) => {
46
51
  channelIdIdx: index('channelId_idx').on(cp.channelId),
47
52
  }),
48
53
  )
54
+ }
49
55
 
50
- return { communicationPreferences }
56
+ export function getCommunicationPreferencesRelationsSchema(
57
+ mysqlTable: MySqlTableFn,
58
+ ) {
59
+ const communicationPreferences = getCommunicationPreferencesSchema(mysqlTable)
60
+ const users = getUsersSchema(mysqlTable)
61
+ const communicationChannel = getCommunicationChannelSchema(mysqlTable)
62
+ const communicationPreferenceTypes =
63
+ getCommunicationPreferenceTypesSchema(mysqlTable)
64
+ return relations(communicationPreferences, ({ one }) => ({
65
+ user: one(users, {
66
+ fields: [communicationPreferences.userId],
67
+ references: [users.id],
68
+ }),
69
+ channel: one(communicationChannel, {
70
+ fields: [communicationPreferences.channelId],
71
+ references: [communicationChannel.id],
72
+ }),
73
+ preferenceType: one(communicationPreferenceTypes, {
74
+ fields: [communicationPreferences.preferenceTypeId],
75
+ references: [communicationPreferenceTypes.id],
76
+ }),
77
+ }))
51
78
  }
@@ -1,3 +1,4 @@
1
+ import { relations } from 'drizzle-orm'
1
2
  import {
2
3
  boolean,
3
4
  index,
@@ -6,8 +7,12 @@ import {
6
7
  varchar,
7
8
  } from 'drizzle-orm/mysql-core'
8
9
 
9
- export const getContentContributionsSchema = (mysqlTable: MySqlTableFn) => {
10
- const contentContributions = mysqlTable(
10
+ import { getUsersSchema } from '../auth/users.js'
11
+ import { getContentResourceSchema } from './content-resource.js'
12
+ import { getContributionTypesSchema } from './contribution-types.js'
13
+
14
+ export function getContentContributionsSchema(mysqlTable: MySqlTableFn) {
15
+ return mysqlTable(
11
16
  'contentContribution',
12
17
  {
13
18
  id: varchar('id', { length: 255 }).notNull().primaryKey(),
@@ -38,5 +43,28 @@ export const getContentContributionsSchema = (mysqlTable: MySqlTableFn) => {
38
43
  ),
39
44
  }),
40
45
  )
41
- return { contentContributions }
46
+ }
47
+
48
+ export function getContentContributionRelationsSchema(
49
+ mysqlTable: MySqlTableFn,
50
+ ) {
51
+ const contentContributions = getContentContributionsSchema(mysqlTable)
52
+ const users = getUsersSchema(mysqlTable)
53
+ const contentResource = getContentResourceSchema(mysqlTable)
54
+ const contributionTypes = getContributionTypesSchema(mysqlTable)
55
+
56
+ return relations(contentContributions, ({ one }) => ({
57
+ user: one(users, {
58
+ fields: [contentContributions.userId],
59
+ references: [users.id],
60
+ }),
61
+ content: one(contentResource, {
62
+ fields: [contentContributions.contentId],
63
+ references: [contentResource.id],
64
+ }),
65
+ contributionType: one(contributionTypes, {
66
+ fields: [contentContributions.contributionTypeId],
67
+ references: [contributionTypes.id],
68
+ }),
69
+ }))
42
70
  }
@@ -1,4 +1,4 @@
1
- import { sql } from 'drizzle-orm'
1
+ import { relations, sql } from 'drizzle-orm'
2
2
  import {
3
3
  double,
4
4
  index,
@@ -9,8 +9,10 @@ import {
9
9
  varchar,
10
10
  } from 'drizzle-orm/mysql-core'
11
11
 
12
- export const getContentResourceResourceSchema = (mysqlTable: MySqlTableFn) => {
13
- const contentResourceResource = mysqlTable(
12
+ import { getContentResourceSchema } from './content-resource.js'
13
+
14
+ export function getContentResourceResourceSchema(mysqlTable: MySqlTableFn) {
15
+ return mysqlTable(
14
16
  'contentResourceResource',
15
17
  {
16
18
  resourceOfId: varchar('resourceOfId', { length: 255 }).notNull(),
@@ -36,6 +38,23 @@ export const getContentResourceResourceSchema = (mysqlTable: MySqlTableFn) => {
36
38
  resourceIdIdx: index('resourceId_idx').on(crr.resourceId),
37
39
  }),
38
40
  )
41
+ }
39
42
 
40
- return { contentResourceResource }
43
+ export function getContentResourceResourceRelationsSchema(
44
+ mysqlTable: MySqlTableFn,
45
+ ) {
46
+ const contentResource = getContentResourceSchema(mysqlTable)
47
+ const contentResourceResource = getContentResourceResourceSchema(mysqlTable)
48
+ return relations(contentResourceResource, ({ one }) => ({
49
+ resourceOf: one(contentResource, {
50
+ fields: [contentResourceResource.resourceOfId],
51
+ references: [contentResource.id],
52
+ relationName: 'resourceOf',
53
+ }),
54
+ resource: one(contentResource, {
55
+ fields: [contentResourceResource.resourceId],
56
+ references: [contentResource.id],
57
+ relationName: 'resource',
58
+ }),
59
+ }))
41
60
  }
@@ -1,4 +1,4 @@
1
- import { sql } from 'drizzle-orm'
1
+ import { relations, sql } from 'drizzle-orm'
2
2
  import {
3
3
  index,
4
4
  json,
@@ -7,8 +7,12 @@ import {
7
7
  varchar,
8
8
  } from 'drizzle-orm/mysql-core'
9
9
 
10
- export const getContentResourceSchema = (mysqlTable: MySqlTableFn) => {
11
- const contentResource = mysqlTable(
10
+ import { getUsersSchema } from '../auth/users.js'
11
+ import { getContentContributionsSchema } from './content-contributions.js'
12
+ import { getContentResourceResourceSchema } from './content-resource-resource.js'
13
+
14
+ export function getContentResourceSchema(mysqlTable: MySqlTableFn) {
15
+ return mysqlTable(
12
16
  'contentResource',
13
17
  {
14
18
  id: varchar('id', { length: 255 }).notNull().primaryKey(),
@@ -34,6 +38,20 @@ export const getContentResourceSchema = (mysqlTable: MySqlTableFn) => {
34
38
  createdAtIdx: index('createdAt_idx').on(cm.createdAt),
35
39
  }),
36
40
  )
41
+ }
37
42
 
38
- return { contentResource }
43
+ export function getContentResourceRelationsSchema(mysqlTable: MySqlTableFn) {
44
+ const contentResource = getContentResourceSchema(mysqlTable)
45
+ const users = getUsersSchema(mysqlTable)
46
+ const contentContributions = getContentContributionsSchema(mysqlTable)
47
+ const contentResourceResource = getContentResourceResourceSchema(mysqlTable)
48
+ return relations(contentResource, ({ one, many }) => ({
49
+ createdBy: one(users, {
50
+ fields: [contentResource.createdById],
51
+ references: [users.id],
52
+ }),
53
+ contributions: many(contentContributions),
54
+ resources: many(contentResourceResource, { relationName: 'resourceOf' }),
55
+ resourceOf: many(contentResourceResource, { relationName: 'resource' }),
56
+ }))
39
57
  }
@@ -1,3 +1,4 @@
1
+ import { relations } from 'drizzle-orm'
1
2
  import {
2
3
  boolean,
3
4
  index,
@@ -7,8 +8,10 @@ import {
7
8
  varchar,
8
9
  } from 'drizzle-orm/mysql-core'
9
10
 
10
- export const getContributionTypesSchema = (mysqlTable: MySqlTableFn) => {
11
- const contributionTypes = mysqlTable(
11
+ import { getContentContributionsSchema } from './content-contributions.js'
12
+
13
+ export function getContributionTypesSchema(mysqlTable: MySqlTableFn) {
14
+ return mysqlTable(
12
15
  'contributionType',
13
16
  {
14
17
  id: varchar('id', { length: 255 }).notNull().primaryKey(),
@@ -34,6 +37,13 @@ export const getContributionTypesSchema = (mysqlTable: MySqlTableFn) => {
34
37
  slugIdx: index('slug_idx').on(ct.slug),
35
38
  }),
36
39
  )
40
+ }
41
+
42
+ export function getContributionTypesRelationsSchema(mysqlTable: MySqlTableFn) {
43
+ const contributionTypes = getContributionTypesSchema(mysqlTable)
44
+ const contentContributions = getContentContributionsSchema(mysqlTable)
37
45
 
38
- return { contributionTypes }
46
+ return relations(contributionTypes, ({ many }) => ({
47
+ contributions: many(contentContributions),
48
+ }))
39
49
  }
@@ -8,8 +8,8 @@ import {
8
8
  varchar,
9
9
  } from 'drizzle-orm/mysql-core'
10
10
 
11
- export const getResourceProgressSchema = (mysqlTable: MySqlTableFn) => {
12
- const resourceProgress = mysqlTable(
11
+ export function getResourceProgressSchema(mysqlTable: MySqlTableFn) {
12
+ return mysqlTable(
13
13
  'resourceProgresses',
14
14
  {
15
15
  userId: varchar('userId', { length: 191 }).notNull(),
@@ -35,6 +35,4 @@ export const getResourceProgressSchema = (mysqlTable: MySqlTableFn) => {
35
35
  }
36
36
  },
37
37
  )
38
-
39
- return { resourceProgress }
40
38
  }
package/src/lib/utils.ts CHANGED
@@ -5,7 +5,7 @@ import type { AnyPgTable, PgTableFn } from 'drizzle-orm/pg-core'
5
5
  import { type BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core'
6
6
  import type { AnySQLiteTable, SQLiteTableFn } from 'drizzle-orm/sqlite-core'
7
7
 
8
- import type { DefaultSchema as MySqlSchema } from './mysql'
8
+ import type { DefaultSchema as MySqlSchema } from './mysql/index.js'
9
9
  import type { DefaultSchema as PgSchema } from './pg.js'
10
10
  import type { DefaultSchema as SQLiteSchema } from './sqlite.js'
11
11
 
@@ -1,60 +0,0 @@
1
- import {
2
- __name
3
- } from "./chunk-VNI36MMC.js";
4
-
5
- // src/lib/mysql/schemas/communication/communication-preferences.ts
6
- import { boolean, index, mysqlEnum, timestamp, varchar } from "drizzle-orm/mysql-core";
7
- var getCommunicationPreferencesSchema = /* @__PURE__ */ __name((mysqlTable) => {
8
- const communicationPreferences = mysqlTable("communicationPreference", {
9
- id: varchar("id", {
10
- length: 255
11
- }).notNull().primaryKey(),
12
- userId: varchar("userId", {
13
- length: 255
14
- }).notNull(),
15
- channelId: varchar("channelId", {
16
- length: 255
17
- }).notNull(),
18
- preferenceLevel: mysqlEnum("preferenceLevel", [
19
- "low",
20
- "medium",
21
- "high"
22
- ]).notNull().default("medium"),
23
- preferenceTypeId: varchar("preferenceTypeId", {
24
- length: 255
25
- }).notNull(),
26
- active: boolean("active").notNull().default(true),
27
- createdAt: timestamp("createdAt", {
28
- mode: "date",
29
- fsp: 3
30
- }).defaultNow(),
31
- optInAt: timestamp("optInAt", {
32
- mode: "date",
33
- fsp: 3
34
- }),
35
- optOutAt: timestamp("optOutAt", {
36
- mode: "date",
37
- fsp: 3
38
- }),
39
- updatedAt: timestamp("updatedAt", {
40
- mode: "date",
41
- fsp: 3
42
- }).defaultNow(),
43
- deletedAt: timestamp("deletedAt", {
44
- mode: "date",
45
- fsp: 3
46
- })
47
- }, (cp) => ({
48
- userIdIdx: index("userId_idx").on(cp.userId),
49
- preferenceTypeIdx: index("preferenceTypeId_idx").on(cp.preferenceTypeId),
50
- channelIdIdx: index("channelId_idx").on(cp.channelId)
51
- }));
52
- return {
53
- communicationPreferences
54
- };
55
- }, "getCommunicationPreferencesSchema");
56
-
57
- export {
58
- getCommunicationPreferencesSchema
59
- };
60
- //# sourceMappingURL=chunk-7Z72PW3G.js.map
@@ -1,48 +0,0 @@
1
- import {
2
- __name
3
- } from "./chunk-VNI36MMC.js";
4
-
5
- // src/lib/mysql/schemas/content/content-resource-resource.ts
6
- import { sql } from "drizzle-orm";
7
- import { double, index, json, primaryKey, timestamp, varchar } from "drizzle-orm/mysql-core";
8
- var getContentResourceResourceSchema = /* @__PURE__ */ __name((mysqlTable) => {
9
- const contentResourceResource = mysqlTable("contentResourceResource", {
10
- resourceOfId: varchar("resourceOfId", {
11
- length: 255
12
- }).notNull(),
13
- resourceId: varchar("resourceId", {
14
- length: 255
15
- }).notNull(),
16
- position: double("position").notNull().default(0),
17
- metadata: json("fields").$type().default({}),
18
- createdAt: timestamp("createdAt", {
19
- mode: "date",
20
- fsp: 3
21
- }).default(sql`CURRENT_TIMESTAMP(3)`),
22
- updatedAt: timestamp("updatedAt", {
23
- mode: "date",
24
- fsp: 3
25
- }).default(sql`CURRENT_TIMESTAMP(3)`),
26
- deletedAt: timestamp("deletedAt", {
27
- mode: "date",
28
- fsp: 3
29
- })
30
- }, (crr) => ({
31
- pk: primaryKey({
32
- columns: [
33
- crr.resourceOfId,
34
- crr.resourceId
35
- ]
36
- }),
37
- contentResourceIdIdx: index("contentResourceId_idx").on(crr.resourceOfId),
38
- resourceIdIdx: index("resourceId_idx").on(crr.resourceId)
39
- }));
40
- return {
41
- contentResourceResource
42
- };
43
- }, "getContentResourceResourceSchema");
44
-
45
- export {
46
- getContentResourceResourceSchema
47
- };
48
- //# sourceMappingURL=chunk-C2G2KMWQ.js.map