diff --git a/src/migrations/AccountImageMigration.ts b/src/migrations/AccountImageMigration.ts index 14ffd31..c0df6ec 100644 --- a/src/migrations/AccountImageMigration.ts +++ b/src/migrations/AccountImageMigration.ts @@ -15,6 +15,8 @@ import { pathUserData } from "../utils/UserDataUtils"; import { readdirSync, readFileSync } from "fs"; import { AccountImageVisibilityLevel } from "../entities/User"; +import { DatabaseHelper } from "../helpers/DatabaseHelper"; +import { USER_TABLE } from "../helpers/AccountHelper"; const AVATARS_PATH = "avatars/"; const AVATARS_ADDRESSES_FILES = "avatars/adresse_avatars/"; @@ -51,6 +53,16 @@ export async function accountImageMigration() { const newPath = AVATARS_PATH + fileContent; console.info("User " + userID + "\tAccount image: " + newPath); + + await DatabaseHelper.UpdateRows({ + table: USER_TABLE, + where: { + ID: userID + }, + set: { + account_image_path: newPath + } + }) } // Account image visibility @@ -58,6 +70,17 @@ export async function accountImageMigration() { const newVisibililty = VisibilityLevelsMap[Number(fileContent)]; console.info("User " + userID + "\tVisibility: " + newVisibililty); + + + await DatabaseHelper.UpdateRows({ + table: USER_TABLE, + where: { + ID: userID + }, + set: { + account_image_visibility: newVisibililty + } + }) } } } \ No newline at end of file