diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-04-11 22:44:04 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-04-11 22:44:04 +0900 |
| commit | 4d688be3df8998cfb89dc45800e15f7cb5a7ea2b (patch) | |
| tree | 1a1de27494d0cf176e39b28fbf91861e3b55af4b /src | |
| parent | Update migrate.ts (diff) | |
| download | sharkey-4d688be3df8998cfb89dc45800e15f7cb5a7ea2b.tar.gz sharkey-4d688be3df8998cfb89dc45800e15f7cb5a7ea2b.tar.bz2 sharkey-4d688be3df8998cfb89dc45800e15f7cb5a7ea2b.zip | |
Update migrate.ts
Diffstat (limited to 'src')
| -rw-r--r-- | src/migrate.ts | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/migrate.ts b/src/migrate.ts index 36ae933773..098dc0d7c3 100644 --- a/src/migrate.ts +++ b/src/migrate.ts @@ -324,10 +324,14 @@ async function main() { }); } - let allUsersCount = await _User.count(); + let allUsersCount = await _User.count({ + deletedAt: { $exists: false } + }); if (test && allUsersCount > limit) allUsersCount = limit; for (let i = 0; i < allUsersCount; i++) { - const user = await _User.findOne({}, { + const user = await _User.findOne({ + deletedAt: { $exists: false } + }, { skip: i }); try { @@ -370,12 +374,14 @@ async function main() { } let allDriveFilesCount = await _DriveFile.count({ - 'metadata._user.host': null + 'metadata._user.host': null, + 'metadata.deletedAt': { $exists: false } }); if (test && allDriveFilesCount > limit) allDriveFilesCount = limit; for (let i = 0; i < allDriveFilesCount; i++) { const file = await _DriveFile.findOne({ - 'metadata._user.host': null + 'metadata._user.host': null, + 'metadata.deletedAt': { $exists: false } }, { skip: i }); @@ -394,12 +400,14 @@ async function main() { } let allNotesCount = await _Note.count({ - '_user.host': null + '_user.host': null, + 'metadata.deletedAt': { $exists: false } }); if (test && allNotesCount > limit) allNotesCount = limit; for (let i = 0; i < allNotesCount; i++) { const note = await _Note.findOne({ - '_user.host': null + '_user.host': null, + 'metadata.deletedAt': { $exists: false } }, { skip: i }); |