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