Hotfix crash when starting due to cleanup

pull/5/head
trivernis 5 years ago
parent ee60508953
commit b4aaba79ce

@ -79,6 +79,7 @@ namespace dataaccess {
* - deletes all media entries without associations * - deletes all media entries without associations
*/ */
async function databaseCleanup() { async function databaseCleanup() {
try {
const allMedia = await models.Media const allMedia = await models.Media
.findAll({include: [models.Post, models.User, models.Group]}) as models.Media[]; .findAll({include: [models.Post, models.User, models.Group]}) as models.Media[];
for (const media of allMedia) { for (const media of allMedia) {
@ -86,6 +87,10 @@ namespace dataaccess {
await media.destroy(); await media.destroy();
} }
} }
} catch (err) {
globals.logger.error(err.message);
globals.logger.debug(err.stack);
}
} }
/** /**

Loading…
Cancel
Save