@coursebuilder/adapter-drizzle 0.5.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-QQA7STVO.js → chunk-3WYG5OE7.js} +2 -2
- package/dist/{chunk-6SLQW6OM.js → chunk-5XTOCFDB.js} +5 -2
- package/dist/{chunk-2UU2F4DM.js → chunk-6MRFUIH5.js} +6 -2
- package/dist/{chunk-XIGJFVUM.js → chunk-6YPHJWS2.js} +9 -2
- package/dist/{chunk-EFVZ7IN4.js → chunk-A6XPL665.js} +2 -2
- package/dist/{chunk-3NUCFLQJ.js → chunk-BLDW3QUS.js} +7 -3
- package/dist/{chunk-QP6YMUQX.js → chunk-DKJO4Y3K.js} +7 -3
- package/dist/{chunk-P4VXXTVA.js → chunk-EHRARBRS.js} +4 -1
- package/dist/{chunk-YVVXDJHI.js → chunk-ET3QAIY7.js} +9 -2
- package/dist/{chunk-YMFPIZMO.js → chunk-GAKWXOAY.js} +2 -2
- package/dist/{chunk-4ZWS76VQ.js → chunk-KPBVZ44W.js} +7 -3
- package/dist/{chunk-ZYQYJNLK.js → chunk-L5ZAWSTN.js} +51 -29
- package/dist/{chunk-6ON2O6UD.js → chunk-MGZMGDQ5.js} +7 -3
- package/dist/{chunk-KDEWFXEP.js → chunk-MP4CUWYC.js} +6 -2
- package/dist/{chunk-JW2PFVLO.js → chunk-QGZ2F5SW.js} +1387 -868
- package/dist/{chunk-XJXCDN7B.js → chunk-RCL6HPBL.js} +8 -4
- package/dist/chunk-RP66NZN3.js +81 -0
- package/dist/{chunk-27UC2HEP.js → chunk-WFC55BSF.js} +7 -3
- package/dist/{chunk-GINRTL6J.js → chunk-WJWJ6E5Y.js} +6 -2
- package/dist/{chunk-YGRYHMCG.js → chunk-WPJZAYX7.js} +7 -3
- package/dist/index.js +20 -20
- package/dist/lib/mysql/index.cjs +1355 -787
- package/dist/lib/mysql/index.cjs.map +1 -1
- package/dist/lib/mysql/index.d.cts +4201 -1667
- package/dist/lib/mysql/index.d.ts +4201 -1667
- package/dist/lib/mysql/index.js +20 -20
- package/dist/lib/mysql/schemas/auth/accounts.cjs +109 -93
- package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/accounts.js +10 -11
- package/dist/lib/mysql/schemas/auth/device-access-token.cjs +104 -85
- package/dist/lib/mysql/schemas/auth/device-access-token.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/device-access-token.d.cts +16 -0
- package/dist/lib/mysql/schemas/auth/device-access-token.d.ts +16 -0
- package/dist/lib/mysql/schemas/auth/device-access-token.js +11 -12
- package/dist/lib/mysql/schemas/auth/device-verification.cjs +103 -87
- package/dist/lib/mysql/schemas/auth/device-verification.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/device-verification.js +11 -12
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs +102 -82
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/role-permissions.js +11 -12
- package/dist/lib/mysql/schemas/auth/roles.cjs +106 -82
- package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/roles.d.cts +16 -0
- package/dist/lib/mysql/schemas/auth/roles.d.ts +16 -0
- package/dist/lib/mysql/schemas/auth/roles.js +10 -11
- package/dist/lib/mysql/schemas/auth/sessions.cjs +99 -83
- package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/sessions.js +11 -12
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs +104 -84
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.d.cts +16 -0
- package/dist/lib/mysql/schemas/auth/user-permissions.d.ts +16 -0
- package/dist/lib/mysql/schemas/auth/user-permissions.js +10 -11
- package/dist/lib/mysql/schemas/auth/user-prefs.cjs +108 -88
- package/dist/lib/mysql/schemas/auth/user-prefs.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-prefs.d.cts +16 -0
- package/dist/lib/mysql/schemas/auth/user-prefs.d.ts +16 -0
- package/dist/lib/mysql/schemas/auth/user-prefs.js +10 -11
- package/dist/lib/mysql/schemas/auth/user-roles.cjs +109 -85
- package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-roles.d.cts +16 -0
- package/dist/lib/mysql/schemas/auth/user-roles.d.ts +16 -0
- package/dist/lib/mysql/schemas/auth/user-roles.js +10 -11
- package/dist/lib/mysql/schemas/auth/users.cjs +288 -192
- package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/users.d.cts +1 -0
- package/dist/lib/mysql/schemas/auth/users.d.ts +1 -0
- package/dist/lib/mysql/schemas/auth/users.js +10 -11
- package/dist/lib/mysql/schemas/commerce/coupon.cjs +134 -98
- package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/coupon.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/coupon.js +10 -11
- package/dist/lib/mysql/schemas/commerce/merchant-account.cjs +5 -1
- package/dist/lib/mysql/schemas/commerce/merchant-account.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-account.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-account.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-account.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs +210 -17
- package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-charge.d.cts +33 -0
- package/dist/lib/mysql/schemas/commerce/merchant-charge.d.ts +33 -0
- package/dist/lib/mysql/schemas/commerce/merchant-charge.js +11 -4
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs +5 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs +5 -1
- package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-customer.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-customer.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-customer.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-price.cjs +5 -1
- package/dist/lib/mysql/schemas/commerce/merchant-price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-price.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-price.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-price.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-product.cjs +5 -1
- package/dist/lib/mysql/schemas/commerce/merchant-product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-product.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-product.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-product.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-session.cjs +5 -1
- package/dist/lib/mysql/schemas/commerce/merchant-session.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-session.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-session.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-session.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.cjs +315 -0
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.cjs.map +1 -0
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.d.cts +161 -0
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.d.ts +161 -0
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.js +20 -0
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.js.map +1 -0
- package/dist/lib/mysql/schemas/commerce/price.cjs +108 -80
- package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/price.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/price.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/price.js +10 -11
- package/dist/lib/mysql/schemas/commerce/product.cjs +134 -102
- package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/product.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/product.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/product.js +10 -11
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +141 -113
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +11 -12
- package/dist/lib/mysql/schemas/commerce/purchase.cjs +293 -175
- package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase.d.cts +34 -0
- package/dist/lib/mysql/schemas/commerce/purchase.d.ts +34 -0
- package/dist/lib/mysql/schemas/commerce/purchase.js +10 -11
- package/dist/lib/mysql/schemas/commerce/subscription.cjs +343 -0
- package/dist/lib/mysql/schemas/commerce/subscription.cjs.map +1 -0
- package/dist/lib/mysql/schemas/commerce/subscription.d.cts +130 -0
- package/dist/lib/mysql/schemas/commerce/subscription.d.ts +130 -0
- package/dist/lib/mysql/schemas/commerce/subscription.js +20 -0
- package/dist/lib/mysql/schemas/commerce/subscription.js.map +1 -0
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs +109 -85
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/upgradable-products.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/upgradable-products.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/upgradable-products.js +11 -12
- package/dist/lib/mysql/schemas/communication/comment.cjs +148 -87
- package/dist/lib/mysql/schemas/communication/comment.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/comment.d.cts +17 -0
- package/dist/lib/mysql/schemas/communication/comment.d.ts +17 -0
- package/dist/lib/mysql/schemas/communication/comment.js +10 -11
- package/dist/lib/mysql/schemas/communication/communication-channel.cjs +5 -1
- package/dist/lib/mysql/schemas/communication/communication-channel.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-channel.d.cts +16 -0
- package/dist/lib/mysql/schemas/communication/communication-channel.d.ts +16 -0
- package/dist/lib/mysql/schemas/communication/communication-channel.js +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs +3 -0
- package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preference-types.d.cts +16 -0
- package/dist/lib/mysql/schemas/communication/communication-preference-types.d.ts +16 -0
- package/dist/lib/mysql/schemas/communication/communication-preference-types.js +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +176 -105
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.d.cts +33 -0
- package/dist/lib/mysql/schemas/communication/communication-preferences.d.ts +33 -0
- package/dist/lib/mysql/schemas/communication/communication-preferences.js +10 -11
- package/dist/lib/mysql/schemas/content/content-contributions.cjs +186 -111
- package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-contributions.d.cts +33 -0
- package/dist/lib/mysql/schemas/content/content-contributions.d.ts +33 -0
- package/dist/lib/mysql/schemas/content/content-contributions.js +10 -11
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs +110 -79
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-product.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-product.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-product.js +10 -11
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +115 -88
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-resource.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-resource.js +10 -11
- package/dist/lib/mysql/schemas/content/content-resource-tag.cjs +127 -96
- package/dist/lib/mysql/schemas/content/content-resource-tag.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-tag.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-tag.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-tag.js +10 -11
- package/dist/lib/mysql/schemas/content/content-resource-version.cjs +130 -103
- package/dist/lib/mysql/schemas/content/content-resource-version.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-version.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-version.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-version.js +10 -11
- package/dist/lib/mysql/schemas/content/content-resource.cjs +248 -157
- package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource.d.cts +33 -0
- package/dist/lib/mysql/schemas/content/content-resource.d.ts +33 -0
- package/dist/lib/mysql/schemas/content/content-resource.js +10 -11
- package/dist/lib/mysql/schemas/content/contribution-types.cjs +5 -1
- package/dist/lib/mysql/schemas/content/contribution-types.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/contribution-types.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/contribution-types.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/contribution-types.js +1 -1
- package/dist/lib/mysql/schemas/content/lesson-progress.cjs +8 -1
- package/dist/lib/mysql/schemas/content/lesson-progress.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/lesson-progress.d.cts +32 -0
- package/dist/lib/mysql/schemas/content/lesson-progress.d.ts +32 -0
- package/dist/lib/mysql/schemas/content/lesson-progress.js +1 -1
- package/dist/lib/mysql/schemas/content/resource-progress.cjs +8 -1
- package/dist/lib/mysql/schemas/content/resource-progress.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/resource-progress.d.cts +32 -0
- package/dist/lib/mysql/schemas/content/resource-progress.d.ts +32 -0
- package/dist/lib/mysql/schemas/content/resource-progress.js +1 -1
- package/dist/lib/mysql/schemas/content/tag-tag.cjs +108 -84
- package/dist/lib/mysql/schemas/content/tag-tag.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/tag-tag.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/tag-tag.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/tag-tag.js +10 -11
- package/dist/lib/mysql/schemas/content/tag.cjs +123 -95
- package/dist/lib/mysql/schemas/content/tag.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/tag.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/tag.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/tag.js +10 -11
- package/dist/lib/mysql/schemas/org/organization-membership-roles.cjs +301 -0
- package/dist/lib/mysql/schemas/org/organization-membership-roles.cjs.map +1 -0
- package/dist/lib/mysql/schemas/org/organization-membership-roles.d.cts +129 -0
- package/dist/lib/mysql/schemas/org/organization-membership-roles.d.ts +129 -0
- package/dist/lib/mysql/schemas/org/organization-membership-roles.js +21 -0
- package/dist/lib/mysql/schemas/org/organization-membership-roles.js.map +1 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.cjs +370 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.cjs.map +1 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.d.cts +131 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.d.ts +131 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.js +20 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.js.map +1 -0
- package/dist/lib/mysql/schemas/org/organizations.cjs +349 -0
- package/dist/lib/mysql/schemas/org/organizations.cjs.map +1 -0
- package/dist/lib/mysql/schemas/org/organizations.d.cts +98 -0
- package/dist/lib/mysql/schemas/org/organizations.d.ts +98 -0
- package/dist/lib/mysql/schemas/org/organizations.js +20 -0
- package/dist/lib/mysql/schemas/org/organizations.js.map +1 -0
- package/package.json +2 -2
- package/src/lib/mysql/index.ts +34 -0
- package/src/lib/mysql/schemas/auth/device-access-token.ts +3 -0
- package/src/lib/mysql/schemas/auth/roles.ts +3 -0
- package/src/lib/mysql/schemas/auth/user-permissions.ts +2 -0
- package/src/lib/mysql/schemas/auth/user-prefs.ts +2 -0
- package/src/lib/mysql/schemas/auth/user-roles.ts +2 -0
- package/src/lib/mysql/schemas/auth/users.ts +5 -0
- package/src/lib/mysql/schemas/commerce/coupon.ts +2 -0
- package/src/lib/mysql/schemas/commerce/merchant-account.ts +3 -0
- package/src/lib/mysql/schemas/commerce/merchant-charge.ts +16 -0
- package/src/lib/mysql/schemas/commerce/merchant-coupon.ts +3 -0
- package/src/lib/mysql/schemas/commerce/merchant-customer.ts +2 -0
- package/src/lib/mysql/schemas/commerce/merchant-price.ts +3 -0
- package/src/lib/mysql/schemas/commerce/merchant-product.ts +3 -0
- package/src/lib/mysql/schemas/commerce/merchant-session.ts +8 -1
- package/src/lib/mysql/schemas/commerce/merchant-subscription.ts +64 -0
- package/src/lib/mysql/schemas/commerce/price.ts +3 -0
- package/src/lib/mysql/schemas/commerce/product.ts +3 -0
- package/src/lib/mysql/schemas/commerce/purchase-user-transfer.ts +3 -0
- package/src/lib/mysql/schemas/commerce/purchase.ts +22 -0
- package/src/lib/mysql/schemas/commerce/subscription.ts +71 -0
- package/src/lib/mysql/schemas/commerce/upgradable-products.ts +2 -0
- package/src/lib/mysql/schemas/communication/comment.ts +13 -0
- package/src/lib/mysql/schemas/communication/communication-channel.ts +2 -0
- package/src/lib/mysql/schemas/communication/communication-preference-types.ts +1 -0
- package/src/lib/mysql/schemas/communication/communication-preferences.ts +14 -0
- package/src/lib/mysql/schemas/content/content-contributions.ts +14 -0
- package/src/lib/mysql/schemas/content/content-resource-product.ts +2 -0
- package/src/lib/mysql/schemas/content/content-resource-resource.ts +2 -0
- package/src/lib/mysql/schemas/content/content-resource-tag.ts +2 -0
- package/src/lib/mysql/schemas/content/content-resource-version.ts +2 -0
- package/src/lib/mysql/schemas/content/content-resource.ts +17 -0
- package/src/lib/mysql/schemas/content/contribution-types.ts +2 -0
- package/src/lib/mysql/schemas/content/lesson-progress.ts +7 -0
- package/src/lib/mysql/schemas/content/resource-progress.ts +7 -0
- package/src/lib/mysql/schemas/content/tag-tag.ts +2 -0
- package/src/lib/mysql/schemas/content/tag.ts +2 -0
- package/src/lib/mysql/schemas/org/organization-membership-roles.ts +68 -0
- package/src/lib/mysql/schemas/org/organization-memberships.ts +69 -0
- package/src/lib/mysql/schemas/org/organizations.ts +50 -0
- package/dist/chunk-SRTIWWLG.js +0 -96
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as drizzle_orm from 'drizzle-orm';
|
|
2
|
+
import * as drizzle_orm_mysql_core from 'drizzle-orm/mysql-core';
|
|
3
|
+
import { MySqlTableFn } from 'drizzle-orm/mysql-core';
|
|
4
|
+
|
|
5
|
+
declare function getOrganizationsSchema(mysqlTable: MySqlTableFn): drizzle_orm_mysql_core.MySqlTableWithColumns<{
|
|
6
|
+
name: "Organization";
|
|
7
|
+
schema: undefined;
|
|
8
|
+
columns: {
|
|
9
|
+
id: drizzle_orm_mysql_core.MySqlColumn<{
|
|
10
|
+
name: "id";
|
|
11
|
+
tableName: "Organization";
|
|
12
|
+
dataType: "string";
|
|
13
|
+
columnType: "MySqlVarChar";
|
|
14
|
+
data: string;
|
|
15
|
+
driverParam: string | number;
|
|
16
|
+
notNull: true;
|
|
17
|
+
hasDefault: false;
|
|
18
|
+
isPrimaryKey: true;
|
|
19
|
+
isAutoincrement: false;
|
|
20
|
+
hasRuntimeDefault: false;
|
|
21
|
+
enumValues: [string, ...string[]];
|
|
22
|
+
baseColumn: never;
|
|
23
|
+
generated: undefined;
|
|
24
|
+
}, object>;
|
|
25
|
+
name: drizzle_orm_mysql_core.MySqlColumn<{
|
|
26
|
+
name: "name";
|
|
27
|
+
tableName: "Organization";
|
|
28
|
+
dataType: "string";
|
|
29
|
+
columnType: "MySqlVarChar";
|
|
30
|
+
data: string;
|
|
31
|
+
driverParam: string | number;
|
|
32
|
+
notNull: false;
|
|
33
|
+
hasDefault: false;
|
|
34
|
+
isPrimaryKey: false;
|
|
35
|
+
isAutoincrement: false;
|
|
36
|
+
hasRuntimeDefault: false;
|
|
37
|
+
enumValues: [string, ...string[]];
|
|
38
|
+
baseColumn: never;
|
|
39
|
+
generated: undefined;
|
|
40
|
+
}, object>;
|
|
41
|
+
fields: drizzle_orm_mysql_core.MySqlColumn<{
|
|
42
|
+
name: "fields";
|
|
43
|
+
tableName: "Organization";
|
|
44
|
+
dataType: "json";
|
|
45
|
+
columnType: "MySqlJson";
|
|
46
|
+
data: Record<string, any>;
|
|
47
|
+
driverParam: string;
|
|
48
|
+
notNull: false;
|
|
49
|
+
hasDefault: true;
|
|
50
|
+
isPrimaryKey: false;
|
|
51
|
+
isAutoincrement: false;
|
|
52
|
+
hasRuntimeDefault: false;
|
|
53
|
+
enumValues: undefined;
|
|
54
|
+
baseColumn: never;
|
|
55
|
+
generated: undefined;
|
|
56
|
+
}, object>;
|
|
57
|
+
image: drizzle_orm_mysql_core.MySqlColumn<{
|
|
58
|
+
name: "image";
|
|
59
|
+
tableName: "Organization";
|
|
60
|
+
dataType: "string";
|
|
61
|
+
columnType: "MySqlVarChar";
|
|
62
|
+
data: string;
|
|
63
|
+
driverParam: string | number;
|
|
64
|
+
notNull: false;
|
|
65
|
+
hasDefault: false;
|
|
66
|
+
isPrimaryKey: false;
|
|
67
|
+
isAutoincrement: false;
|
|
68
|
+
hasRuntimeDefault: false;
|
|
69
|
+
enumValues: [string, ...string[]];
|
|
70
|
+
baseColumn: never;
|
|
71
|
+
generated: undefined;
|
|
72
|
+
}, object>;
|
|
73
|
+
createdAt: drizzle_orm_mysql_core.MySqlColumn<{
|
|
74
|
+
name: "createdAt";
|
|
75
|
+
tableName: "Organization";
|
|
76
|
+
dataType: "date";
|
|
77
|
+
columnType: "MySqlTimestamp";
|
|
78
|
+
data: Date;
|
|
79
|
+
driverParam: string | number;
|
|
80
|
+
notNull: false;
|
|
81
|
+
hasDefault: true;
|
|
82
|
+
isPrimaryKey: false;
|
|
83
|
+
isAutoincrement: false;
|
|
84
|
+
hasRuntimeDefault: false;
|
|
85
|
+
enumValues: undefined;
|
|
86
|
+
baseColumn: never;
|
|
87
|
+
generated: undefined;
|
|
88
|
+
}, object>;
|
|
89
|
+
};
|
|
90
|
+
dialect: "mysql";
|
|
91
|
+
}>;
|
|
92
|
+
declare function getOrganizationsRelationsSchema(mysqlTable: MySqlTableFn): drizzle_orm.Relations<"Organization", {
|
|
93
|
+
purchases: drizzle_orm.Many<"Purchase">;
|
|
94
|
+
subscriptions: drizzle_orm.Many<"Subscription">;
|
|
95
|
+
members: drizzle_orm.Many<"OrganizationMembership">;
|
|
96
|
+
}>;
|
|
97
|
+
|
|
98
|
+
export { getOrganizationsRelationsSchema, getOrganizationsSchema };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as drizzle_orm from 'drizzle-orm';
|
|
2
|
+
import * as drizzle_orm_mysql_core from 'drizzle-orm/mysql-core';
|
|
3
|
+
import { MySqlTableFn } from 'drizzle-orm/mysql-core';
|
|
4
|
+
|
|
5
|
+
declare function getOrganizationsSchema(mysqlTable: MySqlTableFn): drizzle_orm_mysql_core.MySqlTableWithColumns<{
|
|
6
|
+
name: "Organization";
|
|
7
|
+
schema: undefined;
|
|
8
|
+
columns: {
|
|
9
|
+
id: drizzle_orm_mysql_core.MySqlColumn<{
|
|
10
|
+
name: "id";
|
|
11
|
+
tableName: "Organization";
|
|
12
|
+
dataType: "string";
|
|
13
|
+
columnType: "MySqlVarChar";
|
|
14
|
+
data: string;
|
|
15
|
+
driverParam: string | number;
|
|
16
|
+
notNull: true;
|
|
17
|
+
hasDefault: false;
|
|
18
|
+
isPrimaryKey: true;
|
|
19
|
+
isAutoincrement: false;
|
|
20
|
+
hasRuntimeDefault: false;
|
|
21
|
+
enumValues: [string, ...string[]];
|
|
22
|
+
baseColumn: never;
|
|
23
|
+
generated: undefined;
|
|
24
|
+
}, object>;
|
|
25
|
+
name: drizzle_orm_mysql_core.MySqlColumn<{
|
|
26
|
+
name: "name";
|
|
27
|
+
tableName: "Organization";
|
|
28
|
+
dataType: "string";
|
|
29
|
+
columnType: "MySqlVarChar";
|
|
30
|
+
data: string;
|
|
31
|
+
driverParam: string | number;
|
|
32
|
+
notNull: false;
|
|
33
|
+
hasDefault: false;
|
|
34
|
+
isPrimaryKey: false;
|
|
35
|
+
isAutoincrement: false;
|
|
36
|
+
hasRuntimeDefault: false;
|
|
37
|
+
enumValues: [string, ...string[]];
|
|
38
|
+
baseColumn: never;
|
|
39
|
+
generated: undefined;
|
|
40
|
+
}, object>;
|
|
41
|
+
fields: drizzle_orm_mysql_core.MySqlColumn<{
|
|
42
|
+
name: "fields";
|
|
43
|
+
tableName: "Organization";
|
|
44
|
+
dataType: "json";
|
|
45
|
+
columnType: "MySqlJson";
|
|
46
|
+
data: Record<string, any>;
|
|
47
|
+
driverParam: string;
|
|
48
|
+
notNull: false;
|
|
49
|
+
hasDefault: true;
|
|
50
|
+
isPrimaryKey: false;
|
|
51
|
+
isAutoincrement: false;
|
|
52
|
+
hasRuntimeDefault: false;
|
|
53
|
+
enumValues: undefined;
|
|
54
|
+
baseColumn: never;
|
|
55
|
+
generated: undefined;
|
|
56
|
+
}, object>;
|
|
57
|
+
image: drizzle_orm_mysql_core.MySqlColumn<{
|
|
58
|
+
name: "image";
|
|
59
|
+
tableName: "Organization";
|
|
60
|
+
dataType: "string";
|
|
61
|
+
columnType: "MySqlVarChar";
|
|
62
|
+
data: string;
|
|
63
|
+
driverParam: string | number;
|
|
64
|
+
notNull: false;
|
|
65
|
+
hasDefault: false;
|
|
66
|
+
isPrimaryKey: false;
|
|
67
|
+
isAutoincrement: false;
|
|
68
|
+
hasRuntimeDefault: false;
|
|
69
|
+
enumValues: [string, ...string[]];
|
|
70
|
+
baseColumn: never;
|
|
71
|
+
generated: undefined;
|
|
72
|
+
}, object>;
|
|
73
|
+
createdAt: drizzle_orm_mysql_core.MySqlColumn<{
|
|
74
|
+
name: "createdAt";
|
|
75
|
+
tableName: "Organization";
|
|
76
|
+
dataType: "date";
|
|
77
|
+
columnType: "MySqlTimestamp";
|
|
78
|
+
data: Date;
|
|
79
|
+
driverParam: string | number;
|
|
80
|
+
notNull: false;
|
|
81
|
+
hasDefault: true;
|
|
82
|
+
isPrimaryKey: false;
|
|
83
|
+
isAutoincrement: false;
|
|
84
|
+
hasRuntimeDefault: false;
|
|
85
|
+
enumValues: undefined;
|
|
86
|
+
baseColumn: never;
|
|
87
|
+
generated: undefined;
|
|
88
|
+
}, object>;
|
|
89
|
+
};
|
|
90
|
+
dialect: "mysql";
|
|
91
|
+
}>;
|
|
92
|
+
declare function getOrganizationsRelationsSchema(mysqlTable: MySqlTableFn): drizzle_orm.Relations<"Organization", {
|
|
93
|
+
purchases: drizzle_orm.Many<"Purchase">;
|
|
94
|
+
subscriptions: drizzle_orm.Many<"Subscription">;
|
|
95
|
+
members: drizzle_orm.Many<"OrganizationMembership">;
|
|
96
|
+
}>;
|
|
97
|
+
|
|
98
|
+
export { getOrganizationsRelationsSchema, getOrganizationsSchema };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getOrganizationsRelationsSchema,
|
|
3
|
+
getOrganizationsSchema
|
|
4
|
+
} from "../../../../chunk-QGZ2F5SW.js";
|
|
5
|
+
import "../../../../chunk-MP4CUWYC.js";
|
|
6
|
+
import "../../../../chunk-WJWJ6E5Y.js";
|
|
7
|
+
import "../../../../chunk-EHRARBRS.js";
|
|
8
|
+
import "../../../../chunk-DKJO4Y3K.js";
|
|
9
|
+
import "../../../../chunk-WPJZAYX7.js";
|
|
10
|
+
import "../../../../chunk-6MRFUIH5.js";
|
|
11
|
+
import "../../../../chunk-MGZMGDQ5.js";
|
|
12
|
+
import "../../../../chunk-KPBVZ44W.js";
|
|
13
|
+
import "../../../../chunk-BLDW3QUS.js";
|
|
14
|
+
import "../../../../chunk-LZHZDFNZ.js";
|
|
15
|
+
import "../../../../chunk-H736K5TN.js";
|
|
16
|
+
export {
|
|
17
|
+
getOrganizationsRelationsSchema,
|
|
18
|
+
getOrganizationsSchema
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=organizations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coursebuilder/adapter-drizzle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Drizzle adapter for Course Builder.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"coursebuilder",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@auth/core": "^0.37.2",
|
|
45
|
-
"@coursebuilder/core": "0.
|
|
45
|
+
"@coursebuilder/core": "1.0.0",
|
|
46
46
|
"@libsql/client": "0.5.6",
|
|
47
47
|
"@types/better-sqlite3": "7.6.9",
|
|
48
48
|
"@types/uuid": "9.0.8",
|
package/src/lib/mysql/index.ts
CHANGED
|
@@ -126,6 +126,10 @@ import { getMerchantCustomerSchema } from './schemas/commerce/merchant-customer.
|
|
|
126
126
|
import { getMerchantPriceSchema } from './schemas/commerce/merchant-price.js'
|
|
127
127
|
import { getMerchantProductSchema } from './schemas/commerce/merchant-product.js'
|
|
128
128
|
import { getMerchantSessionSchema } from './schemas/commerce/merchant-session.js'
|
|
129
|
+
import {
|
|
130
|
+
getMerchantSubscriptionRelationsSchema,
|
|
131
|
+
getMerchantSubscriptionSchema,
|
|
132
|
+
} from './schemas/commerce/merchant-subscription.js'
|
|
129
133
|
import { getPriceSchema } from './schemas/commerce/price.js'
|
|
130
134
|
import {
|
|
131
135
|
getProductRelationsSchema,
|
|
@@ -139,6 +143,10 @@ import {
|
|
|
139
143
|
getPurchaseRelationsSchema,
|
|
140
144
|
getPurchaseSchema,
|
|
141
145
|
} from './schemas/commerce/purchase.js'
|
|
146
|
+
import {
|
|
147
|
+
getSubscriptionRelationsSchema,
|
|
148
|
+
getSubscriptionSchema,
|
|
149
|
+
} from './schemas/commerce/subscription.js'
|
|
142
150
|
import {
|
|
143
151
|
getUpgradableProductsRelationsSchema,
|
|
144
152
|
getUpgradableProductsSchema,
|
|
@@ -188,6 +196,18 @@ import {
|
|
|
188
196
|
getTagTagSchema,
|
|
189
197
|
} from './schemas/content/tag-tag.js'
|
|
190
198
|
import { getTagRelationsSchema, getTagSchema } from './schemas/content/tag.js'
|
|
199
|
+
import {
|
|
200
|
+
getOrganizationMembershipRolesRelationsSchema,
|
|
201
|
+
getOrganizationMembershipRolesSchema,
|
|
202
|
+
} from './schemas/org/organization-membership-roles.js'
|
|
203
|
+
import {
|
|
204
|
+
getOrganizationMembershipsRelationsSchema,
|
|
205
|
+
getOrganizationMembershipsSchema,
|
|
206
|
+
} from './schemas/org/organization-memberships.js'
|
|
207
|
+
import {
|
|
208
|
+
getOrganizationsRelationsSchema,
|
|
209
|
+
getOrganizationsSchema,
|
|
210
|
+
} from './schemas/org/organizations.js'
|
|
191
211
|
|
|
192
212
|
export const guid = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz', 5)
|
|
193
213
|
|
|
@@ -271,6 +291,20 @@ export function getCourseBuilderSchema(mysqlTable: MySqlTableFn) {
|
|
|
271
291
|
tagTagRelations: getTagTagRelationsSchema(mysqlTable),
|
|
272
292
|
userPrefs: getUserPrefsSchema(mysqlTable),
|
|
273
293
|
userPrefsRelations: getUserPrefsRelationsSchema(mysqlTable),
|
|
294
|
+
organization: getOrganizationsSchema(mysqlTable),
|
|
295
|
+
organizationRelations: getOrganizationsRelationsSchema(mysqlTable),
|
|
296
|
+
organizationMemberships: getOrganizationMembershipsSchema(mysqlTable),
|
|
297
|
+
organizationMembershipRelations:
|
|
298
|
+
getOrganizationMembershipsRelationsSchema(mysqlTable),
|
|
299
|
+
organizationMembershipRoles:
|
|
300
|
+
getOrganizationMembershipRolesSchema(mysqlTable),
|
|
301
|
+
organizationMembershipRolesRelations:
|
|
302
|
+
getOrganizationMembershipRolesRelationsSchema(mysqlTable),
|
|
303
|
+
merchantSubscription: getMerchantSubscriptionSchema(mysqlTable),
|
|
304
|
+
merchantSubscriptionRelations:
|
|
305
|
+
getMerchantSubscriptionRelationsSchema(mysqlTable),
|
|
306
|
+
subscription: getSubscriptionSchema(mysqlTable),
|
|
307
|
+
subscriptionRelations: getSubscriptionRelationsSchema(mysqlTable),
|
|
274
308
|
} as const
|
|
275
309
|
}
|
|
276
310
|
|
|
@@ -15,6 +15,9 @@ export function getDeviceAccessTokenSchema(mysqlTable: MySqlTableFn) {
|
|
|
15
15
|
{
|
|
16
16
|
token: varchar('token', { length: 191 }).notNull(),
|
|
17
17
|
userId: varchar('userId', { length: 191 }).notNull(),
|
|
18
|
+
organizationMembershipId: varchar('organizationMembershipId', {
|
|
19
|
+
length: 191,
|
|
20
|
+
}),
|
|
18
21
|
createdAt: timestamp('createdAt', {
|
|
19
22
|
mode: 'date',
|
|
20
23
|
fsp: 3,
|
|
@@ -15,6 +15,7 @@ export function getRolesSchema(mysqlTable: MySqlTableFn) {
|
|
|
15
15
|
'Role',
|
|
16
16
|
{
|
|
17
17
|
id: varchar('id', { length: 255 }).notNull().primaryKey(),
|
|
18
|
+
organizationId: varchar('organizationId', { length: 191 }),
|
|
18
19
|
name: varchar('name', { length: 255 }).notNull().unique(),
|
|
19
20
|
description: text('description'),
|
|
20
21
|
active: boolean('active').notNull().default(true),
|
|
@@ -33,6 +34,7 @@ export function getRolesSchema(mysqlTable: MySqlTableFn) {
|
|
|
33
34
|
},
|
|
34
35
|
(role) => ({
|
|
35
36
|
nameIdx: index('name_idx').on(role.name),
|
|
37
|
+
organizationIdIdx: index('organizationId_idx').on(role.organizationId),
|
|
36
38
|
}),
|
|
37
39
|
)
|
|
38
40
|
}
|
|
@@ -40,6 +42,7 @@ export function getRolesSchema(mysqlTable: MySqlTableFn) {
|
|
|
40
42
|
export function getRolesRelationsSchema(mysqlTable: MySqlTableFn) {
|
|
41
43
|
const roles = getRolesSchema(mysqlTable)
|
|
42
44
|
const userRoles = getUserRolesSchema(mysqlTable)
|
|
45
|
+
|
|
43
46
|
return relations(roles, ({ many }) => ({
|
|
44
47
|
userRoles: many(userRoles, { relationName: 'role' }),
|
|
45
48
|
}))
|
|
@@ -16,6 +16,7 @@ export function getUserPermissionsSchema(mysqlTable: MySqlTableFn) {
|
|
|
16
16
|
'UserPermission',
|
|
17
17
|
{
|
|
18
18
|
userId: varchar('userId', { length: 255 }).notNull(),
|
|
19
|
+
organizationId: varchar('organizationId', { length: 191 }),
|
|
19
20
|
permissionId: varchar('permissionId', { length: 255 }).notNull(),
|
|
20
21
|
active: boolean('active').notNull().default(true),
|
|
21
22
|
createdAt: timestamp('createdAt', {
|
|
@@ -35,6 +36,7 @@ export function getUserPermissionsSchema(mysqlTable: MySqlTableFn) {
|
|
|
35
36
|
pk: primaryKey({ columns: [up.userId, up.permissionId] }),
|
|
36
37
|
userIdIdx: index('userId_idx').on(up.userId),
|
|
37
38
|
permissionIdIdx: index('permissionId_idx').on(up.permissionId),
|
|
39
|
+
organizationIdIdx: index('organizationId_idx').on(up.organizationId),
|
|
38
40
|
}),
|
|
39
41
|
)
|
|
40
42
|
}
|
|
@@ -16,6 +16,7 @@ export function getUserPrefsSchema(mysqlTable: MySqlTableFn) {
|
|
|
16
16
|
'UserPrefs',
|
|
17
17
|
{
|
|
18
18
|
id: varchar('id', { length: 191 }).notNull(),
|
|
19
|
+
organizationId: varchar('organizationId', { length: 191 }),
|
|
19
20
|
type: varchar('type', { length: 191 }).default('Global').notNull(),
|
|
20
21
|
userId: varchar('userId', { length: 255 }).notNull(),
|
|
21
22
|
fields: json('fields').$type<Record<string, any>>().default({}),
|
|
@@ -35,6 +36,7 @@ export function getUserPrefsSchema(mysqlTable: MySqlTableFn) {
|
|
|
35
36
|
(crr) => ({
|
|
36
37
|
pk: primaryKey({ columns: [crr.id] }),
|
|
37
38
|
crrUserIdIdKey: index('crr_userIdId_idx').on(crr.userId),
|
|
39
|
+
organizationIdIdx: index('organizationId_idx').on(crr.organizationId),
|
|
38
40
|
}),
|
|
39
41
|
)
|
|
40
42
|
}
|
|
@@ -18,6 +18,7 @@ export function getUserRolesSchema(mysqlTable: MySqlTableFn) {
|
|
|
18
18
|
userId: varchar('userId', { length: 255 }).notNull(),
|
|
19
19
|
roleId: varchar('roleId', { length: 255 }).notNull(),
|
|
20
20
|
active: boolean('active').notNull().default(true),
|
|
21
|
+
organizationId: varchar('organizationId', { length: 191 }),
|
|
21
22
|
createdAt: timestamp('createdAt', {
|
|
22
23
|
mode: 'date',
|
|
23
24
|
fsp: 3,
|
|
@@ -35,6 +36,7 @@ export function getUserRolesSchema(mysqlTable: MySqlTableFn) {
|
|
|
35
36
|
pk: primaryKey({ columns: [ur.userId, ur.roleId] }),
|
|
36
37
|
userIdIdx: index('userId_idx').on(ur.userId),
|
|
37
38
|
roleIdIdx: index('roleId_idx').on(ur.roleId),
|
|
39
|
+
organizationIdIdx: index('organizationId_idx').on(ur.organizationId),
|
|
38
40
|
}),
|
|
39
41
|
)
|
|
40
42
|
}
|
|
@@ -13,6 +13,7 @@ import { getCommentsSchema } from '../communication/comment.js'
|
|
|
13
13
|
import { getCommunicationPreferencesSchema } from '../communication/communication-preferences.js'
|
|
14
14
|
import { getContentContributionsSchema } from '../content/content-contributions.js'
|
|
15
15
|
import { getContentResourceSchema } from '../content/content-resource.js'
|
|
16
|
+
import { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'
|
|
16
17
|
import { getAccountsSchema } from './accounts.js'
|
|
17
18
|
import { getUserPermissionsSchema } from './user-permissions.js'
|
|
18
19
|
import { getUserPrefsSchema } from './user-prefs.js'
|
|
@@ -56,6 +57,7 @@ export function getUsersRelationsSchema(mysqlTable: MySqlTableFn) {
|
|
|
56
57
|
const purchases = getPurchaseSchema(mysqlTable)
|
|
57
58
|
const comments = getCommentsSchema(mysqlTable)
|
|
58
59
|
const userPrefs = getUserPrefsSchema(mysqlTable)
|
|
60
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)
|
|
59
61
|
return relations(users, ({ many }) => ({
|
|
60
62
|
accounts: many(accounts, {
|
|
61
63
|
relationName: 'user',
|
|
@@ -84,5 +86,8 @@ export function getUsersRelationsSchema(mysqlTable: MySqlTableFn) {
|
|
|
84
86
|
prefs: many(userPrefs, {
|
|
85
87
|
relationName: 'user',
|
|
86
88
|
}),
|
|
89
|
+
organizationMemberships: many(organizationMemberships, {
|
|
90
|
+
relationName: 'user',
|
|
91
|
+
}),
|
|
87
92
|
}))
|
|
88
93
|
}
|
|
@@ -21,6 +21,7 @@ export function getCouponSchema(mysqlTable: MySqlTableFn) {
|
|
|
21
21
|
'Coupon',
|
|
22
22
|
{
|
|
23
23
|
id: varchar('id', { length: 191 }).notNull(),
|
|
24
|
+
organizationId: varchar('organizationId', { length: 191 }),
|
|
24
25
|
code: varchar('code', { length: 191 }),
|
|
25
26
|
createdAt: timestamp('createdAt', { mode: 'date', fsp: 3 })
|
|
26
27
|
.default(sql`CURRENT_TIMESTAMP(3)`)
|
|
@@ -46,6 +47,7 @@ export function getCouponSchema(mysqlTable: MySqlTableFn) {
|
|
|
46
47
|
),
|
|
47
48
|
couponId: primaryKey({ columns: [table.id], name: 'Coupon_id' }),
|
|
48
49
|
couponCodeKey: unique('Coupon_code_key').on(table.code),
|
|
50
|
+
organizationIdIdx: index('organizationId_idx').on(table.organizationId),
|
|
49
51
|
}
|
|
50
52
|
},
|
|
51
53
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sql } from 'drizzle-orm'
|
|
2
2
|
import {
|
|
3
|
+
index,
|
|
3
4
|
int,
|
|
4
5
|
MySqlTableFn,
|
|
5
6
|
primaryKey,
|
|
@@ -12,6 +13,7 @@ export function getMerchantAccountSchema(mysqlTable: MySqlTableFn) {
|
|
|
12
13
|
'MerchantAccount',
|
|
13
14
|
{
|
|
14
15
|
id: varchar('id', { length: 191 }).notNull(),
|
|
16
|
+
organizationId: varchar('organizationId', { length: 191 }),
|
|
15
17
|
status: int('status').default(0).notNull(),
|
|
16
18
|
createdAt: timestamp('createdAt', { mode: 'date', fsp: 3 })
|
|
17
19
|
.default(sql`CURRENT_TIMESTAMP(3)`)
|
|
@@ -25,6 +27,7 @@ export function getMerchantAccountSchema(mysqlTable: MySqlTableFn) {
|
|
|
25
27
|
columns: [table.id],
|
|
26
28
|
name: 'MerchantAccount_id',
|
|
27
29
|
}),
|
|
30
|
+
organizationIdIdx: index('organizationId_idx').on(table.organizationId),
|
|
28
31
|
}
|
|
29
32
|
},
|
|
30
33
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { relations, sql } from 'drizzle-orm'
|
|
2
2
|
import {
|
|
3
|
+
index,
|
|
3
4
|
int,
|
|
4
5
|
MySqlTableFn,
|
|
5
6
|
primaryKey,
|
|
@@ -11,12 +12,14 @@ import {
|
|
|
11
12
|
import { getMerchantAccountSchema } from './merchant-account.js'
|
|
12
13
|
import { getMerchantCustomerSchema } from './merchant-customer.js'
|
|
13
14
|
import { getMerchantProductSchema } from './merchant-product.js'
|
|
15
|
+
import { getMerchantSubscriptionSchema } from './merchant-subscription.js'
|
|
14
16
|
|
|
15
17
|
export function getMerchantChargeSchema(mysqlTable: MySqlTableFn) {
|
|
16
18
|
return mysqlTable(
|
|
17
19
|
'MerchantCharge',
|
|
18
20
|
{
|
|
19
21
|
id: varchar('id', { length: 191 }).notNull(),
|
|
22
|
+
organizationId: varchar('organizationId', { length: 191 }),
|
|
20
23
|
status: int('status').default(0).notNull(),
|
|
21
24
|
identifier: varchar('identifier', { length: 191 }).notNull(),
|
|
22
25
|
userId: varchar('userId', { length: 191 }).notNull(),
|
|
@@ -26,6 +29,9 @@ export function getMerchantChargeSchema(mysqlTable: MySqlTableFn) {
|
|
|
26
29
|
merchantProductId: varchar('merchantProductId', {
|
|
27
30
|
length: 191,
|
|
28
31
|
}).notNull(),
|
|
32
|
+
merchantSubscriptionId: varchar('merchantSubscriptionId', {
|
|
33
|
+
length: 191,
|
|
34
|
+
}),
|
|
29
35
|
createdAt: timestamp('createdAt', { mode: 'date', fsp: 3 })
|
|
30
36
|
.default(sql`CURRENT_TIMESTAMP(3)`)
|
|
31
37
|
.notNull(),
|
|
@@ -42,6 +48,10 @@ export function getMerchantChargeSchema(mysqlTable: MySqlTableFn) {
|
|
|
42
48
|
merchantChargeIdentifierKey: unique('MerchantCharge_identifier_key').on(
|
|
43
49
|
table.identifier,
|
|
44
50
|
),
|
|
51
|
+
merchantSubscriptionIdIdx: index('merchantSubscriptionId_idx').on(
|
|
52
|
+
table.merchantSubscriptionId,
|
|
53
|
+
),
|
|
54
|
+
organizationIdIdx: index('organizationId_idx').on(table.organizationId),
|
|
45
55
|
}
|
|
46
56
|
},
|
|
47
57
|
)
|
|
@@ -52,6 +62,7 @@ export function getMerchantChargeRelationsSchema(mysqlTable: MySqlTableFn) {
|
|
|
52
62
|
const merchantAccount = getMerchantAccountSchema(mysqlTable)
|
|
53
63
|
const merchantProduct = getMerchantProductSchema(mysqlTable)
|
|
54
64
|
const merchantCustomer = getMerchantCustomerSchema(mysqlTable)
|
|
65
|
+
const merchantSubscription = getMerchantSubscriptionSchema(mysqlTable)
|
|
55
66
|
return relations(merchantCharge, ({ one }) => ({
|
|
56
67
|
merchantAccount: one(merchantAccount, {
|
|
57
68
|
fields: [merchantCharge.merchantAccountId],
|
|
@@ -68,5 +79,10 @@ export function getMerchantChargeRelationsSchema(mysqlTable: MySqlTableFn) {
|
|
|
68
79
|
references: [merchantCustomer.id],
|
|
69
80
|
relationName: 'merchantCustomer',
|
|
70
81
|
}),
|
|
82
|
+
merchantSubscription: one(merchantSubscription, {
|
|
83
|
+
fields: [merchantCharge.merchantSubscriptionId],
|
|
84
|
+
references: [merchantSubscription.id],
|
|
85
|
+
relationName: 'merchantSubscription',
|
|
86
|
+
}),
|
|
71
87
|
}))
|
|
72
88
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decimal,
|
|
3
|
+
index,
|
|
3
4
|
int,
|
|
4
5
|
MySqlTableFn,
|
|
5
6
|
primaryKey,
|
|
@@ -13,6 +14,7 @@ export function getMerchantCouponSchema(mysqlTable: MySqlTableFn) {
|
|
|
13
14
|
{
|
|
14
15
|
id: varchar('id', { length: 191 }).notNull(),
|
|
15
16
|
identifier: varchar('identifier', { length: 191 }),
|
|
17
|
+
organizationId: varchar('organizationId', { length: 191 }),
|
|
16
18
|
status: int('status').default(0).notNull(),
|
|
17
19
|
merchantAccountId: varchar('merchantAccountId', {
|
|
18
20
|
length: 191,
|
|
@@ -32,6 +34,7 @@ export function getMerchantCouponSchema(mysqlTable: MySqlTableFn) {
|
|
|
32
34
|
merchantCouponIdentifierKey: unique('MerchantCoupon_identifier_key').on(
|
|
33
35
|
table.identifier,
|
|
34
36
|
),
|
|
37
|
+
organizationIdIdx: index('organizationId_idx').on(table.organizationId),
|
|
35
38
|
}
|
|
36
39
|
},
|
|
37
40
|
)
|
|
@@ -14,6 +14,7 @@ export function getMerchantCustomerSchema(mysqlTable: MySqlTableFn) {
|
|
|
14
14
|
'MerchantCustomer',
|
|
15
15
|
{
|
|
16
16
|
id: varchar('id', { length: 191 }).notNull(),
|
|
17
|
+
organizationId: varchar('organizationId', { length: 191 }),
|
|
17
18
|
userId: varchar('userId', { length: 191 }).notNull(),
|
|
18
19
|
merchantAccountId: varchar('merchantAccountId', {
|
|
19
20
|
length: 191,
|
|
@@ -34,6 +35,7 @@ export function getMerchantCustomerSchema(mysqlTable: MySqlTableFn) {
|
|
|
34
35
|
'MerchantCustomer_identifier_key',
|
|
35
36
|
).on(table.identifier),
|
|
36
37
|
userIdIdx: index('idx_MerchantCustomer_on_userId').on(table.userId),
|
|
38
|
+
organizationIdIdx: index('organizationId_idx').on(table.organizationId),
|
|
37
39
|
}
|
|
38
40
|
},
|
|
39
41
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sql } from 'drizzle-orm'
|
|
2
2
|
import {
|
|
3
|
+
index,
|
|
3
4
|
int,
|
|
4
5
|
MySqlTableFn,
|
|
5
6
|
primaryKey,
|
|
@@ -13,6 +14,7 @@ export function getMerchantPriceSchema(mysqlTable: MySqlTableFn) {
|
|
|
13
14
|
'MerchantPrice',
|
|
14
15
|
{
|
|
15
16
|
id: varchar('id', { length: 191 }).notNull(),
|
|
17
|
+
organizationId: varchar('organizationId', { length: 191 }),
|
|
16
18
|
merchantAccountId: varchar('merchantAccountId', {
|
|
17
19
|
length: 191,
|
|
18
20
|
}).notNull(),
|
|
@@ -35,6 +37,7 @@ export function getMerchantPriceSchema(mysqlTable: MySqlTableFn) {
|
|
|
35
37
|
merchantPriceIdentifierKey: unique('MerchantPrice_identifier_key').on(
|
|
36
38
|
table.identifier,
|
|
37
39
|
),
|
|
40
|
+
organizationIdIdx: index('organizationId_idx').on(table.organizationId),
|
|
38
41
|
}
|
|
39
42
|
},
|
|
40
43
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sql } from 'drizzle-orm'
|
|
2
2
|
import {
|
|
3
|
+
index,
|
|
3
4
|
int,
|
|
4
5
|
MySqlTableFn,
|
|
5
6
|
primaryKey,
|
|
@@ -13,6 +14,7 @@ export function getMerchantProductSchema(mysqlTable: MySqlTableFn) {
|
|
|
13
14
|
'MerchantProduct',
|
|
14
15
|
{
|
|
15
16
|
id: varchar('id', { length: 191 }).notNull(),
|
|
17
|
+
organizationId: varchar('organizationId', { length: 191 }),
|
|
16
18
|
merchantAccountId: varchar('merchantAccountId', {
|
|
17
19
|
length: 191,
|
|
18
20
|
}).notNull(),
|
|
@@ -32,6 +34,7 @@ export function getMerchantProductSchema(mysqlTable: MySqlTableFn) {
|
|
|
32
34
|
merchantProductIdentifierKey: unique(
|
|
33
35
|
'MerchantProduct_identifier_key',
|
|
34
36
|
).on(table.identifier),
|
|
37
|
+
organizationIdIdx: index('organizationId_idx').on(table.organizationId),
|
|
35
38
|
}
|
|
36
39
|
},
|
|
37
40
|
)
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
index,
|
|
3
|
+
MySqlTableFn,
|
|
4
|
+
primaryKey,
|
|
5
|
+
varchar,
|
|
6
|
+
} from 'drizzle-orm/mysql-core'
|
|
2
7
|
|
|
3
8
|
export function getMerchantSessionSchema(mysqlTable: MySqlTableFn) {
|
|
4
9
|
return mysqlTable(
|
|
5
10
|
'MerchantSession',
|
|
6
11
|
{
|
|
7
12
|
id: varchar('id', { length: 191 }).notNull(),
|
|
13
|
+
organizationId: varchar('organizationId', { length: 191 }),
|
|
8
14
|
identifier: varchar('identifier', { length: 191 }).notNull(),
|
|
9
15
|
merchantAccountId: varchar('merchantAccountId', {
|
|
10
16
|
length: 191,
|
|
@@ -16,6 +22,7 @@ export function getMerchantSessionSchema(mysqlTable: MySqlTableFn) {
|
|
|
16
22
|
columns: [table.id],
|
|
17
23
|
name: 'MerchantSession_id',
|
|
18
24
|
}),
|
|
25
|
+
organizationIdIdx: index('organizationId_idx').on(table.organizationId),
|
|
19
26
|
}
|
|
20
27
|
},
|
|
21
28
|
)
|