@coursebuilder/adapter-drizzle 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-7ISZNMPU.js} +3 -3
- package/dist/{chunk-DL3UMWB4.js → chunk-7X7TMG4A.js} +3 -3
- package/dist/{chunk-IDINCRHK.js → chunk-DAP5KOAO.js} +3 -3
- package/dist/{chunk-J4LBG2TH.js → chunk-GINRTL6J.js} +2 -2
- package/dist/{chunk-GLPDG7UE.js → chunk-KDEWFXEP.js} +2 -2
- package/dist/chunk-KDOSK7KN.js +62 -0
- package/dist/{chunk-MBB4GIJI.js → chunk-LERR6HQ3.js} +2 -2
- package/dist/{chunk-VDVCCU7D.js → chunk-LZHZDFNZ.js} +2 -2
- package/dist/{chunk-BX5SO2JG.js → chunk-P4VXXTVA.js} +2 -2
- package/dist/{chunk-VXZRMVNY.js → chunk-QP6YMUQX.js} +2 -2
- package/dist/{chunk-XJHSXR42.js → chunk-QPXUGIXO.js} +4 -4
- package/dist/{chunk-ZD3R6UPJ.js → chunk-SRTIWWLG.js} +7 -7
- package/dist/{chunk-N7UDJAI3.js → chunk-UHH4OVKA.js} +464 -349
- package/dist/chunk-UK6EHYS5.js +54 -0
- package/dist/{chunk-A26D3TCA.js → chunk-VUS77FG3.js} +577 -185
- 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/index.d.ts +2 -1
- package/dist/index.js +26 -23
- package/dist/lib/mysql/index.cjs +1424 -786
- package/dist/lib/mysql/index.cjs.map +1 -1
- package/dist/lib/mysql/index.d.cts +2056 -1162
- package/dist/lib/mysql/index.d.ts +2056 -1162
- package/dist/lib/mysql/index.js +24 -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 +76 -77
- package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.d.cts +18 -30
- package/dist/lib/mysql/schemas/commerce/coupon.d.ts +18 -30
- 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 +136 -131
- 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/dist/lib/utils.d.cts +1 -0
- package/dist/lib/utils.d.ts +1 -0
- package/package.json +7 -5
- package/src/index.ts +14 -4
- package/src/lib/mysql/index.ts +675 -153
- 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 +4 -13
- 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,22 +403,18 @@ function getCouponSchema(mysqlTable) {
|
|
|
274
403
|
precision: 3,
|
|
275
404
|
scale: 2
|
|
276
405
|
}).notNull(),
|
|
277
|
-
restrictedToProductId:
|
|
278
|
-
length: 191
|
|
279
|
-
}),
|
|
280
|
-
bulkPurchaseId: varchar4("bulkPurchaseId", {
|
|
406
|
+
restrictedToProductId: varchar6("restrictedToProductId", {
|
|
281
407
|
length: 191
|
|
282
408
|
})
|
|
283
409
|
}, (table) => {
|
|
284
410
|
return {
|
|
285
|
-
couponIdCodeIndex:
|
|
286
|
-
couponId:
|
|
411
|
+
couponIdCodeIndex: index4("Coupon_id_code_index").on(table.id, table.code),
|
|
412
|
+
couponId: primaryKey5({
|
|
287
413
|
columns: [
|
|
288
414
|
table.id
|
|
289
415
|
],
|
|
290
416
|
name: "Coupon_id"
|
|
291
417
|
}),
|
|
292
|
-
couponBulkPurchaseIdKey: unique("Coupon_bulkPurchaseId_key").on(table.bulkPurchaseId),
|
|
293
418
|
couponCodeKey: unique("Coupon_code_key").on(table.code)
|
|
294
419
|
};
|
|
295
420
|
});
|
|
@@ -299,8 +424,8 @@ function getCouponRelationsSchema(mysqlTable) {
|
|
|
299
424
|
const purchase = getPurchaseSchema(mysqlTable);
|
|
300
425
|
const coupon = getCouponSchema(mysqlTable);
|
|
301
426
|
const merchantCoupon = getMerchantCouponSchema(mysqlTable);
|
|
302
|
-
return
|
|
303
|
-
|
|
427
|
+
return relations6(coupon, ({ many, one }) => ({
|
|
428
|
+
redeemedBulkCouponPurchases: many(purchase, {
|
|
304
429
|
relationName: "redeemedBulkCoupon"
|
|
305
430
|
}),
|
|
306
431
|
merchantCoupon: one(merchantCoupon, {
|
|
@@ -321,14 +446,8 @@ function getCouponRelationsSchema(mysqlTable) {
|
|
|
321
446
|
],
|
|
322
447
|
relationName: "product"
|
|
323
448
|
}),
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
coupon.bulkPurchaseId
|
|
327
|
-
],
|
|
328
|
-
references: [
|
|
329
|
-
purchase.id
|
|
330
|
-
],
|
|
331
|
-
relationName: "bulkPurchase"
|
|
449
|
+
bulkPurchases: many(purchase, {
|
|
450
|
+
relationName: "bulkCoupon"
|
|
332
451
|
})
|
|
333
452
|
}));
|
|
334
453
|
}
|
|
@@ -336,66 +455,67 @@ __name(getCouponRelationsSchema, "getCouponRelationsSchema");
|
|
|
336
455
|
|
|
337
456
|
// src/lib/mysql/schemas/commerce/purchase.ts
|
|
338
457
|
function getPurchaseSchema(mysqlTable) {
|
|
339
|
-
return mysqlTable("
|
|
340
|
-
id:
|
|
458
|
+
return mysqlTable("Purchase", {
|
|
459
|
+
id: varchar7("id", {
|
|
341
460
|
length: 191
|
|
342
461
|
}).notNull(),
|
|
343
|
-
userId:
|
|
462
|
+
userId: varchar7("userId", {
|
|
344
463
|
length: 191
|
|
345
464
|
}),
|
|
346
|
-
createdAt:
|
|
465
|
+
createdAt: timestamp7("createdAt", {
|
|
347
466
|
mode: "date",
|
|
348
467
|
fsp: 3
|
|
349
|
-
}).default(
|
|
468
|
+
}).default(sql7`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
350
469
|
totalAmount: decimal3("totalAmount", {
|
|
351
470
|
precision: 65,
|
|
352
471
|
scale: 30
|
|
353
472
|
}).notNull(),
|
|
354
|
-
ipAddress:
|
|
473
|
+
ipAddress: varchar7("ip_address", {
|
|
355
474
|
length: 191
|
|
356
475
|
}),
|
|
357
|
-
city:
|
|
476
|
+
city: varchar7("city", {
|
|
358
477
|
length: 191
|
|
359
478
|
}),
|
|
360
|
-
state:
|
|
479
|
+
state: varchar7("state", {
|
|
361
480
|
length: 191
|
|
362
481
|
}),
|
|
363
|
-
country:
|
|
482
|
+
country: varchar7("country", {
|
|
364
483
|
length: 191
|
|
365
484
|
}),
|
|
366
|
-
couponId:
|
|
485
|
+
couponId: varchar7("couponId", {
|
|
367
486
|
length: 191
|
|
368
487
|
}),
|
|
369
|
-
productId:
|
|
488
|
+
productId: varchar7("productId", {
|
|
370
489
|
length: 191
|
|
371
490
|
}).notNull(),
|
|
372
|
-
merchantChargeId:
|
|
491
|
+
merchantChargeId: varchar7("merchantChargeId", {
|
|
373
492
|
length: 191
|
|
374
493
|
}),
|
|
375
|
-
upgradedFromId:
|
|
494
|
+
upgradedFromId: varchar7("upgradedFromId", {
|
|
376
495
|
length: 191
|
|
377
496
|
}),
|
|
378
|
-
status:
|
|
497
|
+
status: varchar7("status", {
|
|
379
498
|
length: 191
|
|
380
499
|
}).default("Valid").notNull(),
|
|
381
|
-
bulkCouponId:
|
|
500
|
+
bulkCouponId: varchar7("bulkCouponId", {
|
|
382
501
|
length: 191
|
|
383
502
|
}),
|
|
384
|
-
merchantSessionId:
|
|
503
|
+
merchantSessionId: varchar7("merchantSessionId", {
|
|
385
504
|
length: 191
|
|
386
505
|
}),
|
|
387
|
-
redeemedBulkCouponId:
|
|
506
|
+
redeemedBulkCouponId: varchar7("redeemedBulkCouponId", {
|
|
388
507
|
length: 191
|
|
389
508
|
}),
|
|
390
|
-
fields:
|
|
509
|
+
fields: json7("fields").$type().default({})
|
|
391
510
|
}, (table) => {
|
|
392
511
|
return {
|
|
393
|
-
purchaseId:
|
|
512
|
+
purchaseId: primaryKey6({
|
|
394
513
|
columns: [
|
|
395
514
|
table.id
|
|
396
515
|
],
|
|
397
516
|
name: "Purchase_id"
|
|
398
517
|
}),
|
|
518
|
+
merchantChargeIdIdx: index5("idx_Purchase_on_merchantChargeId").on(table.merchantChargeId),
|
|
399
519
|
purchaseUpgradedFromIdKey: unique2("Purchase_upgradedFromId_key").on(table.upgradedFromId)
|
|
400
520
|
};
|
|
401
521
|
});
|
|
@@ -408,7 +528,7 @@ function getPurchaseRelationsSchema(mysqlTable) {
|
|
|
408
528
|
const merchantCharges = getMerchantChargeSchema(mysqlTable);
|
|
409
529
|
const merchantSessions = getMerchantSessionSchema(mysqlTable);
|
|
410
530
|
const coupons = getCouponSchema(mysqlTable);
|
|
411
|
-
return
|
|
531
|
+
return relations7(purchases, ({ many, one }) => ({
|
|
412
532
|
redeemedBulkCoupon: one(coupons, {
|
|
413
533
|
fields: [
|
|
414
534
|
purchases.redeemedBulkCouponId
|
|
@@ -467,18 +587,70 @@ function getPurchaseRelationsSchema(mysqlTable) {
|
|
|
467
587
|
}
|
|
468
588
|
__name(getPurchaseRelationsSchema, "getPurchaseRelationsSchema");
|
|
469
589
|
|
|
590
|
+
// src/lib/mysql/schemas/communication/comment.ts
|
|
591
|
+
import { relations as relations8, sql as sql8 } from "drizzle-orm";
|
|
592
|
+
import { index as index6, json as json8, primaryKey as primaryKey7, text, timestamp as timestamp8, varchar as varchar8 } from "drizzle-orm/mysql-core";
|
|
593
|
+
function getCommentsSchema(mysqlTable) {
|
|
594
|
+
return mysqlTable("Comment", {
|
|
595
|
+
id: varchar8("id", {
|
|
596
|
+
length: 191
|
|
597
|
+
}).notNull(),
|
|
598
|
+
userId: varchar8("userId", {
|
|
599
|
+
length: 255
|
|
600
|
+
}).notNull(),
|
|
601
|
+
context: json8("context").$type().default({}),
|
|
602
|
+
text: text("text").notNull(),
|
|
603
|
+
createdAt: timestamp8("createdAt", {
|
|
604
|
+
mode: "date",
|
|
605
|
+
fsp: 3
|
|
606
|
+
}).default(sql8`CURRENT_TIMESTAMP(3)`),
|
|
607
|
+
updatedAt: timestamp8("updatedAt", {
|
|
608
|
+
mode: "date",
|
|
609
|
+
fsp: 3
|
|
610
|
+
}).default(sql8`CURRENT_TIMESTAMP(3)`),
|
|
611
|
+
deletedAt: timestamp8("deletedAt", {
|
|
612
|
+
mode: "date",
|
|
613
|
+
fsp: 3
|
|
614
|
+
})
|
|
615
|
+
}, (crr) => ({
|
|
616
|
+
pk: primaryKey7({
|
|
617
|
+
columns: [
|
|
618
|
+
crr.id
|
|
619
|
+
]
|
|
620
|
+
}),
|
|
621
|
+
crrUserIdIdKey: index6("crr_userIdId_idx").on(crr.userId)
|
|
622
|
+
}));
|
|
623
|
+
}
|
|
624
|
+
__name(getCommentsSchema, "getCommentsSchema");
|
|
625
|
+
function getCommentRelationsSchema(mysqlTable) {
|
|
626
|
+
const comment = getCommentsSchema(mysqlTable);
|
|
627
|
+
const user = getUsersSchema(mysqlTable);
|
|
628
|
+
return relations8(comment, ({ one }) => ({
|
|
629
|
+
user: one(user, {
|
|
630
|
+
fields: [
|
|
631
|
+
comment.userId
|
|
632
|
+
],
|
|
633
|
+
references: [
|
|
634
|
+
user.id
|
|
635
|
+
],
|
|
636
|
+
relationName: "user"
|
|
637
|
+
})
|
|
638
|
+
}));
|
|
639
|
+
}
|
|
640
|
+
__name(getCommentRelationsSchema, "getCommentRelationsSchema");
|
|
641
|
+
|
|
470
642
|
// src/lib/mysql/schemas/communication/communication-preferences.ts
|
|
471
|
-
import { relations as
|
|
472
|
-
import { boolean as boolean2, index as
|
|
643
|
+
import { relations as relations9 } from "drizzle-orm";
|
|
644
|
+
import { boolean as boolean2, index as index7, mysqlEnum, timestamp as timestamp9, varchar as varchar9 } from "drizzle-orm/mysql-core";
|
|
473
645
|
function getCommunicationPreferencesSchema(mysqlTable) {
|
|
474
|
-
return mysqlTable("
|
|
475
|
-
id:
|
|
646
|
+
return mysqlTable("CommunicationPreference", {
|
|
647
|
+
id: varchar9("id", {
|
|
476
648
|
length: 255
|
|
477
649
|
}).notNull().primaryKey(),
|
|
478
|
-
userId:
|
|
650
|
+
userId: varchar9("userId", {
|
|
479
651
|
length: 255
|
|
480
652
|
}).notNull(),
|
|
481
|
-
channelId:
|
|
653
|
+
channelId: varchar9("channelId", {
|
|
482
654
|
length: 255
|
|
483
655
|
}).notNull(),
|
|
484
656
|
preferenceLevel: mysqlEnum("preferenceLevel", [
|
|
@@ -486,34 +658,34 @@ function getCommunicationPreferencesSchema(mysqlTable) {
|
|
|
486
658
|
"medium",
|
|
487
659
|
"high"
|
|
488
660
|
]).notNull().default("medium"),
|
|
489
|
-
preferenceTypeId:
|
|
661
|
+
preferenceTypeId: varchar9("preferenceTypeId", {
|
|
490
662
|
length: 255
|
|
491
663
|
}).notNull(),
|
|
492
664
|
active: boolean2("active").notNull().default(true),
|
|
493
|
-
createdAt:
|
|
665
|
+
createdAt: timestamp9("createdAt", {
|
|
494
666
|
mode: "date",
|
|
495
667
|
fsp: 3
|
|
496
668
|
}).defaultNow(),
|
|
497
|
-
optInAt:
|
|
669
|
+
optInAt: timestamp9("optInAt", {
|
|
498
670
|
mode: "date",
|
|
499
671
|
fsp: 3
|
|
500
672
|
}),
|
|
501
|
-
optOutAt:
|
|
673
|
+
optOutAt: timestamp9("optOutAt", {
|
|
502
674
|
mode: "date",
|
|
503
675
|
fsp: 3
|
|
504
676
|
}),
|
|
505
|
-
updatedAt:
|
|
677
|
+
updatedAt: timestamp9("updatedAt", {
|
|
506
678
|
mode: "date",
|
|
507
679
|
fsp: 3
|
|
508
680
|
}).defaultNow(),
|
|
509
|
-
deletedAt:
|
|
681
|
+
deletedAt: timestamp9("deletedAt", {
|
|
510
682
|
mode: "date",
|
|
511
683
|
fsp: 3
|
|
512
684
|
})
|
|
513
685
|
}, (cp) => ({
|
|
514
|
-
userIdIdx:
|
|
515
|
-
preferenceTypeIdx:
|
|
516
|
-
channelIdIdx:
|
|
686
|
+
userIdIdx: index7("userId_idx").on(cp.userId),
|
|
687
|
+
preferenceTypeIdx: index7("preferenceTypeId_idx").on(cp.preferenceTypeId),
|
|
688
|
+
channelIdIdx: index7("channelId_idx").on(cp.channelId)
|
|
517
689
|
}));
|
|
518
690
|
}
|
|
519
691
|
__name(getCommunicationPreferencesSchema, "getCommunicationPreferencesSchema");
|
|
@@ -522,7 +694,7 @@ function getCommunicationPreferencesRelationsSchema(mysqlTable) {
|
|
|
522
694
|
const users = getUsersSchema(mysqlTable);
|
|
523
695
|
const communicationChannel = getCommunicationChannelSchema(mysqlTable);
|
|
524
696
|
const communicationPreferenceTypes = getCommunicationPreferenceTypesSchema(mysqlTable);
|
|
525
|
-
return
|
|
697
|
+
return relations9(communicationPreferences, ({ one }) => ({
|
|
526
698
|
user: one(users, {
|
|
527
699
|
fields: [
|
|
528
700
|
communicationPreferences.userId
|
|
@@ -554,128 +726,54 @@ function getCommunicationPreferencesRelationsSchema(mysqlTable) {
|
|
|
554
726
|
}
|
|
555
727
|
__name(getCommunicationPreferencesRelationsSchema, "getCommunicationPreferencesRelationsSchema");
|
|
556
728
|
|
|
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
729
|
// src/lib/mysql/schemas/auth/accounts.ts
|
|
632
|
-
import { relations as
|
|
633
|
-
import { index as
|
|
730
|
+
import { relations as relations10 } from "drizzle-orm";
|
|
731
|
+
import { index as index8, int as int4, primaryKey as primaryKey8, text as text2, varchar as varchar10 } from "drizzle-orm/mysql-core";
|
|
634
732
|
function getAccountsSchema(mysqlTable) {
|
|
635
|
-
return mysqlTable("
|
|
636
|
-
userId:
|
|
733
|
+
return mysqlTable("Account", {
|
|
734
|
+
userId: varchar10("userId", {
|
|
637
735
|
length: 255
|
|
638
736
|
}).notNull(),
|
|
639
|
-
type:
|
|
737
|
+
type: varchar10("type", {
|
|
640
738
|
length: 255
|
|
641
739
|
}).$type().notNull(),
|
|
642
|
-
provider:
|
|
740
|
+
provider: varchar10("provider", {
|
|
643
741
|
length: 255
|
|
644
742
|
}).notNull(),
|
|
645
|
-
providerAccountId:
|
|
743
|
+
providerAccountId: varchar10("providerAccountId", {
|
|
646
744
|
length: 255
|
|
647
745
|
}).notNull(),
|
|
648
|
-
refresh_token:
|
|
649
|
-
access_token:
|
|
650
|
-
oauth_token:
|
|
651
|
-
oauth_token_secret:
|
|
746
|
+
refresh_token: text2("refresh_token"),
|
|
747
|
+
access_token: text2("access_token"),
|
|
748
|
+
oauth_token: text2("oauth_token"),
|
|
749
|
+
oauth_token_secret: text2("oauth_token_secret"),
|
|
652
750
|
expires_at: int4("expires_at"),
|
|
653
|
-
token_type:
|
|
751
|
+
token_type: varchar10("token_type", {
|
|
654
752
|
length: 255
|
|
655
753
|
}),
|
|
656
|
-
scope:
|
|
754
|
+
scope: varchar10("scope", {
|
|
657
755
|
length: 255
|
|
658
756
|
}),
|
|
659
|
-
id_token:
|
|
660
|
-
session_state:
|
|
757
|
+
id_token: text2("id_token"),
|
|
758
|
+
session_state: varchar10("session_state", {
|
|
661
759
|
length: 255
|
|
662
760
|
}),
|
|
663
761
|
refresh_token_expires_in: int4("refresh_token_expires_in")
|
|
664
762
|
}, (account) => ({
|
|
665
|
-
pk:
|
|
763
|
+
pk: primaryKey8({
|
|
666
764
|
columns: [
|
|
667
765
|
account.provider,
|
|
668
766
|
account.providerAccountId
|
|
669
767
|
]
|
|
670
768
|
}),
|
|
671
|
-
userIdIdx:
|
|
769
|
+
userIdIdx: index8("userId_idx").on(account.userId)
|
|
672
770
|
}));
|
|
673
771
|
}
|
|
674
772
|
__name(getAccountsSchema, "getAccountsSchema");
|
|
675
773
|
function getAccountsRelationsSchema(mysqlTable) {
|
|
676
774
|
const accounts = getAccountsSchema(mysqlTable);
|
|
677
775
|
const users = getUsersSchema(mysqlTable);
|
|
678
|
-
return
|
|
776
|
+
return relations10(accounts, ({ one }) => ({
|
|
679
777
|
user: one(users, {
|
|
680
778
|
fields: [
|
|
681
779
|
accounts.userId
|
|
@@ -690,38 +788,38 @@ function getAccountsRelationsSchema(mysqlTable) {
|
|
|
690
788
|
__name(getAccountsRelationsSchema, "getAccountsRelationsSchema");
|
|
691
789
|
|
|
692
790
|
// src/lib/mysql/schemas/auth/user-permissions.ts
|
|
693
|
-
import { relations as
|
|
694
|
-
import { boolean as
|
|
791
|
+
import { relations as relations11 } from "drizzle-orm";
|
|
792
|
+
import { boolean as boolean3, index as index9, primaryKey as primaryKey9, timestamp as timestamp10, varchar as varchar11 } from "drizzle-orm/mysql-core";
|
|
695
793
|
function getUserPermissionsSchema(mysqlTable) {
|
|
696
|
-
return mysqlTable("
|
|
697
|
-
userId:
|
|
794
|
+
return mysqlTable("UserPermission", {
|
|
795
|
+
userId: varchar11("userId", {
|
|
698
796
|
length: 255
|
|
699
797
|
}).notNull(),
|
|
700
|
-
permissionId:
|
|
798
|
+
permissionId: varchar11("permissionId", {
|
|
701
799
|
length: 255
|
|
702
800
|
}).notNull(),
|
|
703
|
-
active:
|
|
704
|
-
createdAt:
|
|
801
|
+
active: boolean3("active").notNull().default(true),
|
|
802
|
+
createdAt: timestamp10("createdAt", {
|
|
705
803
|
mode: "date",
|
|
706
804
|
fsp: 3
|
|
707
805
|
}).defaultNow(),
|
|
708
|
-
updatedAt:
|
|
806
|
+
updatedAt: timestamp10("updatedAt", {
|
|
709
807
|
mode: "date",
|
|
710
808
|
fsp: 3
|
|
711
809
|
}).defaultNow(),
|
|
712
|
-
deletedAt:
|
|
810
|
+
deletedAt: timestamp10("deletedAt", {
|
|
713
811
|
mode: "date",
|
|
714
812
|
fsp: 3
|
|
715
813
|
})
|
|
716
814
|
}, (up) => ({
|
|
717
|
-
pk:
|
|
815
|
+
pk: primaryKey9({
|
|
718
816
|
columns: [
|
|
719
817
|
up.userId,
|
|
720
818
|
up.permissionId
|
|
721
819
|
]
|
|
722
820
|
}),
|
|
723
|
-
userIdIdx:
|
|
724
|
-
permissionIdIdx:
|
|
821
|
+
userIdIdx: index9("userId_idx").on(up.userId),
|
|
822
|
+
permissionIdIdx: index9("permissionId_idx").on(up.permissionId)
|
|
725
823
|
}));
|
|
726
824
|
}
|
|
727
825
|
__name(getUserPermissionsSchema, "getUserPermissionsSchema");
|
|
@@ -729,7 +827,7 @@ function getUserPermissionsRelationsSchema(mysqlTable) {
|
|
|
729
827
|
const userPermissions = getUserPermissionsSchema(mysqlTable);
|
|
730
828
|
const users = getUsersSchema(mysqlTable);
|
|
731
829
|
const permissions = getPermissionsSchema(mysqlTable);
|
|
732
|
-
return
|
|
830
|
+
return relations11(userPermissions, ({ one }) => ({
|
|
733
831
|
user: one(users, {
|
|
734
832
|
fields: [
|
|
735
833
|
userPermissions.userId
|
|
@@ -752,44 +850,98 @@ function getUserPermissionsRelationsSchema(mysqlTable) {
|
|
|
752
850
|
}
|
|
753
851
|
__name(getUserPermissionsRelationsSchema, "getUserPermissionsRelationsSchema");
|
|
754
852
|
|
|
853
|
+
// src/lib/mysql/schemas/auth/user-prefs.ts
|
|
854
|
+
import { relations as relations12, sql as sql9 } from "drizzle-orm";
|
|
855
|
+
import { index as index10, json as json9, primaryKey as primaryKey10, timestamp as timestamp11, varchar as varchar12 } from "drizzle-orm/mysql-core";
|
|
856
|
+
function getUserPrefsSchema(mysqlTable) {
|
|
857
|
+
return mysqlTable("UserPrefs", {
|
|
858
|
+
id: varchar12("id", {
|
|
859
|
+
length: 191
|
|
860
|
+
}).notNull(),
|
|
861
|
+
type: varchar12("type", {
|
|
862
|
+
length: 191
|
|
863
|
+
}).default("Global").notNull(),
|
|
864
|
+
userId: varchar12("userId", {
|
|
865
|
+
length: 255
|
|
866
|
+
}).notNull(),
|
|
867
|
+
fields: json9("fields").$type().default({}),
|
|
868
|
+
createdAt: timestamp11("createdAt", {
|
|
869
|
+
mode: "date",
|
|
870
|
+
fsp: 3
|
|
871
|
+
}).default(sql9`CURRENT_TIMESTAMP(3)`),
|
|
872
|
+
updatedAt: timestamp11("updatedAt", {
|
|
873
|
+
mode: "date",
|
|
874
|
+
fsp: 3
|
|
875
|
+
}).default(sql9`CURRENT_TIMESTAMP(3)`),
|
|
876
|
+
deletedAt: timestamp11("deletedAt", {
|
|
877
|
+
mode: "date",
|
|
878
|
+
fsp: 3
|
|
879
|
+
})
|
|
880
|
+
}, (crr) => ({
|
|
881
|
+
pk: primaryKey10({
|
|
882
|
+
columns: [
|
|
883
|
+
crr.id
|
|
884
|
+
]
|
|
885
|
+
}),
|
|
886
|
+
crrUserIdIdKey: index10("crr_userIdId_idx").on(crr.userId)
|
|
887
|
+
}));
|
|
888
|
+
}
|
|
889
|
+
__name(getUserPrefsSchema, "getUserPrefsSchema");
|
|
890
|
+
function getUserPrefsRelationsSchema(mysqlTable) {
|
|
891
|
+
const userPrefs = getUserPrefsSchema(mysqlTable);
|
|
892
|
+
const user = getUsersSchema(mysqlTable);
|
|
893
|
+
return relations12(userPrefs, ({ one }) => ({
|
|
894
|
+
user: one(user, {
|
|
895
|
+
fields: [
|
|
896
|
+
userPrefs.userId
|
|
897
|
+
],
|
|
898
|
+
references: [
|
|
899
|
+
user.id
|
|
900
|
+
],
|
|
901
|
+
relationName: "user"
|
|
902
|
+
})
|
|
903
|
+
}));
|
|
904
|
+
}
|
|
905
|
+
__name(getUserPrefsRelationsSchema, "getUserPrefsRelationsSchema");
|
|
906
|
+
|
|
755
907
|
// src/lib/mysql/schemas/auth/user-roles.ts
|
|
756
|
-
import { relations as
|
|
757
|
-
import { boolean as
|
|
908
|
+
import { relations as relations14 } from "drizzle-orm";
|
|
909
|
+
import { boolean as boolean5, index as index12, primaryKey as primaryKey11, timestamp as timestamp13, varchar as varchar14 } from "drizzle-orm/mysql-core";
|
|
758
910
|
|
|
759
911
|
// src/lib/mysql/schemas/auth/roles.ts
|
|
760
|
-
import { relations as
|
|
761
|
-
import { boolean as
|
|
912
|
+
import { relations as relations13 } from "drizzle-orm";
|
|
913
|
+
import { boolean as boolean4, index as index11, text as text3, timestamp as timestamp12, varchar as varchar13 } from "drizzle-orm/mysql-core";
|
|
762
914
|
function getRolesSchema(mysqlTable) {
|
|
763
|
-
return mysqlTable("
|
|
764
|
-
id:
|
|
915
|
+
return mysqlTable("Role", {
|
|
916
|
+
id: varchar13("id", {
|
|
765
917
|
length: 255
|
|
766
918
|
}).notNull().primaryKey(),
|
|
767
|
-
name:
|
|
919
|
+
name: varchar13("name", {
|
|
768
920
|
length: 255
|
|
769
921
|
}).notNull().unique(),
|
|
770
|
-
description:
|
|
771
|
-
active:
|
|
772
|
-
createdAt:
|
|
922
|
+
description: text3("description"),
|
|
923
|
+
active: boolean4("active").notNull().default(true),
|
|
924
|
+
createdAt: timestamp12("createdAt", {
|
|
773
925
|
mode: "date",
|
|
774
926
|
fsp: 3
|
|
775
927
|
}).defaultNow(),
|
|
776
|
-
updatedAt:
|
|
928
|
+
updatedAt: timestamp12("updatedAt", {
|
|
777
929
|
mode: "date",
|
|
778
930
|
fsp: 3
|
|
779
931
|
}).defaultNow(),
|
|
780
|
-
deletedAt:
|
|
932
|
+
deletedAt: timestamp12("deletedAt", {
|
|
781
933
|
mode: "date",
|
|
782
934
|
fsp: 3
|
|
783
935
|
})
|
|
784
936
|
}, (role) => ({
|
|
785
|
-
nameIdx:
|
|
937
|
+
nameIdx: index11("name_idx").on(role.name)
|
|
786
938
|
}));
|
|
787
939
|
}
|
|
788
940
|
__name(getRolesSchema, "getRolesSchema");
|
|
789
941
|
function getRolesRelationsSchema(mysqlTable) {
|
|
790
942
|
const roles = getRolesSchema(mysqlTable);
|
|
791
943
|
const userRoles = getUserRolesSchema(mysqlTable);
|
|
792
|
-
return
|
|
944
|
+
return relations13(roles, ({ many }) => ({
|
|
793
945
|
userRoles: many(userRoles, {
|
|
794
946
|
relationName: "role"
|
|
795
947
|
})
|
|
@@ -799,35 +951,35 @@ __name(getRolesRelationsSchema, "getRolesRelationsSchema");
|
|
|
799
951
|
|
|
800
952
|
// src/lib/mysql/schemas/auth/user-roles.ts
|
|
801
953
|
function getUserRolesSchema(mysqlTable) {
|
|
802
|
-
return mysqlTable("
|
|
803
|
-
userId:
|
|
954
|
+
return mysqlTable("UserRole", {
|
|
955
|
+
userId: varchar14("userId", {
|
|
804
956
|
length: 255
|
|
805
957
|
}).notNull(),
|
|
806
|
-
roleId:
|
|
958
|
+
roleId: varchar14("roleId", {
|
|
807
959
|
length: 255
|
|
808
960
|
}).notNull(),
|
|
809
|
-
active:
|
|
810
|
-
createdAt:
|
|
961
|
+
active: boolean5("active").notNull().default(true),
|
|
962
|
+
createdAt: timestamp13("createdAt", {
|
|
811
963
|
mode: "date",
|
|
812
964
|
fsp: 3
|
|
813
965
|
}).defaultNow(),
|
|
814
|
-
updatedAt:
|
|
966
|
+
updatedAt: timestamp13("updatedAt", {
|
|
815
967
|
mode: "date",
|
|
816
968
|
fsp: 3
|
|
817
969
|
}).defaultNow(),
|
|
818
|
-
deletedAt:
|
|
970
|
+
deletedAt: timestamp13("deletedAt", {
|
|
819
971
|
mode: "date",
|
|
820
972
|
fsp: 3
|
|
821
973
|
})
|
|
822
974
|
}, (ur) => ({
|
|
823
|
-
pk:
|
|
975
|
+
pk: primaryKey11({
|
|
824
976
|
columns: [
|
|
825
977
|
ur.userId,
|
|
826
978
|
ur.roleId
|
|
827
979
|
]
|
|
828
980
|
}),
|
|
829
|
-
userIdIdx:
|
|
830
|
-
roleIdIdx:
|
|
981
|
+
userIdIdx: index12("userId_idx").on(ur.userId),
|
|
982
|
+
roleIdIdx: index12("roleId_idx").on(ur.roleId)
|
|
831
983
|
}));
|
|
832
984
|
}
|
|
833
985
|
__name(getUserRolesSchema, "getUserRolesSchema");
|
|
@@ -835,7 +987,7 @@ function getUserRolesRelationsSchema(mysqlTable) {
|
|
|
835
987
|
const userRoles = getUserRolesSchema(mysqlTable);
|
|
836
988
|
const users = getUsersSchema(mysqlTable);
|
|
837
989
|
const roles = getRolesSchema(mysqlTable);
|
|
838
|
-
return
|
|
990
|
+
return relations14(userRoles, ({ one }) => ({
|
|
839
991
|
user: one(users, {
|
|
840
992
|
fields: [
|
|
841
993
|
userRoles.userId
|
|
@@ -860,35 +1012,35 @@ __name(getUserRolesRelationsSchema, "getUserRolesRelationsSchema");
|
|
|
860
1012
|
|
|
861
1013
|
// src/lib/mysql/schemas/auth/users.ts
|
|
862
1014
|
function getUsersSchema(mysqlTable) {
|
|
863
|
-
return mysqlTable("
|
|
864
|
-
id:
|
|
1015
|
+
return mysqlTable("User", {
|
|
1016
|
+
id: varchar15("id", {
|
|
865
1017
|
length: 255
|
|
866
1018
|
}).notNull().primaryKey(),
|
|
867
|
-
name:
|
|
1019
|
+
name: varchar15("name", {
|
|
868
1020
|
length: 255
|
|
869
1021
|
}),
|
|
870
|
-
role:
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
email: varchar12("email", {
|
|
1022
|
+
role: varchar15("role", {
|
|
1023
|
+
length: 191
|
|
1024
|
+
}).notNull().default("user"),
|
|
1025
|
+
email: varchar15("email", {
|
|
875
1026
|
length: 255
|
|
876
1027
|
}).notNull().unique(),
|
|
877
|
-
|
|
1028
|
+
fields: json10("fields").$type().default({}),
|
|
1029
|
+
emailVerified: timestamp14("emailVerified", {
|
|
878
1030
|
mode: "date",
|
|
879
1031
|
fsp: 3
|
|
880
1032
|
}),
|
|
881
|
-
image:
|
|
1033
|
+
image: varchar15("image", {
|
|
882
1034
|
length: 255
|
|
883
1035
|
}),
|
|
884
|
-
createdAt:
|
|
1036
|
+
createdAt: timestamp14("createdAt", {
|
|
885
1037
|
mode: "date",
|
|
886
1038
|
fsp: 3
|
|
887
|
-
}).default(
|
|
1039
|
+
}).default(sql10`CURRENT_TIMESTAMP(3)`)
|
|
888
1040
|
}, (user) => ({
|
|
889
|
-
emailIdx:
|
|
890
|
-
roleIdx:
|
|
891
|
-
createdAtIdx:
|
|
1041
|
+
emailIdx: index13("email_idx").on(user.email),
|
|
1042
|
+
roleIdx: index13("role_idx").on(user.role),
|
|
1043
|
+
createdAtIdx: index13("created_at_idx").on(user.createdAt)
|
|
892
1044
|
}));
|
|
893
1045
|
}
|
|
894
1046
|
__name(getUsersSchema, "getUsersSchema");
|
|
@@ -901,7 +1053,9 @@ function getUsersRelationsSchema(mysqlTable) {
|
|
|
901
1053
|
const contentContributions = getContentContributionsSchema(mysqlTable);
|
|
902
1054
|
const contentResource = getContentResourceSchema(mysqlTable);
|
|
903
1055
|
const purchases = getPurchaseSchema(mysqlTable);
|
|
904
|
-
|
|
1056
|
+
const comments = getCommentsSchema(mysqlTable);
|
|
1057
|
+
const userPrefs = getUserPrefsSchema(mysqlTable);
|
|
1058
|
+
return relations15(users, ({ many }) => ({
|
|
905
1059
|
accounts: many(accounts, {
|
|
906
1060
|
relationName: "user"
|
|
907
1061
|
}),
|
|
@@ -922,133 +1076,92 @@ function getUsersRelationsSchema(mysqlTable) {
|
|
|
922
1076
|
}),
|
|
923
1077
|
createdContent: many(contentResource, {
|
|
924
1078
|
relationName: "user"
|
|
1079
|
+
}),
|
|
1080
|
+
comments: many(comments, {
|
|
1081
|
+
relationName: "user"
|
|
1082
|
+
}),
|
|
1083
|
+
prefs: many(userPrefs, {
|
|
1084
|
+
relationName: "user"
|
|
925
1085
|
})
|
|
926
1086
|
}));
|
|
927
1087
|
}
|
|
928
1088
|
__name(getUsersRelationsSchema, "getUsersRelationsSchema");
|
|
929
1089
|
|
|
930
|
-
// src/lib/mysql/schemas/content/content-
|
|
931
|
-
function
|
|
932
|
-
return mysqlTable("
|
|
933
|
-
id:
|
|
1090
|
+
// src/lib/mysql/schemas/content/content-contributions.ts
|
|
1091
|
+
function getContentContributionsSchema(mysqlTable) {
|
|
1092
|
+
return mysqlTable("ContentContribution", {
|
|
1093
|
+
id: varchar16("id", {
|
|
934
1094
|
length: 255
|
|
935
1095
|
}).notNull().primaryKey(),
|
|
936
|
-
|
|
1096
|
+
userId: varchar16("userId", {
|
|
937
1097
|
length: 255
|
|
938
1098
|
}).notNull(),
|
|
939
|
-
|
|
1099
|
+
contentId: varchar16("contentId", {
|
|
940
1100
|
length: 255
|
|
941
1101
|
}).notNull(),
|
|
942
|
-
|
|
943
|
-
|
|
1102
|
+
contributionTypeId: varchar16("contributionTypeId", {
|
|
1103
|
+
length: 255
|
|
1104
|
+
}).notNull(),
|
|
1105
|
+
active: boolean6("active").notNull().default(true),
|
|
1106
|
+
createdAt: timestamp15("createdAt", {
|
|
944
1107
|
mode: "date",
|
|
945
1108
|
fsp: 3
|
|
946
|
-
}).
|
|
947
|
-
updatedAt:
|
|
1109
|
+
}).defaultNow(),
|
|
1110
|
+
updatedAt: timestamp15("updatedAt", {
|
|
948
1111
|
mode: "date",
|
|
949
1112
|
fsp: 3
|
|
950
|
-
}).
|
|
951
|
-
deletedAt:
|
|
1113
|
+
}).defaultNow(),
|
|
1114
|
+
deletedAt: timestamp15("deletedAt", {
|
|
952
1115
|
mode: "date",
|
|
953
1116
|
fsp: 3
|
|
954
1117
|
})
|
|
955
|
-
}, (
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
1118
|
+
}, (cc) => ({
|
|
1119
|
+
userIdIdx: index14("userId_idx").on(cc.userId),
|
|
1120
|
+
contentIdIdx: index14("contentId_idx").on(cc.contentId),
|
|
1121
|
+
contributionTypeIdIdx: index14("contributionTypeId_idx").on(cc.contributionTypeId)
|
|
959
1122
|
}));
|
|
960
1123
|
}
|
|
961
|
-
__name(
|
|
962
|
-
function
|
|
963
|
-
const
|
|
1124
|
+
__name(getContentContributionsSchema, "getContentContributionsSchema");
|
|
1125
|
+
function getContentContributionRelationsSchema(mysqlTable) {
|
|
1126
|
+
const contentContributions = getContentContributionsSchema(mysqlTable);
|
|
964
1127
|
const users = getUsersSchema(mysqlTable);
|
|
965
|
-
const
|
|
966
|
-
const
|
|
967
|
-
return
|
|
968
|
-
|
|
1128
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
1129
|
+
const contributionTypes = getContributionTypesSchema(mysqlTable);
|
|
1130
|
+
return relations16(contentContributions, ({ one }) => ({
|
|
1131
|
+
user: one(users, {
|
|
969
1132
|
fields: [
|
|
970
|
-
|
|
1133
|
+
contentContributions.userId
|
|
971
1134
|
],
|
|
972
1135
|
references: [
|
|
973
1136
|
users.id
|
|
974
1137
|
],
|
|
975
1138
|
relationName: "user"
|
|
976
1139
|
}),
|
|
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, {
|
|
1140
|
+
content: one(contentResource, {
|
|
1030
1141
|
fields: [
|
|
1031
|
-
|
|
1142
|
+
contentContributions.contentId
|
|
1032
1143
|
],
|
|
1033
1144
|
references: [
|
|
1034
1145
|
contentResource.id
|
|
1035
1146
|
],
|
|
1036
|
-
relationName: "
|
|
1147
|
+
relationName: "contributions"
|
|
1037
1148
|
}),
|
|
1038
|
-
|
|
1149
|
+
contributionType: one(contributionTypes, {
|
|
1039
1150
|
fields: [
|
|
1040
|
-
|
|
1151
|
+
contentContributions.contributionTypeId
|
|
1041
1152
|
],
|
|
1042
1153
|
references: [
|
|
1043
|
-
|
|
1154
|
+
contributionTypes.id
|
|
1044
1155
|
],
|
|
1045
|
-
relationName: "
|
|
1156
|
+
relationName: "contributionType"
|
|
1046
1157
|
})
|
|
1047
1158
|
}));
|
|
1048
1159
|
}
|
|
1049
|
-
__name(
|
|
1160
|
+
__name(getContentContributionRelationsSchema, "getContentContributionRelationsSchema");
|
|
1050
1161
|
|
|
1051
1162
|
export {
|
|
1163
|
+
getContentContributionsSchema,
|
|
1164
|
+
getContentContributionRelationsSchema,
|
|
1052
1165
|
getContentResourceResourceSchema,
|
|
1053
1166
|
getContentResourceResourceRelationsSchema,
|
|
1054
1167
|
getContentResourceSchema,
|
|
@@ -1063,12 +1176,14 @@ export {
|
|
|
1063
1176
|
getCouponRelationsSchema,
|
|
1064
1177
|
getPurchaseSchema,
|
|
1065
1178
|
getPurchaseRelationsSchema,
|
|
1179
|
+
getCommentsSchema,
|
|
1180
|
+
getCommentRelationsSchema,
|
|
1066
1181
|
getCommunicationPreferencesSchema,
|
|
1067
1182
|
getCommunicationPreferencesRelationsSchema,
|
|
1068
|
-
getContentContributionsSchema,
|
|
1069
|
-
getContentContributionRelationsSchema,
|
|
1070
1183
|
getUserPermissionsSchema,
|
|
1071
1184
|
getUserPermissionsRelationsSchema,
|
|
1185
|
+
getUserPrefsSchema,
|
|
1186
|
+
getUserPrefsRelationsSchema,
|
|
1072
1187
|
getRolesSchema,
|
|
1073
1188
|
getRolesRelationsSchema,
|
|
1074
1189
|
getUserRolesSchema,
|
|
@@ -1078,4 +1193,4 @@ export {
|
|
|
1078
1193
|
getAccountsSchema,
|
|
1079
1194
|
getAccountsRelationsSchema
|
|
1080
1195
|
};
|
|
1081
|
-
//# sourceMappingURL=chunk-
|
|
1196
|
+
//# sourceMappingURL=chunk-UHH4OVKA.js.map
|