@data-fair/lib-node 2.1.0 → 2.1.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/mongo.js +3 -1
- package/package.json +1 -1
- package/upgrade-scripts.js +5 -2
package/mongo.js
CHANGED
|
@@ -47,7 +47,9 @@ export class Mongo {
|
|
|
47
47
|
let key, options
|
|
48
48
|
const indexDefinition = indexDefinitions[collectionName][indexName]
|
|
49
49
|
if (indexDefinition === null) {
|
|
50
|
-
await this.db.collection(collectionName).
|
|
50
|
+
if (await this.db.collection(collectionName).indexExists(indexName)) {
|
|
51
|
+
await this.db.collection(collectionName).dropIndex(indexName)
|
|
52
|
+
}
|
|
51
53
|
continue
|
|
52
54
|
} else if (Array.isArray(indexDefinition)) {
|
|
53
55
|
[key, options] = indexDefinition
|
package/package.json
CHANGED
package/upgrade-scripts.js
CHANGED
|
@@ -14,8 +14,11 @@ export default async function (db, locks, basePath = './') {
|
|
|
14
14
|
// containers for the scripts that are running in only 1 (while loop on "acquire" ?) and a healthcheck
|
|
15
15
|
// are not considered "up" and the previous versions keep running in the mean time
|
|
16
16
|
} else {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
try {
|
|
18
|
+
await runScripts(db, basePath)
|
|
19
|
+
} finally {
|
|
20
|
+
await locks.release('upgrade')
|
|
21
|
+
}
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
async function runScripts (db, basePath) {
|