Fix db migration

This commit is contained in:
Kevin Thomas
2022-08-31 15:37:04 -07:00
parent 4d22dab887
commit 66b23f39a6

View File

@@ -88,25 +88,15 @@ module.exports = function () {
} }
if (userVersion < 4) { if (userVersion < 4) {
db.all('SELECT preferences FROM users', (err, rows) => { db.run('UPDATE users SET preferences = ? WHERE preferences = ?',
if (err) { ['{"accentColor":{"alpha":1,"hex":"#607D8B","hexa":"#607D8BFF","hsla":{"h":200,"s":18,"l":46,"a":1},"hsva":{"h":200,"s":31,"v":55,"a":1},"hue":200,"rgba":{"r":96,"g":125,"b":139,"a":1}}}', '{}'],
logger.error(err) (err) => {
} else { if (err) {
rows.forEach(row => { logger.error(err)
if (row.preferences === '{}') { } else {
db.run('UPDATE users SET preferences = ?', db.run('PRAGMA user_version = 4')
['{"accentColor":{"alpha":1,"hex":"#607D8B","hexa":"#607D8BFF","hsla":{"h":200,"s":18,"l":46,"a":1},"hsva":{"h":200,"s":31,"v":55,"a":1},"hue":200,"rgba":{"r":96,"g":125,"b":139,"a":1}}}'], }
(err) => { })
if (err) {
logger.error(err)
}
})
}
})
db.run('PRAGMA user_version = 4')
}
})
} }
}) })
} }