mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-26 11:57:34 -07:00
Update migrate.ts
This commit is contained in:
parent
a7d54b347a
commit
288161c1ed
1 changed files with 14 additions and 6 deletions
|
@ -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;
|
if (test && allUsersCount > limit) allUsersCount = limit;
|
||||||
for (let i = 0; i < allUsersCount; i++) {
|
for (let i = 0; i < allUsersCount; i++) {
|
||||||
const user = await _User.findOne({}, {
|
const user = await _User.findOne({
|
||||||
|
deletedAt: { $exists: false }
|
||||||
|
}, {
|
||||||
skip: i
|
skip: i
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
|
@ -370,12 +374,14 @@ async function main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
let allDriveFilesCount = await _DriveFile.count({
|
let allDriveFilesCount = await _DriveFile.count({
|
||||||
'metadata._user.host': null
|
'metadata._user.host': null,
|
||||||
|
'metadata.deletedAt': { $exists: false }
|
||||||
});
|
});
|
||||||
if (test && allDriveFilesCount > limit) allDriveFilesCount = limit;
|
if (test && allDriveFilesCount > limit) allDriveFilesCount = limit;
|
||||||
for (let i = 0; i < allDriveFilesCount; i++) {
|
for (let i = 0; i < allDriveFilesCount; i++) {
|
||||||
const file = await _DriveFile.findOne({
|
const file = await _DriveFile.findOne({
|
||||||
'metadata._user.host': null
|
'metadata._user.host': null,
|
||||||
|
'metadata.deletedAt': { $exists: false }
|
||||||
}, {
|
}, {
|
||||||
skip: i
|
skip: i
|
||||||
});
|
});
|
||||||
|
@ -394,12 +400,14 @@ async function main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
let allNotesCount = await _Note.count({
|
let allNotesCount = await _Note.count({
|
||||||
'_user.host': null
|
'_user.host': null,
|
||||||
|
'metadata.deletedAt': { $exists: false }
|
||||||
});
|
});
|
||||||
if (test && allNotesCount > limit) allNotesCount = limit;
|
if (test && allNotesCount > limit) allNotesCount = limit;
|
||||||
for (let i = 0; i < allNotesCount; i++) {
|
for (let i = 0; i < allNotesCount; i++) {
|
||||||
const note = await _Note.findOne({
|
const note = await _Note.findOne({
|
||||||
'_user.host': null
|
'_user.host': null,
|
||||||
|
'metadata.deletedAt': { $exists: false }
|
||||||
}, {
|
}, {
|
||||||
skip: i
|
skip: i
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue