settings keys in DB converted to camel case

callback-based settings model replaced by async-based settings model
This commit is contained in:
Tomas Bures 2017-12-30 17:27:24 +01:00
parent 6c5c47ac2e
commit d8ee364a4b
22 changed files with 123 additions and 143 deletions

View file

@ -0,0 +1,24 @@
"use strict";
function fromDbKey(key) {
let prefix = '';
if (key.startsWith('_')) {
key = key.substring(1);
prefix = '_';
}
return prefix + key.replace(/[_-]([a-z])/g, (m, c) => c.toUpperCase());
}
exports.up = (knex, Promise) => (async() => {
const rows = await knex('settings');
for (const row of rows) {
await knex('settings').where('id', row.id).update('key', fromDbKey(row.key))
}
})();
exports.down = (knex, Promise) => (async() => {
})();