@dnax/core 0.19.1 → 0.19.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.
Files changed (2) hide show
  1. package/lib/collection.ts +14 -1
  2. package/package.json +1 -1
package/lib/collection.ts CHANGED
@@ -71,6 +71,7 @@ async function syncCollectionDatabase() {
71
71
 
72
72
  if (collections?.length) {
73
73
  for await (let c of collections) {
74
+ // boucle sur les collections
74
75
  //console.log(c?.slug,c.init)
75
76
  if (c?.init && typeof c?.init == "function") {
76
77
  await c?.init({
@@ -92,7 +93,7 @@ async function syncCollectionDatabase() {
92
93
  }
93
94
 
94
95
  // suppression auto Removes des indexes
95
- if (c?.autoRemoveIndexes?.length && c?.autoRemoveIndexes) {
96
+ if (c?.autoRemoveIndexes?.length) {
96
97
  for await (let index of c?.autoRemoveIndexes || []) {
97
98
  await t.database?.db
98
99
  ?.collection(c.slug)
@@ -147,6 +148,18 @@ async function syncCollectionDatabase() {
147
148
  }
148
149
  });
149
150
 
151
+ // suppression d'index
152
+ c?.fields?.map((f) => {
153
+ if (f?.unique === false) {
154
+ t.database.db
155
+ ?.collection(c.slug)
156
+ .dropIndex(f.name)
157
+ .catch((err) => {
158
+ //console.error(err);
159
+ });
160
+ }
161
+ });
162
+
150
163
  // 3- Creation des indexes par indexes array
151
164
  for await (let index of c?.indexes || []) {
152
165
  let indexHasAlready = allIndexes?.find((el) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {