core: ignore drop index error

This commit is contained in:
undefined committed 2021-08-18 23:06:00 +08:00
1 parent 9b0b8aba61
commit 9037a9bfd3
2 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.32.26",
"version": "2.32.27",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+2 -1
View File
@@ -449,7 +449,8 @@ const scripts: UpgradeScript[] = [
},
async function _40_41() {
const _FRESH_INSTALL_IGNORE = 1;
await db.collection('storage').dropIndex('path_1');
// Ignore drop index failure
await db.collection('storage').dropIndex('path_1').catch(() => { });
await db.collection('storage').createIndex({ path: 1, autoDelete: 1 }, { sparse: true });
await db.collection('storage').updateMany(
{ autoDelete: { $gte: moment().add(5, 'days').toDate() } },