[db] fix migration async execution issue

This commit is contained in:
Avris 2021-12-04 22:19:45 +01:00
parent 8bbddf94ff
commit 7735e67f50
1 changed files with 0 additions and 14 deletions

View File

@ -7,17 +7,3 @@ async function migrate() {
}
migrate();
// temporary code for a non-sqlite migration:
const normalise = s => s.trim().toLowerCase();
async function populateUsernameNorm() {
const db = await dbConnection();
for ({id, username} of await db.all(`SELECT id, username FROM users WHERE usernameNorm IS NULL`)) {
const norm = normalise(username); // username is safe, so so will be norm
console.log(username, norm)
await db.all(`UPDATE users SET usernameNorm = '${norm}' WHERE id = '${id}'`);
}
await db.close();
}
populateUsernameNorm();