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