Various fixes.

This commit is contained in:
Tomas Bures 2019-07-23 21:16:55 +05:30
parent 4e4b77ca84
commit 02360be75b
20 changed files with 3137 additions and 3124 deletions

View file

@ -78,7 +78,7 @@ async function migrateBase(knex) {
// The original Mailtrain migration is executed before this one. So here we check whether the original migration
// ended where it should have and we take it from there.
const row = await knex('settings').where({key: 'db_schema_version'}).first('value');
if (!row || Number(row.value) !== 33) {
if (!row || Number(row.value) !== 34) {
throw new Error('Unsupported DB schema version: ' + row.value);
}

View file

@ -1,6 +1,14 @@
exports.up = (knex, Promise) => (async() => {
// This is to provide upgrade path to stable to those that already have beta installed.
await knex.schema.raw('ALTER TABLE `custom_fields` ADD COLUMN `help` text AFTER `name`');
try {
await knex.schema.raw('ALTER TABLE `custom_fields` ADD COLUMN `help` text AFTER `name`');
} catch (err) {
if (err.code === 'ER_DUP_FIELDNAME') {
// The field is already there, so we can ignore this error
} else {
throw err;
}
}
})();
exports.down = (knex, Promise) => (async() => {