Update migrate.ts
This commit is contained in:
parent
4d688be3df
commit
d4ad36fa41
1 changed files with 2 additions and 6 deletions
|
@ -162,6 +162,7 @@ async function main() {
|
||||||
const user = await _User.findOne({
|
const user = await _User.findOne({
|
||||||
_id: file.metadata.userId
|
_id: file.metadata.userId
|
||||||
});
|
});
|
||||||
|
if (user == null) return;
|
||||||
if (file.metadata.storage && file.metadata.storage.key) { // when object storage
|
if (file.metadata.storage && file.metadata.storage.key) { // when object storage
|
||||||
await DriveFiles.save({
|
await DriveFiles.save({
|
||||||
id: file._id.toHexString(),
|
id: file._id.toHexString(),
|
||||||
|
@ -386,12 +387,7 @@ async function main() {
|
||||||
skip: i
|
skip: i
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
try {
|
await migrateDriveFile(file);
|
||||||
await migrateDriveFile(file);
|
|
||||||
} catch (_) {
|
|
||||||
file.folderId = null;
|
|
||||||
await migrateDriveFile(file);
|
|
||||||
}
|
|
||||||
console.log(`FILE (${i + 1}/${allDriveFilesCount}) ${file._id} ${chalk.green('DONE')}`);
|
console.log(`FILE (${i + 1}/${allDriveFilesCount}) ${file._id} ${chalk.green('DONE')}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(`FILE (${i + 1}/${allDriveFilesCount}) ${file._id} ${chalk.red('ERR')}`);
|
console.log(`FILE (${i + 1}/${allDriveFilesCount}) ${file._id} ${chalk.red('ERR')}`);
|
||||||
|
|
Loading…
Reference in a new issue