mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-15 05:05:42 +01:00
Update migrate.ts
This commit is contained in:
parent
46b78cb4ff
commit
d2b75f3501
1 changed files with 12 additions and 8 deletions
|
@ -302,13 +302,13 @@ async function main() {
|
||||||
const u = await _User.findOne({
|
const u = await _User.findOne({
|
||||||
_id: new mongo.ObjectId(user.id)
|
_id: new mongo.ObjectId(user.id)
|
||||||
});
|
});
|
||||||
const avatar = await DriveFiles.findOne(u.avatarId.toHexString());
|
const avatar = u.avatarId ? await DriveFiles.findOne(u.avatarId.toHexString()) : null;
|
||||||
const banner = await DriveFiles.findOne(u.bannerId.toHexString());
|
const banner = u.bannerId ? await DriveFiles.findOne(u.bannerId.toHexString()) : null;
|
||||||
await Users.update(user.id, {
|
await Users.update(user.id, {
|
||||||
avatarId: avatar.id,
|
avatarId: avatar ? avatar.id : null,
|
||||||
bannerId: banner.id,
|
bannerId: banner ? banner.id : null,
|
||||||
avatarUrl: avatar.url,
|
avatarUrl: avatar ? avatar.url : null,
|
||||||
bannerUrl: banner.url
|
bannerUrl: banner ? banner.url : null
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,10 +369,14 @@ async function main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let allDriveFilesCount = await _DriveFile.count();
|
let allDriveFilesCount = await _DriveFile.count({
|
||||||
|
'metadata._user.host': null
|
||||||
|
});
|
||||||
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
|
||||||
|
}, {
|
||||||
skip: i
|
skip: i
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue