@coursebuilder/adapter-drizzle 0.5.1 → 0.5.2
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-7ISZNMPU.js → chunk-27UC2HEP.js} +2 -2
- package/dist/{chunk-UK6EHYS5.js → chunk-6SLQW6OM.js} +2 -2
- package/dist/{chunk-7X7TMG4A.js → chunk-EFVZ7IN4.js} +2 -2
- package/dist/{chunk-UHH4OVKA.js → chunk-JW2PFVLO.js} +482 -210
- package/dist/{chunk-QPXUGIXO.js → chunk-QQA7STVO.js} +2 -2
- package/dist/{chunk-DAP5KOAO.js → chunk-XJXCDN7B.js} +2 -2
- package/dist/{chunk-KDOSK7KN.js → chunk-YMFPIZMO.js} +2 -2
- package/dist/{chunk-VUS77FG3.js → chunk-ZYQYJNLK.js} +88 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -8
- package/dist/lib/mysql/index.cjs +878 -546
- package/dist/lib/mysql/index.cjs.map +1 -1
- package/dist/lib/mysql/index.d.cts +3123 -80
- package/dist/lib/mysql/index.d.ts +3123 -80
- package/dist/lib/mysql/index.js +8 -8
- package/dist/lib/mysql/schemas/auth/accounts.cjs +87 -71
- package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/accounts.d.cts +58 -1
- package/dist/lib/mysql/schemas/auth/accounts.d.ts +58 -1
- package/dist/lib/mysql/schemas/auth/accounts.js +1 -1
- package/dist/lib/mysql/schemas/auth/device-access-token.cjs +79 -63
- package/dist/lib/mysql/schemas/auth/device-access-token.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/device-access-token.d.cts +12 -0
- package/dist/lib/mysql/schemas/auth/device-access-token.d.ts +12 -0
- package/dist/lib/mysql/schemas/auth/device-access-token.js +2 -2
- package/dist/lib/mysql/schemas/auth/device-verification.cjs +81 -65
- package/dist/lib/mysql/schemas/auth/device-verification.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/device-verification.d.cts +24 -0
- package/dist/lib/mysql/schemas/auth/device-verification.d.ts +24 -0
- package/dist/lib/mysql/schemas/auth/device-verification.js +2 -2
- package/dist/lib/mysql/schemas/auth/permissions.d.cts +28 -0
- package/dist/lib/mysql/schemas/auth/permissions.d.ts +28 -0
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs +76 -60
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/role-permissions.d.cts +24 -0
- package/dist/lib/mysql/schemas/auth/role-permissions.d.ts +24 -0
- package/dist/lib/mysql/schemas/auth/role-permissions.js +2 -2
- package/dist/lib/mysql/schemas/auth/roles.cjs +76 -60
- package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/roles.d.cts +28 -0
- package/dist/lib/mysql/schemas/auth/roles.d.ts +28 -0
- package/dist/lib/mysql/schemas/auth/roles.js +1 -1
- package/dist/lib/mysql/schemas/auth/sessions.cjs +77 -61
- package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/sessions.d.cts +12 -0
- package/dist/lib/mysql/schemas/auth/sessions.d.ts +12 -0
- package/dist/lib/mysql/schemas/auth/sessions.js +2 -2
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs +78 -62
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.d.cts +24 -0
- package/dist/lib/mysql/schemas/auth/user-permissions.d.ts +24 -0
- package/dist/lib/mysql/schemas/auth/user-permissions.js +1 -1
- package/dist/lib/mysql/schemas/auth/user-prefs.cjs +82 -66
- package/dist/lib/mysql/schemas/auth/user-prefs.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-prefs.d.cts +28 -0
- package/dist/lib/mysql/schemas/auth/user-prefs.d.ts +28 -0
- package/dist/lib/mysql/schemas/auth/user-prefs.js +1 -1
- package/dist/lib/mysql/schemas/auth/user-roles.cjs +78 -62
- package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-roles.d.cts +24 -0
- package/dist/lib/mysql/schemas/auth/user-roles.d.ts +24 -0
- package/dist/lib/mysql/schemas/auth/user-roles.js +1 -1
- package/dist/lib/mysql/schemas/auth/users.cjs +179 -159
- package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/users.d.cts +32 -0
- package/dist/lib/mysql/schemas/auth/users.d.ts +32 -0
- package/dist/lib/mysql/schemas/auth/users.js +1 -1
- package/dist/lib/mysql/schemas/auth/verification-tokens.d.cts +16 -0
- package/dist/lib/mysql/schemas/auth/verification-tokens.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/coupon.cjs +54 -38
- package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.d.cts +48 -0
- package/dist/lib/mysql/schemas/commerce/coupon.d.ts +48 -0
- package/dist/lib/mysql/schemas/commerce/coupon.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-account.d.cts +20 -0
- package/dist/lib/mysql/schemas/commerce/merchant-account.d.ts +20 -0
- package/dist/lib/mysql/schemas/commerce/merchant-charge.d.cts +32 -0
- package/dist/lib/mysql/schemas/commerce/merchant-charge.d.ts +32 -0
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.cts +24 -0
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.ts +24 -0
- package/dist/lib/mysql/schemas/commerce/merchant-customer.d.cts +24 -0
- package/dist/lib/mysql/schemas/commerce/merchant-customer.d.ts +24 -0
- package/dist/lib/mysql/schemas/commerce/merchant-price.d.cts +28 -0
- package/dist/lib/mysql/schemas/commerce/merchant-price.d.ts +28 -0
- package/dist/lib/mysql/schemas/commerce/merchant-product.d.cts +24 -0
- package/dist/lib/mysql/schemas/commerce/merchant-product.d.ts +24 -0
- package/dist/lib/mysql/schemas/commerce/merchant-session.d.cts +12 -0
- package/dist/lib/mysql/schemas/commerce/merchant-session.d.ts +12 -0
- package/dist/lib/mysql/schemas/commerce/price.cjs +44 -28
- package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/price.d.cts +28 -0
- package/dist/lib/mysql/schemas/commerce/price.d.ts +28 -0
- package/dist/lib/mysql/schemas/commerce/price.js +1 -1
- package/dist/lib/mysql/schemas/commerce/product.cjs +58 -42
- package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/product.d.cts +32 -0
- package/dist/lib/mysql/schemas/commerce/product.d.ts +32 -0
- package/dist/lib/mysql/schemas/commerce/product.js +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +106 -90
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.cts +40 -0
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.ts +40 -0
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +2 -2
- package/dist/lib/mysql/schemas/commerce/purchase.cjs +110 -94
- package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase.d.cts +68 -0
- package/dist/lib/mysql/schemas/commerce/purchase.d.ts +68 -0
- package/dist/lib/mysql/schemas/commerce/purchase.js +1 -1
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs +50 -34
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/upgradable-products.d.cts +28 -0
- package/dist/lib/mysql/schemas/commerce/upgradable-products.d.ts +28 -0
- package/dist/lib/mysql/schemas/commerce/upgradable-products.js +2 -2
- package/dist/lib/mysql/schemas/communication/comment.cjs +82 -66
- package/dist/lib/mysql/schemas/communication/comment.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/comment.d.cts +28 -0
- package/dist/lib/mysql/schemas/communication/comment.d.ts +28 -0
- package/dist/lib/mysql/schemas/communication/comment.js +1 -1
- package/dist/lib/mysql/schemas/communication/communication-channel.d.cts +28 -0
- package/dist/lib/mysql/schemas/communication/communication-channel.d.ts +28 -0
- package/dist/lib/mysql/schemas/communication/communication-preference-types.d.cts +28 -0
- package/dist/lib/mysql/schemas/communication/communication-preference-types.d.ts +28 -0
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +100 -84
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.d.cts +44 -0
- package/dist/lib/mysql/schemas/communication/communication-preferences.d.ts +44 -0
- package/dist/lib/mysql/schemas/communication/communication-preferences.js +1 -1
- package/dist/lib/mysql/schemas/content/content-contributions.cjs +112 -92
- package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-contributions.d.cts +32 -0
- package/dist/lib/mysql/schemas/content/content-contributions.d.ts +32 -0
- package/dist/lib/mysql/schemas/content/content-contributions.js +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs +49 -29
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-product.d.cts +28 -0
- package/dist/lib/mysql/schemas/content/content-resource-product.d.ts +28 -0
- package/dist/lib/mysql/schemas/content/content-resource-product.js +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +49 -29
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.d.cts +28 -0
- package/dist/lib/mysql/schemas/content/content-resource-resource.d.ts +28 -0
- package/dist/lib/mysql/schemas/content/content-resource-resource.js +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-tag.cjs +274 -0
- package/dist/lib/mysql/schemas/content/content-resource-tag.cjs.map +1 -0
- package/dist/lib/mysql/schemas/content/content-resource-tag.d.cts +97 -0
- package/dist/lib/mysql/schemas/content/content-resource-tag.d.ts +97 -0
- package/dist/lib/mysql/schemas/content/content-resource-tag.js +21 -0
- package/dist/lib/mysql/schemas/content/content-resource-tag.js.map +1 -0
- package/dist/lib/mysql/schemas/content/content-resource-version.cjs +288 -0
- package/dist/lib/mysql/schemas/content/content-resource-version.cjs.map +1 -0
- package/dist/lib/mysql/schemas/content/content-resource-version.d.cts +130 -0
- package/dist/lib/mysql/schemas/content/content-resource-version.d.ts +130 -0
- package/dist/lib/mysql/schemas/content/content-resource-version.js +21 -0
- package/dist/lib/mysql/schemas/content/content-resource-version.js.map +1 -0
- package/dist/lib/mysql/schemas/content/content-resource.cjs +141 -15
- package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource.d.cts +47 -0
- package/dist/lib/mysql/schemas/content/content-resource.d.ts +47 -0
- package/dist/lib/mysql/schemas/content/content-resource.js +1 -1
- package/dist/lib/mysql/schemas/content/contribution-types.d.cts +32 -0
- package/dist/lib/mysql/schemas/content/contribution-types.d.ts +32 -0
- package/dist/lib/mysql/schemas/content/lesson-progress.d.cts +40 -0
- package/dist/lib/mysql/schemas/content/lesson-progress.d.ts +40 -0
- package/dist/lib/mysql/schemas/content/resource-progress.d.cts +24 -0
- package/dist/lib/mysql/schemas/content/resource-progress.d.ts +24 -0
- package/dist/lib/mysql/schemas/content/tag-tag.cjs +241 -0
- package/dist/lib/mysql/schemas/content/tag-tag.cjs.map +1 -0
- package/dist/lib/mysql/schemas/content/tag-tag.d.cts +129 -0
- package/dist/lib/mysql/schemas/content/tag-tag.d.ts +129 -0
- package/dist/lib/mysql/schemas/content/tag-tag.js +21 -0
- package/dist/lib/mysql/schemas/content/tag-tag.js.map +1 -0
- package/dist/lib/mysql/schemas/content/tag.cjs +263 -0
- package/dist/lib/mysql/schemas/content/tag.cjs.map +1 -0
- package/dist/lib/mysql/schemas/content/tag.d.cts +114 -0
- package/dist/lib/mysql/schemas/content/tag.d.ts +114 -0
- package/dist/lib/mysql/schemas/content/tag.js +21 -0
- package/dist/lib/mysql/schemas/content/tag.js.map +1 -0
- package/dist/lib/mysql/utils.d.cts +1 -0
- package/dist/lib/mysql/utils.d.ts +1 -0
- package/dist/lib/utils.d.cts +1 -0
- package/dist/lib/utils.d.ts +1 -0
- package/package.json +6 -6
- package/src/lib/mysql/index.ts +117 -0
- package/src/lib/mysql/schemas/content/content-resource-tag.ts +59 -0
- package/src/lib/mysql/schemas/content/content-resource-version.ts +69 -0
- package/src/lib/mysql/schemas/content/content-resource.ts +17 -0
- package/src/lib/mysql/schemas/content/tag-tag.ts +59 -0
- package/src/lib/mysql/schemas/content/tag.ts +48 -0
|
@@ -30,32 +30,32 @@ import {
|
|
|
30
30
|
} from "./chunk-H736K5TN.js";
|
|
31
31
|
|
|
32
32
|
// src/lib/mysql/schemas/content/content-contributions.ts
|
|
33
|
-
import { relations as
|
|
34
|
-
import { boolean as boolean6, index as
|
|
33
|
+
import { relations as relations20 } from "drizzle-orm";
|
|
34
|
+
import { boolean as boolean6, index as index18, timestamp as timestamp19, varchar as varchar20 } from "drizzle-orm/mysql-core";
|
|
35
35
|
|
|
36
36
|
// src/lib/mysql/schemas/auth/users.ts
|
|
37
|
-
import { relations as
|
|
38
|
-
import { index as
|
|
37
|
+
import { relations as relations19, sql as sql14 } from "drizzle-orm";
|
|
38
|
+
import { index as index17, json as json13, timestamp as timestamp18, varchar as varchar19 } from "drizzle-orm/mysql-core";
|
|
39
39
|
|
|
40
40
|
// src/lib/mysql/schemas/commerce/purchase.ts
|
|
41
|
-
import { relations as
|
|
42
|
-
import { decimal as decimal3, index as
|
|
41
|
+
import { relations as relations11, sql as sql11 } from "drizzle-orm";
|
|
42
|
+
import { decimal as decimal3, index as index9, json as json10, primaryKey as primaryKey8, timestamp as timestamp11, unique as unique3, varchar as varchar11 } from "drizzle-orm/mysql-core";
|
|
43
43
|
|
|
44
44
|
// src/lib/mysql/schemas/commerce/coupon.ts
|
|
45
|
-
import { relations as
|
|
46
|
-
import { boolean, decimal as decimal2, index as
|
|
45
|
+
import { relations as relations10, sql as sql10 } from "drizzle-orm";
|
|
46
|
+
import { boolean, decimal as decimal2, index as index8, int as int4, json as json9, primaryKey as primaryKey7, timestamp as timestamp10, unique as unique2, varchar as varchar10 } from "drizzle-orm/mysql-core";
|
|
47
47
|
|
|
48
48
|
// src/lib/mysql/schemas/commerce/product.ts
|
|
49
|
-
import { relations as
|
|
50
|
-
import { int as
|
|
49
|
+
import { relations as relations9, sql as sql9 } from "drizzle-orm";
|
|
50
|
+
import { int as int3, json as json8, primaryKey as primaryKey6, timestamp as timestamp9, varchar as varchar9 } from "drizzle-orm/mysql-core";
|
|
51
51
|
|
|
52
52
|
// src/lib/mysql/schemas/content/content-resource-product.ts
|
|
53
|
-
import { relations as
|
|
54
|
-
import { double as
|
|
53
|
+
import { relations as relations7, sql as sql7 } from "drizzle-orm";
|
|
54
|
+
import { double as double4, index as index7, json as json6, primaryKey as primaryKey4, timestamp as timestamp7, varchar as varchar7 } from "drizzle-orm/mysql-core";
|
|
55
55
|
|
|
56
56
|
// src/lib/mysql/schemas/content/content-resource.ts
|
|
57
|
-
import { relations as
|
|
58
|
-
import { index as
|
|
57
|
+
import { relations as relations6, sql as sql6 } from "drizzle-orm";
|
|
58
|
+
import { index as index6, json as json5, timestamp as timestamp6, varchar as varchar6 } from "drizzle-orm/mysql-core";
|
|
59
59
|
|
|
60
60
|
// src/lib/mysql/schemas/content/content-resource-resource.ts
|
|
61
61
|
import { relations, sql } from "drizzle-orm";
|
|
@@ -120,19 +120,27 @@ function getContentResourceResourceRelationsSchema(mysqlTable) {
|
|
|
120
120
|
}
|
|
121
121
|
__name(getContentResourceResourceRelationsSchema, "getContentResourceResourceRelationsSchema");
|
|
122
122
|
|
|
123
|
-
// src/lib/mysql/schemas/content/content-resource.ts
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
// src/lib/mysql/schemas/content/content-resource-tag.ts
|
|
124
|
+
import { relations as relations4, sql as sql4 } from "drizzle-orm";
|
|
125
|
+
import { double as double3, index as index4, primaryKey as primaryKey3, timestamp as timestamp4, varchar as varchar4 } from "drizzle-orm/mysql-core";
|
|
126
|
+
|
|
127
|
+
// src/lib/mysql/schemas/content/tag.ts
|
|
128
|
+
import { relations as relations3, sql as sql3 } from "drizzle-orm";
|
|
129
|
+
import { index as index3, json as json3, timestamp as timestamp3, varchar as varchar3 } from "drizzle-orm/mysql-core";
|
|
130
|
+
|
|
131
|
+
// src/lib/mysql/schemas/content/tag-tag.ts
|
|
132
|
+
import { relations as relations2, sql as sql2 } from "drizzle-orm";
|
|
133
|
+
import { double as double2, index as index2, json as json2, primaryKey as primaryKey2, timestamp as timestamp2, varchar as varchar2 } from "drizzle-orm/mysql-core";
|
|
134
|
+
function getTagTagSchema(mysqlTable) {
|
|
135
|
+
return mysqlTable("TagTag", {
|
|
136
|
+
parentTagId: varchar2("parentTagId", {
|
|
130
137
|
length: 255
|
|
131
138
|
}).notNull(),
|
|
132
|
-
|
|
139
|
+
childTagId: varchar2("childTagId", {
|
|
133
140
|
length: 255
|
|
134
141
|
}).notNull(),
|
|
135
|
-
|
|
142
|
+
position: double2("position").notNull().default(0),
|
|
143
|
+
metadata: json2("metadata").$type().default({}),
|
|
136
144
|
createdAt: timestamp2("createdAt", {
|
|
137
145
|
mode: "date",
|
|
138
146
|
fsp: 3
|
|
@@ -145,10 +153,248 @@ function getContentResourceSchema(mysqlTable) {
|
|
|
145
153
|
mode: "date",
|
|
146
154
|
fsp: 3
|
|
147
155
|
})
|
|
156
|
+
}, (tt) => ({
|
|
157
|
+
pk: primaryKey2({
|
|
158
|
+
columns: [
|
|
159
|
+
tt.parentTagId,
|
|
160
|
+
tt.childTagId
|
|
161
|
+
]
|
|
162
|
+
}),
|
|
163
|
+
parentTagIdIdx: index2("parentTagId_idx").on(tt.parentTagId),
|
|
164
|
+
childTagIdIdx: index2("childTagId_idx").on(tt.childTagId),
|
|
165
|
+
positionIdx: index2("position_idx").on(tt.position)
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
__name(getTagTagSchema, "getTagTagSchema");
|
|
169
|
+
function getTagTagRelationsSchema(mysqlTable) {
|
|
170
|
+
const tag = getTagSchema(mysqlTable);
|
|
171
|
+
const tagTag = getTagTagSchema(mysqlTable);
|
|
172
|
+
return relations2(tagTag, ({ one }) => ({
|
|
173
|
+
parentTag: one(tag, {
|
|
174
|
+
fields: [
|
|
175
|
+
tagTag.parentTagId
|
|
176
|
+
],
|
|
177
|
+
references: [
|
|
178
|
+
tag.id
|
|
179
|
+
],
|
|
180
|
+
relationName: "parentTag"
|
|
181
|
+
}),
|
|
182
|
+
childTag: one(tag, {
|
|
183
|
+
fields: [
|
|
184
|
+
tagTag.childTagId
|
|
185
|
+
],
|
|
186
|
+
references: [
|
|
187
|
+
tag.id
|
|
188
|
+
],
|
|
189
|
+
relationName: "childTag"
|
|
190
|
+
})
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
__name(getTagTagRelationsSchema, "getTagTagRelationsSchema");
|
|
194
|
+
|
|
195
|
+
// src/lib/mysql/schemas/content/tag.ts
|
|
196
|
+
function getTagSchema(mysqlTable) {
|
|
197
|
+
return mysqlTable("Tag", {
|
|
198
|
+
id: varchar3("id", {
|
|
199
|
+
length: 255
|
|
200
|
+
}).notNull().primaryKey(),
|
|
201
|
+
type: varchar3("type", {
|
|
202
|
+
length: 255
|
|
203
|
+
}).notNull(),
|
|
204
|
+
fields: json3("fields").$type().default({}),
|
|
205
|
+
createdAt: timestamp3("createdAt", {
|
|
206
|
+
mode: "date",
|
|
207
|
+
fsp: 3
|
|
208
|
+
}).default(sql3`CURRENT_TIMESTAMP(3)`),
|
|
209
|
+
updatedAt: timestamp3("updatedAt", {
|
|
210
|
+
mode: "date",
|
|
211
|
+
fsp: 3
|
|
212
|
+
}).default(sql3`CURRENT_TIMESTAMP(3)`),
|
|
213
|
+
deletedAt: timestamp3("deletedAt", {
|
|
214
|
+
mode: "date",
|
|
215
|
+
fsp: 3
|
|
216
|
+
})
|
|
217
|
+
}, (t) => ({
|
|
218
|
+
typeIdx: index3("type_idx").on(t.type)
|
|
219
|
+
}));
|
|
220
|
+
}
|
|
221
|
+
__name(getTagSchema, "getTagSchema");
|
|
222
|
+
function getTagRelationsSchema(mysqlTable) {
|
|
223
|
+
const tag = getTagSchema(mysqlTable);
|
|
224
|
+
const contentResourceTag = getContentResourceTagSchema(mysqlTable);
|
|
225
|
+
const tagTag = getTagTagSchema(mysqlTable);
|
|
226
|
+
return relations3(tag, ({ many }) => ({
|
|
227
|
+
resources: many(contentResourceTag, {
|
|
228
|
+
relationName: "contentResource"
|
|
229
|
+
}),
|
|
230
|
+
parentTags: many(tagTag, {
|
|
231
|
+
relationName: "childTag"
|
|
232
|
+
}),
|
|
233
|
+
childTags: many(tagTag, {
|
|
234
|
+
relationName: "parentTag"
|
|
235
|
+
})
|
|
236
|
+
}));
|
|
237
|
+
}
|
|
238
|
+
__name(getTagRelationsSchema, "getTagRelationsSchema");
|
|
239
|
+
|
|
240
|
+
// src/lib/mysql/schemas/content/content-resource-tag.ts
|
|
241
|
+
function getContentResourceTagSchema(mysqlTable) {
|
|
242
|
+
return mysqlTable("ContentResourceTag", {
|
|
243
|
+
contentResourceId: varchar4("contentResourceId", {
|
|
244
|
+
length: 255
|
|
245
|
+
}).notNull(),
|
|
246
|
+
tagId: varchar4("tagId", {
|
|
247
|
+
length: 255
|
|
248
|
+
}).notNull(),
|
|
249
|
+
position: double3("position").notNull().default(0),
|
|
250
|
+
createdAt: timestamp4("createdAt", {
|
|
251
|
+
mode: "date",
|
|
252
|
+
fsp: 3
|
|
253
|
+
}).default(sql4`CURRENT_TIMESTAMP(3)`),
|
|
254
|
+
updatedAt: timestamp4("updatedAt", {
|
|
255
|
+
mode: "date",
|
|
256
|
+
fsp: 3
|
|
257
|
+
}).default(sql4`CURRENT_TIMESTAMP(3)`)
|
|
258
|
+
}, (crt) => ({
|
|
259
|
+
pk: primaryKey3({
|
|
260
|
+
columns: [
|
|
261
|
+
crt.contentResourceId,
|
|
262
|
+
crt.tagId
|
|
263
|
+
]
|
|
264
|
+
}),
|
|
265
|
+
contentResourceIdIdx: index4("contentResourceId_idx").on(crt.contentResourceId),
|
|
266
|
+
tagIdIdx: index4("tagId_idx").on(crt.tagId),
|
|
267
|
+
positionIdx: index4("position_idx").on(crt.position)
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
__name(getContentResourceTagSchema, "getContentResourceTagSchema");
|
|
271
|
+
function getContentResourceTagRelationsSchema(mysqlTable) {
|
|
272
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
273
|
+
const tag = getTagSchema(mysqlTable);
|
|
274
|
+
const contentResourceTag = getContentResourceTagSchema(mysqlTable);
|
|
275
|
+
return relations4(contentResourceTag, ({ one }) => ({
|
|
276
|
+
contentResource: one(contentResource, {
|
|
277
|
+
fields: [
|
|
278
|
+
contentResourceTag.contentResourceId
|
|
279
|
+
],
|
|
280
|
+
references: [
|
|
281
|
+
contentResource.id
|
|
282
|
+
],
|
|
283
|
+
relationName: "contentResource"
|
|
284
|
+
}),
|
|
285
|
+
tag: one(tag, {
|
|
286
|
+
fields: [
|
|
287
|
+
contentResourceTag.tagId
|
|
288
|
+
],
|
|
289
|
+
references: [
|
|
290
|
+
tag.id
|
|
291
|
+
],
|
|
292
|
+
relationName: "tag"
|
|
293
|
+
})
|
|
294
|
+
}));
|
|
295
|
+
}
|
|
296
|
+
__name(getContentResourceTagRelationsSchema, "getContentResourceTagRelationsSchema");
|
|
297
|
+
|
|
298
|
+
// src/lib/mysql/schemas/content/content-resource-version.ts
|
|
299
|
+
import { relations as relations5, sql as sql5 } from "drizzle-orm";
|
|
300
|
+
import { index as index5, int, json as json4, timestamp as timestamp5, unique, varchar as varchar5 } from "drizzle-orm/mysql-core";
|
|
301
|
+
function getContentResourceVersionSchema(mysqlTable) {
|
|
302
|
+
return mysqlTable("ContentResourceVersion", {
|
|
303
|
+
id: varchar5("id", {
|
|
304
|
+
length: 255
|
|
305
|
+
}).notNull().primaryKey(),
|
|
306
|
+
resourceId: varchar5("resourceId", {
|
|
307
|
+
length: 255
|
|
308
|
+
}).notNull(),
|
|
309
|
+
parentVersionId: varchar5("parentVersionId", {
|
|
310
|
+
length: 255
|
|
311
|
+
}),
|
|
312
|
+
versionNumber: int("versionNumber").notNull(),
|
|
313
|
+
fields: json4("fields").$type().default({}),
|
|
314
|
+
createdAt: timestamp5("createdAt", {
|
|
315
|
+
mode: "date",
|
|
316
|
+
fsp: 3
|
|
317
|
+
}).default(sql5`CURRENT_TIMESTAMP(3)`),
|
|
318
|
+
createdById: varchar5("createdById", {
|
|
319
|
+
length: 255
|
|
320
|
+
}).notNull()
|
|
321
|
+
}, (crv) => ({
|
|
322
|
+
resourceIdIdx: index5("resourceId_idx").on(crv.resourceId),
|
|
323
|
+
parentVersionIdIdx: index5("parentVersionId_idx").on(crv.parentVersionId),
|
|
324
|
+
resourceIdVersionNumberIdx: index5("resourceId_versionNumber_idx").on(crv.resourceId, crv.versionNumber),
|
|
325
|
+
uniqueResourceVersion: unique("uq_resource_version_number").on(crv.resourceId, crv.versionNumber)
|
|
326
|
+
}));
|
|
327
|
+
}
|
|
328
|
+
__name(getContentResourceVersionSchema, "getContentResourceVersionSchema");
|
|
329
|
+
function getContentResourceVersionRelationsSchema(mysqlTable) {
|
|
330
|
+
const contentResourceVersion = getContentResourceVersionSchema(mysqlTable);
|
|
331
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
332
|
+
const users = getUsersSchema(mysqlTable);
|
|
333
|
+
return relations5(contentResourceVersion, ({ one }) => ({
|
|
334
|
+
resource: one(contentResource, {
|
|
335
|
+
fields: [
|
|
336
|
+
contentResourceVersion.resourceId
|
|
337
|
+
],
|
|
338
|
+
references: [
|
|
339
|
+
contentResource.id
|
|
340
|
+
],
|
|
341
|
+
relationName: "versions"
|
|
342
|
+
}),
|
|
343
|
+
parentVersion: one(contentResourceVersion, {
|
|
344
|
+
fields: [
|
|
345
|
+
contentResourceVersion.parentVersionId
|
|
346
|
+
],
|
|
347
|
+
references: [
|
|
348
|
+
contentResourceVersion.id
|
|
349
|
+
],
|
|
350
|
+
relationName: "childVersions"
|
|
351
|
+
}),
|
|
352
|
+
createdBy: one(users, {
|
|
353
|
+
fields: [
|
|
354
|
+
contentResourceVersion.createdById
|
|
355
|
+
],
|
|
356
|
+
references: [
|
|
357
|
+
users.id
|
|
358
|
+
],
|
|
359
|
+
relationName: "createdVersions"
|
|
360
|
+
})
|
|
361
|
+
}));
|
|
362
|
+
}
|
|
363
|
+
__name(getContentResourceVersionRelationsSchema, "getContentResourceVersionRelationsSchema");
|
|
364
|
+
|
|
365
|
+
// src/lib/mysql/schemas/content/content-resource.ts
|
|
366
|
+
function getContentResourceSchema(mysqlTable) {
|
|
367
|
+
return mysqlTable("ContentResource", {
|
|
368
|
+
id: varchar6("id", {
|
|
369
|
+
length: 255
|
|
370
|
+
}).notNull().primaryKey(),
|
|
371
|
+
type: varchar6("type", {
|
|
372
|
+
length: 255
|
|
373
|
+
}).notNull(),
|
|
374
|
+
createdById: varchar6("createdById", {
|
|
375
|
+
length: 255
|
|
376
|
+
}).notNull(),
|
|
377
|
+
fields: json5("fields").$type().default({}),
|
|
378
|
+
currentVersionId: varchar6("currentVersionId", {
|
|
379
|
+
length: 255
|
|
380
|
+
}),
|
|
381
|
+
createdAt: timestamp6("createdAt", {
|
|
382
|
+
mode: "date",
|
|
383
|
+
fsp: 3
|
|
384
|
+
}).default(sql6`CURRENT_TIMESTAMP(3)`),
|
|
385
|
+
updatedAt: timestamp6("updatedAt", {
|
|
386
|
+
mode: "date",
|
|
387
|
+
fsp: 3
|
|
388
|
+
}).default(sql6`CURRENT_TIMESTAMP(3)`),
|
|
389
|
+
deletedAt: timestamp6("deletedAt", {
|
|
390
|
+
mode: "date",
|
|
391
|
+
fsp: 3
|
|
392
|
+
})
|
|
148
393
|
}, (cm) => ({
|
|
149
|
-
typeIdx:
|
|
150
|
-
createdByIdx:
|
|
151
|
-
createdAtIdx:
|
|
394
|
+
typeIdx: index6("type_idx").on(cm.type),
|
|
395
|
+
createdByIdx: index6("createdById_idx").on(cm.createdById),
|
|
396
|
+
createdAtIdx: index6("createdAt_idx").on(cm.createdAt),
|
|
397
|
+
currentVersionIdIdx: index6("currentVersionId_idx").on(cm.currentVersionId)
|
|
152
398
|
}));
|
|
153
399
|
}
|
|
154
400
|
__name(getContentResourceSchema, "getContentResourceSchema");
|
|
@@ -158,7 +404,10 @@ function getContentResourceRelationsSchema(mysqlTable) {
|
|
|
158
404
|
const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
|
|
159
405
|
const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
|
|
160
406
|
const contentContributions = getContentContributionsSchema(mysqlTable);
|
|
161
|
-
|
|
407
|
+
const contentResourceTag = getContentResourceTagSchema(mysqlTable);
|
|
408
|
+
const contentResourceVersion = getContentResourceVersionSchema(mysqlTable);
|
|
409
|
+
const tag = getTagSchema(mysqlTable);
|
|
410
|
+
return relations6(contentResource, ({ one, many }) => ({
|
|
162
411
|
createdBy: one(users, {
|
|
163
412
|
fields: [
|
|
164
413
|
contentResource.createdById
|
|
@@ -168,6 +417,9 @@ function getContentResourceRelationsSchema(mysqlTable) {
|
|
|
168
417
|
],
|
|
169
418
|
relationName: "creator"
|
|
170
419
|
}),
|
|
420
|
+
tags: many(contentResourceTag, {
|
|
421
|
+
relationName: "contentResource"
|
|
422
|
+
}),
|
|
171
423
|
resources: many(contentResourceResource, {
|
|
172
424
|
relationName: "resourceOf"
|
|
173
425
|
}),
|
|
@@ -179,6 +431,18 @@ function getContentResourceRelationsSchema(mysqlTable) {
|
|
|
179
431
|
}),
|
|
180
432
|
contributions: many(contentContributions, {
|
|
181
433
|
relationName: "contributions"
|
|
434
|
+
}),
|
|
435
|
+
currentVersion: one(contentResourceVersion, {
|
|
436
|
+
fields: [
|
|
437
|
+
contentResource.currentVersionId
|
|
438
|
+
],
|
|
439
|
+
references: [
|
|
440
|
+
contentResourceVersion.id
|
|
441
|
+
],
|
|
442
|
+
relationName: "currentVersionResource"
|
|
443
|
+
}),
|
|
444
|
+
versions: many(contentResourceVersion, {
|
|
445
|
+
relationName: "resource"
|
|
182
446
|
})
|
|
183
447
|
}));
|
|
184
448
|
}
|
|
@@ -187,35 +451,35 @@ __name(getContentResourceRelationsSchema, "getContentResourceRelationsSchema");
|
|
|
187
451
|
// src/lib/mysql/schemas/content/content-resource-product.ts
|
|
188
452
|
function getContentResourceProductSchema(mysqlTable) {
|
|
189
453
|
return mysqlTable("ContentResourceProduct", {
|
|
190
|
-
productId:
|
|
454
|
+
productId: varchar7("productId", {
|
|
191
455
|
length: 255
|
|
192
456
|
}).notNull(),
|
|
193
|
-
resourceId:
|
|
457
|
+
resourceId: varchar7("resourceId", {
|
|
194
458
|
length: 255
|
|
195
459
|
}).notNull(),
|
|
196
|
-
position:
|
|
197
|
-
metadata:
|
|
198
|
-
createdAt:
|
|
460
|
+
position: double4("position").notNull().default(0),
|
|
461
|
+
metadata: json6("metadata").$type().default({}),
|
|
462
|
+
createdAt: timestamp7("createdAt", {
|
|
199
463
|
mode: "date",
|
|
200
464
|
fsp: 3
|
|
201
|
-
}).default(
|
|
202
|
-
updatedAt:
|
|
465
|
+
}).default(sql7`CURRENT_TIMESTAMP(3)`),
|
|
466
|
+
updatedAt: timestamp7("updatedAt", {
|
|
203
467
|
mode: "date",
|
|
204
468
|
fsp: 3
|
|
205
|
-
}).default(
|
|
206
|
-
deletedAt:
|
|
469
|
+
}).default(sql7`CURRENT_TIMESTAMP(3)`),
|
|
470
|
+
deletedAt: timestamp7("deletedAt", {
|
|
207
471
|
mode: "date",
|
|
208
472
|
fsp: 3
|
|
209
473
|
})
|
|
210
474
|
}, (crr) => ({
|
|
211
|
-
pk:
|
|
475
|
+
pk: primaryKey4({
|
|
212
476
|
columns: [
|
|
213
477
|
crr.productId,
|
|
214
478
|
crr.resourceId
|
|
215
479
|
]
|
|
216
480
|
}),
|
|
217
|
-
contentResourceIdIdx:
|
|
218
|
-
resourceIdIdx:
|
|
481
|
+
contentResourceIdIdx: index7("contentResourceId_idx").on(crr.productId),
|
|
482
|
+
resourceIdIdx: index7("resourceId_idx").on(crr.resourceId)
|
|
219
483
|
}));
|
|
220
484
|
}
|
|
221
485
|
__name(getContentResourceProductSchema, "getContentResourceProductSchema");
|
|
@@ -223,7 +487,7 @@ function getContentResourceProductRelationsSchema(mysqlTable) {
|
|
|
223
487
|
const contentResource = getContentResourceSchema(mysqlTable);
|
|
224
488
|
const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
|
|
225
489
|
const product = getProductSchema(mysqlTable);
|
|
226
|
-
return
|
|
490
|
+
return relations7(contentResourceProduct, ({ one }) => ({
|
|
227
491
|
product: one(product, {
|
|
228
492
|
fields: [
|
|
229
493
|
contentResourceProduct.productId
|
|
@@ -247,32 +511,32 @@ function getContentResourceProductRelationsSchema(mysqlTable) {
|
|
|
247
511
|
__name(getContentResourceProductRelationsSchema, "getContentResourceProductRelationsSchema");
|
|
248
512
|
|
|
249
513
|
// src/lib/mysql/schemas/commerce/price.ts
|
|
250
|
-
import { relations as
|
|
251
|
-
import { decimal, int, json as
|
|
514
|
+
import { relations as relations8, sql as sql8 } from "drizzle-orm";
|
|
515
|
+
import { decimal, int as int2, json as json7, primaryKey as primaryKey5, timestamp as timestamp8, varchar as varchar8 } from "drizzle-orm/mysql-core";
|
|
252
516
|
function getPriceSchema(mysqlTable) {
|
|
253
517
|
return mysqlTable("Price", {
|
|
254
|
-
id:
|
|
518
|
+
id: varchar8("id", {
|
|
255
519
|
length: 191
|
|
256
520
|
}).notNull(),
|
|
257
|
-
productId:
|
|
521
|
+
productId: varchar8("productId", {
|
|
258
522
|
length: 191
|
|
259
523
|
}),
|
|
260
|
-
nickname:
|
|
524
|
+
nickname: varchar8("nickname", {
|
|
261
525
|
length: 191
|
|
262
526
|
}),
|
|
263
|
-
status:
|
|
527
|
+
status: int2("status").default(0).notNull(),
|
|
264
528
|
unitAmount: decimal("unitAmount", {
|
|
265
529
|
precision: 10,
|
|
266
530
|
scale: 2
|
|
267
531
|
}).notNull(),
|
|
268
|
-
createdAt:
|
|
532
|
+
createdAt: timestamp8("createdAt", {
|
|
269
533
|
mode: "date",
|
|
270
534
|
fsp: 3
|
|
271
|
-
}).default(
|
|
272
|
-
fields:
|
|
535
|
+
}).default(sql8`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
536
|
+
fields: json7("fields").$type().default({})
|
|
273
537
|
}, (table) => {
|
|
274
538
|
return {
|
|
275
|
-
priceId:
|
|
539
|
+
priceId: primaryKey5({
|
|
276
540
|
columns: [
|
|
277
541
|
table.id
|
|
278
542
|
],
|
|
@@ -286,7 +550,7 @@ function getProductRelationsSchema(mysqlTable) {
|
|
|
286
550
|
const product = getProductSchema(mysqlTable);
|
|
287
551
|
const price = getPriceSchema(mysqlTable);
|
|
288
552
|
const merchantPrice = getMerchantPriceSchema(mysqlTable);
|
|
289
|
-
return
|
|
553
|
+
return relations8(price, ({ one, many }) => ({
|
|
290
554
|
product: one(product, {
|
|
291
555
|
fields: [
|
|
292
556
|
price.productId
|
|
@@ -312,28 +576,28 @@ __name(getProductRelationsSchema, "getProductRelationsSchema");
|
|
|
312
576
|
// src/lib/mysql/schemas/commerce/product.ts
|
|
313
577
|
function getProductSchema(mysqlTable) {
|
|
314
578
|
return mysqlTable("Product", {
|
|
315
|
-
id:
|
|
579
|
+
id: varchar9("id", {
|
|
316
580
|
length: 191
|
|
317
581
|
}).notNull(),
|
|
318
|
-
name:
|
|
582
|
+
name: varchar9("name", {
|
|
319
583
|
length: 191
|
|
320
584
|
}).notNull(),
|
|
321
|
-
key:
|
|
585
|
+
key: varchar9("key", {
|
|
322
586
|
length: 191
|
|
323
587
|
}),
|
|
324
|
-
type:
|
|
588
|
+
type: varchar9("type", {
|
|
325
589
|
length: 191
|
|
326
590
|
}),
|
|
327
|
-
fields:
|
|
328
|
-
createdAt:
|
|
591
|
+
fields: json8("fields").$type().default({}),
|
|
592
|
+
createdAt: timestamp9("createdAt", {
|
|
329
593
|
mode: "date",
|
|
330
594
|
fsp: 3
|
|
331
|
-
}).default(
|
|
332
|
-
status:
|
|
333
|
-
quantityAvailable:
|
|
595
|
+
}).default(sql9`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
596
|
+
status: int3("status").default(0).notNull(),
|
|
597
|
+
quantityAvailable: int3("quantityAvailable").default(-1).notNull()
|
|
334
598
|
}, (table) => {
|
|
335
599
|
return {
|
|
336
|
-
productId:
|
|
600
|
+
productId: primaryKey6({
|
|
337
601
|
columns: [
|
|
338
602
|
table.id
|
|
339
603
|
],
|
|
@@ -348,7 +612,7 @@ function getProductRelationsSchema2(mysqlTable) {
|
|
|
348
612
|
const price = getPriceSchema(mysqlTable);
|
|
349
613
|
const merchantProduct = getMerchantProductSchema(mysqlTable);
|
|
350
614
|
const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
|
|
351
|
-
return
|
|
615
|
+
return relations9(product, ({ one, many }) => ({
|
|
352
616
|
price: one(price, {
|
|
353
617
|
fields: [
|
|
354
618
|
product.id
|
|
@@ -377,45 +641,45 @@ __name(getProductRelationsSchema2, "getProductRelationsSchema");
|
|
|
377
641
|
// src/lib/mysql/schemas/commerce/coupon.ts
|
|
378
642
|
function getCouponSchema(mysqlTable) {
|
|
379
643
|
return mysqlTable("Coupon", {
|
|
380
|
-
id:
|
|
644
|
+
id: varchar10("id", {
|
|
381
645
|
length: 191
|
|
382
646
|
}).notNull(),
|
|
383
|
-
code:
|
|
647
|
+
code: varchar10("code", {
|
|
384
648
|
length: 191
|
|
385
649
|
}),
|
|
386
|
-
createdAt:
|
|
650
|
+
createdAt: timestamp10("createdAt", {
|
|
387
651
|
mode: "date",
|
|
388
652
|
fsp: 3
|
|
389
|
-
}).default(
|
|
390
|
-
expires:
|
|
653
|
+
}).default(sql10`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
654
|
+
expires: timestamp10("expires", {
|
|
391
655
|
mode: "date",
|
|
392
656
|
fsp: 3
|
|
393
657
|
}),
|
|
394
|
-
fields:
|
|
395
|
-
maxUses:
|
|
658
|
+
fields: json9("fields").$type().default({}),
|
|
659
|
+
maxUses: int4("maxUses").default(-1).notNull(),
|
|
396
660
|
default: boolean("default").default(false).notNull(),
|
|
397
|
-
merchantCouponId:
|
|
661
|
+
merchantCouponId: varchar10("merchantCouponId", {
|
|
398
662
|
length: 191
|
|
399
663
|
}),
|
|
400
|
-
status:
|
|
401
|
-
usedCount:
|
|
664
|
+
status: int4("status").default(0).notNull(),
|
|
665
|
+
usedCount: int4("usedCount").default(0).notNull(),
|
|
402
666
|
percentageDiscount: decimal2("percentageDiscount", {
|
|
403
667
|
precision: 3,
|
|
404
668
|
scale: 2
|
|
405
669
|
}).notNull(),
|
|
406
|
-
restrictedToProductId:
|
|
670
|
+
restrictedToProductId: varchar10("restrictedToProductId", {
|
|
407
671
|
length: 191
|
|
408
672
|
})
|
|
409
673
|
}, (table) => {
|
|
410
674
|
return {
|
|
411
|
-
couponIdCodeIndex:
|
|
412
|
-
couponId:
|
|
675
|
+
couponIdCodeIndex: index8("Coupon_id_code_index").on(table.id, table.code),
|
|
676
|
+
couponId: primaryKey7({
|
|
413
677
|
columns: [
|
|
414
678
|
table.id
|
|
415
679
|
],
|
|
416
680
|
name: "Coupon_id"
|
|
417
681
|
}),
|
|
418
|
-
couponCodeKey:
|
|
682
|
+
couponCodeKey: unique2("Coupon_code_key").on(table.code)
|
|
419
683
|
};
|
|
420
684
|
});
|
|
421
685
|
}
|
|
@@ -424,7 +688,7 @@ function getCouponRelationsSchema(mysqlTable) {
|
|
|
424
688
|
const purchase = getPurchaseSchema(mysqlTable);
|
|
425
689
|
const coupon = getCouponSchema(mysqlTable);
|
|
426
690
|
const merchantCoupon = getMerchantCouponSchema(mysqlTable);
|
|
427
|
-
return
|
|
691
|
+
return relations10(coupon, ({ many, one }) => ({
|
|
428
692
|
redeemedBulkCouponPurchases: many(purchase, {
|
|
429
693
|
relationName: "redeemedBulkCoupon"
|
|
430
694
|
}),
|
|
@@ -456,67 +720,67 @@ __name(getCouponRelationsSchema, "getCouponRelationsSchema");
|
|
|
456
720
|
// src/lib/mysql/schemas/commerce/purchase.ts
|
|
457
721
|
function getPurchaseSchema(mysqlTable) {
|
|
458
722
|
return mysqlTable("Purchase", {
|
|
459
|
-
id:
|
|
723
|
+
id: varchar11("id", {
|
|
460
724
|
length: 191
|
|
461
725
|
}).notNull(),
|
|
462
|
-
userId:
|
|
726
|
+
userId: varchar11("userId", {
|
|
463
727
|
length: 191
|
|
464
728
|
}),
|
|
465
|
-
createdAt:
|
|
729
|
+
createdAt: timestamp11("createdAt", {
|
|
466
730
|
mode: "date",
|
|
467
731
|
fsp: 3
|
|
468
|
-
}).default(
|
|
732
|
+
}).default(sql11`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
469
733
|
totalAmount: decimal3("totalAmount", {
|
|
470
734
|
precision: 65,
|
|
471
735
|
scale: 30
|
|
472
736
|
}).notNull(),
|
|
473
|
-
ipAddress:
|
|
737
|
+
ipAddress: varchar11("ip_address", {
|
|
474
738
|
length: 191
|
|
475
739
|
}),
|
|
476
|
-
city:
|
|
740
|
+
city: varchar11("city", {
|
|
477
741
|
length: 191
|
|
478
742
|
}),
|
|
479
|
-
state:
|
|
743
|
+
state: varchar11("state", {
|
|
480
744
|
length: 191
|
|
481
745
|
}),
|
|
482
|
-
country:
|
|
746
|
+
country: varchar11("country", {
|
|
483
747
|
length: 191
|
|
484
748
|
}),
|
|
485
|
-
couponId:
|
|
749
|
+
couponId: varchar11("couponId", {
|
|
486
750
|
length: 191
|
|
487
751
|
}),
|
|
488
|
-
productId:
|
|
752
|
+
productId: varchar11("productId", {
|
|
489
753
|
length: 191
|
|
490
754
|
}).notNull(),
|
|
491
|
-
merchantChargeId:
|
|
755
|
+
merchantChargeId: varchar11("merchantChargeId", {
|
|
492
756
|
length: 191
|
|
493
757
|
}),
|
|
494
|
-
upgradedFromId:
|
|
758
|
+
upgradedFromId: varchar11("upgradedFromId", {
|
|
495
759
|
length: 191
|
|
496
760
|
}),
|
|
497
|
-
status:
|
|
761
|
+
status: varchar11("status", {
|
|
498
762
|
length: 191
|
|
499
763
|
}).default("Valid").notNull(),
|
|
500
|
-
bulkCouponId:
|
|
764
|
+
bulkCouponId: varchar11("bulkCouponId", {
|
|
501
765
|
length: 191
|
|
502
766
|
}),
|
|
503
|
-
merchantSessionId:
|
|
767
|
+
merchantSessionId: varchar11("merchantSessionId", {
|
|
504
768
|
length: 191
|
|
505
769
|
}),
|
|
506
|
-
redeemedBulkCouponId:
|
|
770
|
+
redeemedBulkCouponId: varchar11("redeemedBulkCouponId", {
|
|
507
771
|
length: 191
|
|
508
772
|
}),
|
|
509
|
-
fields:
|
|
773
|
+
fields: json10("fields").$type().default({})
|
|
510
774
|
}, (table) => {
|
|
511
775
|
return {
|
|
512
|
-
purchaseId:
|
|
776
|
+
purchaseId: primaryKey8({
|
|
513
777
|
columns: [
|
|
514
778
|
table.id
|
|
515
779
|
],
|
|
516
780
|
name: "Purchase_id"
|
|
517
781
|
}),
|
|
518
|
-
merchantChargeIdIdx:
|
|
519
|
-
purchaseUpgradedFromIdKey:
|
|
782
|
+
merchantChargeIdIdx: index9("idx_Purchase_on_merchantChargeId").on(table.merchantChargeId),
|
|
783
|
+
purchaseUpgradedFromIdKey: unique3("Purchase_upgradedFromId_key").on(table.upgradedFromId)
|
|
520
784
|
};
|
|
521
785
|
});
|
|
522
786
|
}
|
|
@@ -528,7 +792,7 @@ function getPurchaseRelationsSchema(mysqlTable) {
|
|
|
528
792
|
const merchantCharges = getMerchantChargeSchema(mysqlTable);
|
|
529
793
|
const merchantSessions = getMerchantSessionSchema(mysqlTable);
|
|
530
794
|
const coupons = getCouponSchema(mysqlTable);
|
|
531
|
-
return
|
|
795
|
+
return relations11(purchases, ({ many, one }) => ({
|
|
532
796
|
redeemedBulkCoupon: one(coupons, {
|
|
533
797
|
fields: [
|
|
534
798
|
purchases.redeemedBulkCouponId
|
|
@@ -588,44 +852,44 @@ function getPurchaseRelationsSchema(mysqlTable) {
|
|
|
588
852
|
__name(getPurchaseRelationsSchema, "getPurchaseRelationsSchema");
|
|
589
853
|
|
|
590
854
|
// src/lib/mysql/schemas/communication/comment.ts
|
|
591
|
-
import { relations as
|
|
592
|
-
import { index as
|
|
855
|
+
import { relations as relations12, sql as sql12 } from "drizzle-orm";
|
|
856
|
+
import { index as index10, json as json11, primaryKey as primaryKey9, text, timestamp as timestamp12, varchar as varchar12 } from "drizzle-orm/mysql-core";
|
|
593
857
|
function getCommentsSchema(mysqlTable) {
|
|
594
858
|
return mysqlTable("Comment", {
|
|
595
|
-
id:
|
|
859
|
+
id: varchar12("id", {
|
|
596
860
|
length: 191
|
|
597
861
|
}).notNull(),
|
|
598
|
-
userId:
|
|
862
|
+
userId: varchar12("userId", {
|
|
599
863
|
length: 255
|
|
600
864
|
}).notNull(),
|
|
601
|
-
context:
|
|
865
|
+
context: json11("context").$type().default({}),
|
|
602
866
|
text: text("text").notNull(),
|
|
603
|
-
createdAt:
|
|
867
|
+
createdAt: timestamp12("createdAt", {
|
|
604
868
|
mode: "date",
|
|
605
869
|
fsp: 3
|
|
606
|
-
}).default(
|
|
607
|
-
updatedAt:
|
|
870
|
+
}).default(sql12`CURRENT_TIMESTAMP(3)`),
|
|
871
|
+
updatedAt: timestamp12("updatedAt", {
|
|
608
872
|
mode: "date",
|
|
609
873
|
fsp: 3
|
|
610
|
-
}).default(
|
|
611
|
-
deletedAt:
|
|
874
|
+
}).default(sql12`CURRENT_TIMESTAMP(3)`),
|
|
875
|
+
deletedAt: timestamp12("deletedAt", {
|
|
612
876
|
mode: "date",
|
|
613
877
|
fsp: 3
|
|
614
878
|
})
|
|
615
879
|
}, (crr) => ({
|
|
616
|
-
pk:
|
|
880
|
+
pk: primaryKey9({
|
|
617
881
|
columns: [
|
|
618
882
|
crr.id
|
|
619
883
|
]
|
|
620
884
|
}),
|
|
621
|
-
crrUserIdIdKey:
|
|
885
|
+
crrUserIdIdKey: index10("crr_userIdId_idx").on(crr.userId)
|
|
622
886
|
}));
|
|
623
887
|
}
|
|
624
888
|
__name(getCommentsSchema, "getCommentsSchema");
|
|
625
889
|
function getCommentRelationsSchema(mysqlTable) {
|
|
626
890
|
const comment = getCommentsSchema(mysqlTable);
|
|
627
891
|
const user = getUsersSchema(mysqlTable);
|
|
628
|
-
return
|
|
892
|
+
return relations12(comment, ({ one }) => ({
|
|
629
893
|
user: one(user, {
|
|
630
894
|
fields: [
|
|
631
895
|
comment.userId
|
|
@@ -640,17 +904,17 @@ function getCommentRelationsSchema(mysqlTable) {
|
|
|
640
904
|
__name(getCommentRelationsSchema, "getCommentRelationsSchema");
|
|
641
905
|
|
|
642
906
|
// src/lib/mysql/schemas/communication/communication-preferences.ts
|
|
643
|
-
import { relations as
|
|
644
|
-
import { boolean as boolean2, index as
|
|
907
|
+
import { relations as relations13 } from "drizzle-orm";
|
|
908
|
+
import { boolean as boolean2, index as index11, mysqlEnum, timestamp as timestamp13, varchar as varchar13 } from "drizzle-orm/mysql-core";
|
|
645
909
|
function getCommunicationPreferencesSchema(mysqlTable) {
|
|
646
910
|
return mysqlTable("CommunicationPreference", {
|
|
647
|
-
id:
|
|
911
|
+
id: varchar13("id", {
|
|
648
912
|
length: 255
|
|
649
913
|
}).notNull().primaryKey(),
|
|
650
|
-
userId:
|
|
914
|
+
userId: varchar13("userId", {
|
|
651
915
|
length: 255
|
|
652
916
|
}).notNull(),
|
|
653
|
-
channelId:
|
|
917
|
+
channelId: varchar13("channelId", {
|
|
654
918
|
length: 255
|
|
655
919
|
}).notNull(),
|
|
656
920
|
preferenceLevel: mysqlEnum("preferenceLevel", [
|
|
@@ -658,34 +922,34 @@ function getCommunicationPreferencesSchema(mysqlTable) {
|
|
|
658
922
|
"medium",
|
|
659
923
|
"high"
|
|
660
924
|
]).notNull().default("medium"),
|
|
661
|
-
preferenceTypeId:
|
|
925
|
+
preferenceTypeId: varchar13("preferenceTypeId", {
|
|
662
926
|
length: 255
|
|
663
927
|
}).notNull(),
|
|
664
928
|
active: boolean2("active").notNull().default(true),
|
|
665
|
-
createdAt:
|
|
929
|
+
createdAt: timestamp13("createdAt", {
|
|
666
930
|
mode: "date",
|
|
667
931
|
fsp: 3
|
|
668
932
|
}).defaultNow(),
|
|
669
|
-
optInAt:
|
|
933
|
+
optInAt: timestamp13("optInAt", {
|
|
670
934
|
mode: "date",
|
|
671
935
|
fsp: 3
|
|
672
936
|
}),
|
|
673
|
-
optOutAt:
|
|
937
|
+
optOutAt: timestamp13("optOutAt", {
|
|
674
938
|
mode: "date",
|
|
675
939
|
fsp: 3
|
|
676
940
|
}),
|
|
677
|
-
updatedAt:
|
|
941
|
+
updatedAt: timestamp13("updatedAt", {
|
|
678
942
|
mode: "date",
|
|
679
943
|
fsp: 3
|
|
680
944
|
}).defaultNow(),
|
|
681
|
-
deletedAt:
|
|
945
|
+
deletedAt: timestamp13("deletedAt", {
|
|
682
946
|
mode: "date",
|
|
683
947
|
fsp: 3
|
|
684
948
|
})
|
|
685
949
|
}, (cp) => ({
|
|
686
|
-
userIdIdx:
|
|
687
|
-
preferenceTypeIdx:
|
|
688
|
-
channelIdIdx:
|
|
950
|
+
userIdIdx: index11("userId_idx").on(cp.userId),
|
|
951
|
+
preferenceTypeIdx: index11("preferenceTypeId_idx").on(cp.preferenceTypeId),
|
|
952
|
+
channelIdIdx: index11("channelId_idx").on(cp.channelId)
|
|
689
953
|
}));
|
|
690
954
|
}
|
|
691
955
|
__name(getCommunicationPreferencesSchema, "getCommunicationPreferencesSchema");
|
|
@@ -694,7 +958,7 @@ function getCommunicationPreferencesRelationsSchema(mysqlTable) {
|
|
|
694
958
|
const users = getUsersSchema(mysqlTable);
|
|
695
959
|
const communicationChannel = getCommunicationChannelSchema(mysqlTable);
|
|
696
960
|
const communicationPreferenceTypes = getCommunicationPreferenceTypesSchema(mysqlTable);
|
|
697
|
-
return
|
|
961
|
+
return relations13(communicationPreferences, ({ one }) => ({
|
|
698
962
|
user: one(users, {
|
|
699
963
|
fields: [
|
|
700
964
|
communicationPreferences.userId
|
|
@@ -727,53 +991,53 @@ function getCommunicationPreferencesRelationsSchema(mysqlTable) {
|
|
|
727
991
|
__name(getCommunicationPreferencesRelationsSchema, "getCommunicationPreferencesRelationsSchema");
|
|
728
992
|
|
|
729
993
|
// src/lib/mysql/schemas/auth/accounts.ts
|
|
730
|
-
import { relations as
|
|
731
|
-
import { index as
|
|
994
|
+
import { relations as relations14 } from "drizzle-orm";
|
|
995
|
+
import { index as index12, int as int5, primaryKey as primaryKey10, text as text2, varchar as varchar14 } from "drizzle-orm/mysql-core";
|
|
732
996
|
function getAccountsSchema(mysqlTable) {
|
|
733
997
|
return mysqlTable("Account", {
|
|
734
|
-
userId:
|
|
998
|
+
userId: varchar14("userId", {
|
|
735
999
|
length: 255
|
|
736
1000
|
}).notNull(),
|
|
737
|
-
type:
|
|
1001
|
+
type: varchar14("type", {
|
|
738
1002
|
length: 255
|
|
739
1003
|
}).$type().notNull(),
|
|
740
|
-
provider:
|
|
1004
|
+
provider: varchar14("provider", {
|
|
741
1005
|
length: 255
|
|
742
1006
|
}).notNull(),
|
|
743
|
-
providerAccountId:
|
|
1007
|
+
providerAccountId: varchar14("providerAccountId", {
|
|
744
1008
|
length: 255
|
|
745
1009
|
}).notNull(),
|
|
746
1010
|
refresh_token: text2("refresh_token"),
|
|
747
1011
|
access_token: text2("access_token"),
|
|
748
1012
|
oauth_token: text2("oauth_token"),
|
|
749
1013
|
oauth_token_secret: text2("oauth_token_secret"),
|
|
750
|
-
expires_at:
|
|
751
|
-
token_type:
|
|
1014
|
+
expires_at: int5("expires_at"),
|
|
1015
|
+
token_type: varchar14("token_type", {
|
|
752
1016
|
length: 255
|
|
753
1017
|
}),
|
|
754
|
-
scope:
|
|
1018
|
+
scope: varchar14("scope", {
|
|
755
1019
|
length: 255
|
|
756
1020
|
}),
|
|
757
1021
|
id_token: text2("id_token"),
|
|
758
|
-
session_state:
|
|
1022
|
+
session_state: varchar14("session_state", {
|
|
759
1023
|
length: 255
|
|
760
1024
|
}),
|
|
761
|
-
refresh_token_expires_in:
|
|
1025
|
+
refresh_token_expires_in: int5("refresh_token_expires_in")
|
|
762
1026
|
}, (account) => ({
|
|
763
|
-
pk:
|
|
1027
|
+
pk: primaryKey10({
|
|
764
1028
|
columns: [
|
|
765
1029
|
account.provider,
|
|
766
1030
|
account.providerAccountId
|
|
767
1031
|
]
|
|
768
1032
|
}),
|
|
769
|
-
userIdIdx:
|
|
1033
|
+
userIdIdx: index12("userId_idx").on(account.userId)
|
|
770
1034
|
}));
|
|
771
1035
|
}
|
|
772
1036
|
__name(getAccountsSchema, "getAccountsSchema");
|
|
773
1037
|
function getAccountsRelationsSchema(mysqlTable) {
|
|
774
1038
|
const accounts = getAccountsSchema(mysqlTable);
|
|
775
1039
|
const users = getUsersSchema(mysqlTable);
|
|
776
|
-
return
|
|
1040
|
+
return relations14(accounts, ({ one }) => ({
|
|
777
1041
|
user: one(users, {
|
|
778
1042
|
fields: [
|
|
779
1043
|
accounts.userId
|
|
@@ -788,38 +1052,38 @@ function getAccountsRelationsSchema(mysqlTable) {
|
|
|
788
1052
|
__name(getAccountsRelationsSchema, "getAccountsRelationsSchema");
|
|
789
1053
|
|
|
790
1054
|
// src/lib/mysql/schemas/auth/user-permissions.ts
|
|
791
|
-
import { relations as
|
|
792
|
-
import { boolean as boolean3, index as
|
|
1055
|
+
import { relations as relations15 } from "drizzle-orm";
|
|
1056
|
+
import { boolean as boolean3, index as index13, primaryKey as primaryKey11, timestamp as timestamp14, varchar as varchar15 } from "drizzle-orm/mysql-core";
|
|
793
1057
|
function getUserPermissionsSchema(mysqlTable) {
|
|
794
1058
|
return mysqlTable("UserPermission", {
|
|
795
|
-
userId:
|
|
1059
|
+
userId: varchar15("userId", {
|
|
796
1060
|
length: 255
|
|
797
1061
|
}).notNull(),
|
|
798
|
-
permissionId:
|
|
1062
|
+
permissionId: varchar15("permissionId", {
|
|
799
1063
|
length: 255
|
|
800
1064
|
}).notNull(),
|
|
801
1065
|
active: boolean3("active").notNull().default(true),
|
|
802
|
-
createdAt:
|
|
1066
|
+
createdAt: timestamp14("createdAt", {
|
|
803
1067
|
mode: "date",
|
|
804
1068
|
fsp: 3
|
|
805
1069
|
}).defaultNow(),
|
|
806
|
-
updatedAt:
|
|
1070
|
+
updatedAt: timestamp14("updatedAt", {
|
|
807
1071
|
mode: "date",
|
|
808
1072
|
fsp: 3
|
|
809
1073
|
}).defaultNow(),
|
|
810
|
-
deletedAt:
|
|
1074
|
+
deletedAt: timestamp14("deletedAt", {
|
|
811
1075
|
mode: "date",
|
|
812
1076
|
fsp: 3
|
|
813
1077
|
})
|
|
814
1078
|
}, (up) => ({
|
|
815
|
-
pk:
|
|
1079
|
+
pk: primaryKey11({
|
|
816
1080
|
columns: [
|
|
817
1081
|
up.userId,
|
|
818
1082
|
up.permissionId
|
|
819
1083
|
]
|
|
820
1084
|
}),
|
|
821
|
-
userIdIdx:
|
|
822
|
-
permissionIdIdx:
|
|
1085
|
+
userIdIdx: index13("userId_idx").on(up.userId),
|
|
1086
|
+
permissionIdIdx: index13("permissionId_idx").on(up.permissionId)
|
|
823
1087
|
}));
|
|
824
1088
|
}
|
|
825
1089
|
__name(getUserPermissionsSchema, "getUserPermissionsSchema");
|
|
@@ -827,7 +1091,7 @@ function getUserPermissionsRelationsSchema(mysqlTable) {
|
|
|
827
1091
|
const userPermissions = getUserPermissionsSchema(mysqlTable);
|
|
828
1092
|
const users = getUsersSchema(mysqlTable);
|
|
829
1093
|
const permissions = getPermissionsSchema(mysqlTable);
|
|
830
|
-
return
|
|
1094
|
+
return relations15(userPermissions, ({ one }) => ({
|
|
831
1095
|
user: one(users, {
|
|
832
1096
|
fields: [
|
|
833
1097
|
userPermissions.userId
|
|
@@ -851,46 +1115,46 @@ function getUserPermissionsRelationsSchema(mysqlTable) {
|
|
|
851
1115
|
__name(getUserPermissionsRelationsSchema, "getUserPermissionsRelationsSchema");
|
|
852
1116
|
|
|
853
1117
|
// src/lib/mysql/schemas/auth/user-prefs.ts
|
|
854
|
-
import { relations as
|
|
855
|
-
import { index as
|
|
1118
|
+
import { relations as relations16, sql as sql13 } from "drizzle-orm";
|
|
1119
|
+
import { index as index14, json as json12, primaryKey as primaryKey12, timestamp as timestamp15, varchar as varchar16 } from "drizzle-orm/mysql-core";
|
|
856
1120
|
function getUserPrefsSchema(mysqlTable) {
|
|
857
1121
|
return mysqlTable("UserPrefs", {
|
|
858
|
-
id:
|
|
1122
|
+
id: varchar16("id", {
|
|
859
1123
|
length: 191
|
|
860
1124
|
}).notNull(),
|
|
861
|
-
type:
|
|
1125
|
+
type: varchar16("type", {
|
|
862
1126
|
length: 191
|
|
863
1127
|
}).default("Global").notNull(),
|
|
864
|
-
userId:
|
|
1128
|
+
userId: varchar16("userId", {
|
|
865
1129
|
length: 255
|
|
866
1130
|
}).notNull(),
|
|
867
|
-
fields:
|
|
868
|
-
createdAt:
|
|
1131
|
+
fields: json12("fields").$type().default({}),
|
|
1132
|
+
createdAt: timestamp15("createdAt", {
|
|
869
1133
|
mode: "date",
|
|
870
1134
|
fsp: 3
|
|
871
|
-
}).default(
|
|
872
|
-
updatedAt:
|
|
1135
|
+
}).default(sql13`CURRENT_TIMESTAMP(3)`),
|
|
1136
|
+
updatedAt: timestamp15("updatedAt", {
|
|
873
1137
|
mode: "date",
|
|
874
1138
|
fsp: 3
|
|
875
|
-
}).default(
|
|
876
|
-
deletedAt:
|
|
1139
|
+
}).default(sql13`CURRENT_TIMESTAMP(3)`),
|
|
1140
|
+
deletedAt: timestamp15("deletedAt", {
|
|
877
1141
|
mode: "date",
|
|
878
1142
|
fsp: 3
|
|
879
1143
|
})
|
|
880
1144
|
}, (crr) => ({
|
|
881
|
-
pk:
|
|
1145
|
+
pk: primaryKey12({
|
|
882
1146
|
columns: [
|
|
883
1147
|
crr.id
|
|
884
1148
|
]
|
|
885
1149
|
}),
|
|
886
|
-
crrUserIdIdKey:
|
|
1150
|
+
crrUserIdIdKey: index14("crr_userIdId_idx").on(crr.userId)
|
|
887
1151
|
}));
|
|
888
1152
|
}
|
|
889
1153
|
__name(getUserPrefsSchema, "getUserPrefsSchema");
|
|
890
1154
|
function getUserPrefsRelationsSchema(mysqlTable) {
|
|
891
1155
|
const userPrefs = getUserPrefsSchema(mysqlTable);
|
|
892
1156
|
const user = getUsersSchema(mysqlTable);
|
|
893
|
-
return
|
|
1157
|
+
return relations16(userPrefs, ({ one }) => ({
|
|
894
1158
|
user: one(user, {
|
|
895
1159
|
fields: [
|
|
896
1160
|
userPrefs.userId
|
|
@@ -905,43 +1169,43 @@ function getUserPrefsRelationsSchema(mysqlTable) {
|
|
|
905
1169
|
__name(getUserPrefsRelationsSchema, "getUserPrefsRelationsSchema");
|
|
906
1170
|
|
|
907
1171
|
// src/lib/mysql/schemas/auth/user-roles.ts
|
|
908
|
-
import { relations as
|
|
909
|
-
import { boolean as boolean5, index as
|
|
1172
|
+
import { relations as relations18 } from "drizzle-orm";
|
|
1173
|
+
import { boolean as boolean5, index as index16, primaryKey as primaryKey13, timestamp as timestamp17, varchar as varchar18 } from "drizzle-orm/mysql-core";
|
|
910
1174
|
|
|
911
1175
|
// src/lib/mysql/schemas/auth/roles.ts
|
|
912
|
-
import { relations as
|
|
913
|
-
import { boolean as boolean4, index as
|
|
1176
|
+
import { relations as relations17 } from "drizzle-orm";
|
|
1177
|
+
import { boolean as boolean4, index as index15, text as text3, timestamp as timestamp16, varchar as varchar17 } from "drizzle-orm/mysql-core";
|
|
914
1178
|
function getRolesSchema(mysqlTable) {
|
|
915
1179
|
return mysqlTable("Role", {
|
|
916
|
-
id:
|
|
1180
|
+
id: varchar17("id", {
|
|
917
1181
|
length: 255
|
|
918
1182
|
}).notNull().primaryKey(),
|
|
919
|
-
name:
|
|
1183
|
+
name: varchar17("name", {
|
|
920
1184
|
length: 255
|
|
921
1185
|
}).notNull().unique(),
|
|
922
1186
|
description: text3("description"),
|
|
923
1187
|
active: boolean4("active").notNull().default(true),
|
|
924
|
-
createdAt:
|
|
1188
|
+
createdAt: timestamp16("createdAt", {
|
|
925
1189
|
mode: "date",
|
|
926
1190
|
fsp: 3
|
|
927
1191
|
}).defaultNow(),
|
|
928
|
-
updatedAt:
|
|
1192
|
+
updatedAt: timestamp16("updatedAt", {
|
|
929
1193
|
mode: "date",
|
|
930
1194
|
fsp: 3
|
|
931
1195
|
}).defaultNow(),
|
|
932
|
-
deletedAt:
|
|
1196
|
+
deletedAt: timestamp16("deletedAt", {
|
|
933
1197
|
mode: "date",
|
|
934
1198
|
fsp: 3
|
|
935
1199
|
})
|
|
936
1200
|
}, (role) => ({
|
|
937
|
-
nameIdx:
|
|
1201
|
+
nameIdx: index15("name_idx").on(role.name)
|
|
938
1202
|
}));
|
|
939
1203
|
}
|
|
940
1204
|
__name(getRolesSchema, "getRolesSchema");
|
|
941
1205
|
function getRolesRelationsSchema(mysqlTable) {
|
|
942
1206
|
const roles = getRolesSchema(mysqlTable);
|
|
943
1207
|
const userRoles = getUserRolesSchema(mysqlTable);
|
|
944
|
-
return
|
|
1208
|
+
return relations17(roles, ({ many }) => ({
|
|
945
1209
|
userRoles: many(userRoles, {
|
|
946
1210
|
relationName: "role"
|
|
947
1211
|
})
|
|
@@ -952,34 +1216,34 @@ __name(getRolesRelationsSchema, "getRolesRelationsSchema");
|
|
|
952
1216
|
// src/lib/mysql/schemas/auth/user-roles.ts
|
|
953
1217
|
function getUserRolesSchema(mysqlTable) {
|
|
954
1218
|
return mysqlTable("UserRole", {
|
|
955
|
-
userId:
|
|
1219
|
+
userId: varchar18("userId", {
|
|
956
1220
|
length: 255
|
|
957
1221
|
}).notNull(),
|
|
958
|
-
roleId:
|
|
1222
|
+
roleId: varchar18("roleId", {
|
|
959
1223
|
length: 255
|
|
960
1224
|
}).notNull(),
|
|
961
1225
|
active: boolean5("active").notNull().default(true),
|
|
962
|
-
createdAt:
|
|
1226
|
+
createdAt: timestamp17("createdAt", {
|
|
963
1227
|
mode: "date",
|
|
964
1228
|
fsp: 3
|
|
965
1229
|
}).defaultNow(),
|
|
966
|
-
updatedAt:
|
|
1230
|
+
updatedAt: timestamp17("updatedAt", {
|
|
967
1231
|
mode: "date",
|
|
968
1232
|
fsp: 3
|
|
969
1233
|
}).defaultNow(),
|
|
970
|
-
deletedAt:
|
|
1234
|
+
deletedAt: timestamp17("deletedAt", {
|
|
971
1235
|
mode: "date",
|
|
972
1236
|
fsp: 3
|
|
973
1237
|
})
|
|
974
1238
|
}, (ur) => ({
|
|
975
|
-
pk:
|
|
1239
|
+
pk: primaryKey13({
|
|
976
1240
|
columns: [
|
|
977
1241
|
ur.userId,
|
|
978
1242
|
ur.roleId
|
|
979
1243
|
]
|
|
980
1244
|
}),
|
|
981
|
-
userIdIdx:
|
|
982
|
-
roleIdIdx:
|
|
1245
|
+
userIdIdx: index16("userId_idx").on(ur.userId),
|
|
1246
|
+
roleIdIdx: index16("roleId_idx").on(ur.roleId)
|
|
983
1247
|
}));
|
|
984
1248
|
}
|
|
985
1249
|
__name(getUserRolesSchema, "getUserRolesSchema");
|
|
@@ -987,7 +1251,7 @@ function getUserRolesRelationsSchema(mysqlTable) {
|
|
|
987
1251
|
const userRoles = getUserRolesSchema(mysqlTable);
|
|
988
1252
|
const users = getUsersSchema(mysqlTable);
|
|
989
1253
|
const roles = getRolesSchema(mysqlTable);
|
|
990
|
-
return
|
|
1254
|
+
return relations18(userRoles, ({ one }) => ({
|
|
991
1255
|
user: one(users, {
|
|
992
1256
|
fields: [
|
|
993
1257
|
userRoles.userId
|
|
@@ -1013,34 +1277,34 @@ __name(getUserRolesRelationsSchema, "getUserRolesRelationsSchema");
|
|
|
1013
1277
|
// src/lib/mysql/schemas/auth/users.ts
|
|
1014
1278
|
function getUsersSchema(mysqlTable) {
|
|
1015
1279
|
return mysqlTable("User", {
|
|
1016
|
-
id:
|
|
1280
|
+
id: varchar19("id", {
|
|
1017
1281
|
length: 255
|
|
1018
1282
|
}).notNull().primaryKey(),
|
|
1019
|
-
name:
|
|
1283
|
+
name: varchar19("name", {
|
|
1020
1284
|
length: 255
|
|
1021
1285
|
}),
|
|
1022
|
-
role:
|
|
1286
|
+
role: varchar19("role", {
|
|
1023
1287
|
length: 191
|
|
1024
1288
|
}).notNull().default("user"),
|
|
1025
|
-
email:
|
|
1289
|
+
email: varchar19("email", {
|
|
1026
1290
|
length: 255
|
|
1027
1291
|
}).notNull().unique(),
|
|
1028
|
-
fields:
|
|
1029
|
-
emailVerified:
|
|
1292
|
+
fields: json13("fields").$type().default({}),
|
|
1293
|
+
emailVerified: timestamp18("emailVerified", {
|
|
1030
1294
|
mode: "date",
|
|
1031
1295
|
fsp: 3
|
|
1032
1296
|
}),
|
|
1033
|
-
image:
|
|
1297
|
+
image: varchar19("image", {
|
|
1034
1298
|
length: 255
|
|
1035
1299
|
}),
|
|
1036
|
-
createdAt:
|
|
1300
|
+
createdAt: timestamp18("createdAt", {
|
|
1037
1301
|
mode: "date",
|
|
1038
1302
|
fsp: 3
|
|
1039
|
-
}).default(
|
|
1303
|
+
}).default(sql14`CURRENT_TIMESTAMP(3)`)
|
|
1040
1304
|
}, (user) => ({
|
|
1041
|
-
emailIdx:
|
|
1042
|
-
roleIdx:
|
|
1043
|
-
createdAtIdx:
|
|
1305
|
+
emailIdx: index17("email_idx").on(user.email),
|
|
1306
|
+
roleIdx: index17("role_idx").on(user.role),
|
|
1307
|
+
createdAtIdx: index17("created_at_idx").on(user.createdAt)
|
|
1044
1308
|
}));
|
|
1045
1309
|
}
|
|
1046
1310
|
__name(getUsersSchema, "getUsersSchema");
|
|
@@ -1055,7 +1319,7 @@ function getUsersRelationsSchema(mysqlTable) {
|
|
|
1055
1319
|
const purchases = getPurchaseSchema(mysqlTable);
|
|
1056
1320
|
const comments = getCommentsSchema(mysqlTable);
|
|
1057
1321
|
const userPrefs = getUserPrefsSchema(mysqlTable);
|
|
1058
|
-
return
|
|
1322
|
+
return relations19(users, ({ many }) => ({
|
|
1059
1323
|
accounts: many(accounts, {
|
|
1060
1324
|
relationName: "user"
|
|
1061
1325
|
}),
|
|
@@ -1090,35 +1354,35 @@ __name(getUsersRelationsSchema, "getUsersRelationsSchema");
|
|
|
1090
1354
|
// src/lib/mysql/schemas/content/content-contributions.ts
|
|
1091
1355
|
function getContentContributionsSchema(mysqlTable) {
|
|
1092
1356
|
return mysqlTable("ContentContribution", {
|
|
1093
|
-
id:
|
|
1357
|
+
id: varchar20("id", {
|
|
1094
1358
|
length: 255
|
|
1095
1359
|
}).notNull().primaryKey(),
|
|
1096
|
-
userId:
|
|
1360
|
+
userId: varchar20("userId", {
|
|
1097
1361
|
length: 255
|
|
1098
1362
|
}).notNull(),
|
|
1099
|
-
contentId:
|
|
1363
|
+
contentId: varchar20("contentId", {
|
|
1100
1364
|
length: 255
|
|
1101
1365
|
}).notNull(),
|
|
1102
|
-
contributionTypeId:
|
|
1366
|
+
contributionTypeId: varchar20("contributionTypeId", {
|
|
1103
1367
|
length: 255
|
|
1104
1368
|
}).notNull(),
|
|
1105
1369
|
active: boolean6("active").notNull().default(true),
|
|
1106
|
-
createdAt:
|
|
1370
|
+
createdAt: timestamp19("createdAt", {
|
|
1107
1371
|
mode: "date",
|
|
1108
1372
|
fsp: 3
|
|
1109
1373
|
}).defaultNow(),
|
|
1110
|
-
updatedAt:
|
|
1374
|
+
updatedAt: timestamp19("updatedAt", {
|
|
1111
1375
|
mode: "date",
|
|
1112
1376
|
fsp: 3
|
|
1113
1377
|
}).defaultNow(),
|
|
1114
|
-
deletedAt:
|
|
1378
|
+
deletedAt: timestamp19("deletedAt", {
|
|
1115
1379
|
mode: "date",
|
|
1116
1380
|
fsp: 3
|
|
1117
1381
|
})
|
|
1118
1382
|
}, (cc) => ({
|
|
1119
|
-
userIdIdx:
|
|
1120
|
-
contentIdIdx:
|
|
1121
|
-
contributionTypeIdIdx:
|
|
1383
|
+
userIdIdx: index18("userId_idx").on(cc.userId),
|
|
1384
|
+
contentIdIdx: index18("contentId_idx").on(cc.contentId),
|
|
1385
|
+
contributionTypeIdIdx: index18("contributionTypeId_idx").on(cc.contributionTypeId)
|
|
1122
1386
|
}));
|
|
1123
1387
|
}
|
|
1124
1388
|
__name(getContentContributionsSchema, "getContentContributionsSchema");
|
|
@@ -1127,7 +1391,7 @@ function getContentContributionRelationsSchema(mysqlTable) {
|
|
|
1127
1391
|
const users = getUsersSchema(mysqlTable);
|
|
1128
1392
|
const contentResource = getContentResourceSchema(mysqlTable);
|
|
1129
1393
|
const contributionTypes = getContributionTypesSchema(mysqlTable);
|
|
1130
|
-
return
|
|
1394
|
+
return relations20(contentContributions, ({ one }) => ({
|
|
1131
1395
|
user: one(users, {
|
|
1132
1396
|
fields: [
|
|
1133
1397
|
contentContributions.userId
|
|
@@ -1164,6 +1428,14 @@ export {
|
|
|
1164
1428
|
getContentContributionRelationsSchema,
|
|
1165
1429
|
getContentResourceResourceSchema,
|
|
1166
1430
|
getContentResourceResourceRelationsSchema,
|
|
1431
|
+
getTagTagSchema,
|
|
1432
|
+
getTagTagRelationsSchema,
|
|
1433
|
+
getTagSchema,
|
|
1434
|
+
getTagRelationsSchema,
|
|
1435
|
+
getContentResourceTagSchema,
|
|
1436
|
+
getContentResourceTagRelationsSchema,
|
|
1437
|
+
getContentResourceVersionSchema,
|
|
1438
|
+
getContentResourceVersionRelationsSchema,
|
|
1167
1439
|
getContentResourceSchema,
|
|
1168
1440
|
getContentResourceRelationsSchema,
|
|
1169
1441
|
getContentResourceProductSchema,
|
|
@@ -1193,4 +1465,4 @@ export {
|
|
|
1193
1465
|
getAccountsSchema,
|
|
1194
1466
|
getAccountsRelationsSchema
|
|
1195
1467
|
};
|
|
1196
|
-
//# sourceMappingURL=chunk-
|
|
1468
|
+
//# sourceMappingURL=chunk-JW2PFVLO.js.map
|