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