mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: remove problem_copy
This commit is contained in:
1 parent
2e600b92e5
commit
1bf6fcd423
10 files changed
+114
-70
No files matched your search
@@ -132,6 +132,19 @@ const scripts: UpgradeScript[] = [
|
||||
logger.success('Files copied successfully. You can now remove collection `file` `fs.files` `fs.chunks` in the database.');
|
||||
return true;
|
||||
},
|
||||
async function _4_5() {
|
||||
const domains = await domain.getMulti().project({ _id: 1 }).toArray();
|
||||
for (const d of domains) {
|
||||
const bulk = document.coll.initializeUnorderedBulkOp();
|
||||
const pdocs = await document.getMulti(d._id, document.TYPE_PROBLEM).project({ domainId: 1, docId: 1 }).toArray();
|
||||
for (const pdoc of pdocs) {
|
||||
const data = await storage.list(`problem/${pdoc.domainId}/${pdoc.docId}/testdata/`, true);
|
||||
bulk.find({ _id: pdoc._id }).updateOne({ $set: { data } });
|
||||
}
|
||||
if (bulk.length) await bulk.execute();
|
||||
}
|
||||
return true;
|
||||
},
|
||||
];
|
||||
|
||||
export = scripts;
|
||||
Reference in new issue
Block a user