@easy-cms/drizzle 0.44.0 → 0.45.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/index.js +10 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -387,7 +387,12 @@ function buildTable(builder, name, kind, fields, options) {
|
|
|
387
387
|
}
|
|
388
388
|
);
|
|
389
389
|
if (topLevel && kind === "root" && (field.unique || field.type === "slug") && field.uniqueWithin !== void 0) {
|
|
390
|
-
|
|
390
|
+
const within = [field.uniqueWithin].flat().map(snake);
|
|
391
|
+
indexes.push({
|
|
392
|
+
column,
|
|
393
|
+
unique: true,
|
|
394
|
+
within: within.length === 1 ? within[0] : within
|
|
395
|
+
});
|
|
391
396
|
indexes.push({ column, unique: false });
|
|
392
397
|
} else if (topLevel && kind === "root" && (field.unique || field.type === "slug")) {
|
|
393
398
|
indexes.push({ column, unique: true });
|
|
@@ -404,8 +409,10 @@ function buildTable(builder, name, kind, fields, options) {
|
|
|
404
409
|
columns,
|
|
405
410
|
(t) => indexes.map(({ column, unique, within }) => {
|
|
406
411
|
const col3 = t[column];
|
|
407
|
-
if (within)
|
|
408
|
-
|
|
412
|
+
if (within) {
|
|
413
|
+
const columns2 = [within].flat();
|
|
414
|
+
return dialect.uniqueIndex(`${name}_${columns2.join("_")}_${column}_unique`).on(...columns2.map((w) => t[w]), col3);
|
|
415
|
+
}
|
|
409
416
|
return unique ? dialect.uniqueIndex(`${name}_${column}_unique`).on(col3) : dialect.index(`${name}_${column}_idx`).on(col3);
|
|
410
417
|
})
|
|
411
418
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easy-cms/drizzle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "Shared Drizzle ORM layer for Easy CMS database adapters",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"drizzle-orm": "0.45.3"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@easy-cms/core": "^0.
|
|
26
|
+
"@easy-cms/core": "^0.45.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@easy-cms/core": "^0.
|
|
29
|
+
"@easy-cms/core": "^0.45.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|