Migrations hotfix

This commit is contained in:
baruffaldi 2021-02-10 17:16:33 +01:00
parent 1f122e9145
commit eb20add0c7
2 changed files with 18 additions and 34 deletions

View File

@ -1,5 +1,5 @@
const migrate_name = 'redirection_scheme';
const logger = require('../logger').migrate;
const logger = require('../logger').migrate;
/**
* Migrate
@ -15,15 +15,11 @@ exports.up = function (knex, Promise) {
logger.info('[' + migrate_name + '] Migrating Up...');
return knex.schema.table('redirection_host', (table) => {
table.string('forward_scheme').notNull().defaultTo("$scheme");
})
.then(function () {
table.string('forward_scheme').notNull().defaultTo('$scheme');
})
.then(function () {
logger.info('[' + migrate_name + '] redirection_host Table altered');
});
logger.info('[' + migrate_name + '] Migrating Up Complete');
return Promise.resolve(true);
});
};
/**
@ -37,13 +33,9 @@ exports.down = function (knex, Promise) {
logger.info('[' + migrate_name + '] Migrating Down...');
return knex.schema.table('redirection_host', (table) => {
table.dropColumn('forward_scheme');
})
.then(function () {
table.dropColumn('forward_scheme');
})
.then(function () {
logger.info('[' + migrate_name + '] redirection_host Table altered');
});
logger.info('[' + migrate_name + '] Migrating Down Complete');
return Promise.resolve(true);
});
};

View File

@ -1,5 +1,5 @@
const migrate_name = 'redirection_status_code';
const logger = require('../logger').migrate;
const logger = require('../logger').migrate;
/**
* Migrate
@ -15,15 +15,11 @@ exports.up = function (knex, Promise) {
logger.info('[' + migrate_name + '] Migrating Up...');
return knex.schema.table('redirection_host', (table) => {
table.integer('forward_http_code').notNull().unsigned().defaultTo(302);
})
.then(function () {
table.integer('forward_http_code').notNull().unsigned().defaultTo(302);
})
.then(function () {
logger.info('[' + migrate_name + '] redirection_host Table altered');
});
logger.info('[' + migrate_name + '] Migrating Up Complete');
return Promise.resolve(true);
});
};
/**
@ -37,13 +33,9 @@ exports.down = function (knex, Promise) {
logger.info('[' + migrate_name + '] Migrating Down...');
return knex.schema.table('redirection_host', (table) => {
table.dropColumn('forward_http_code');
})
.then(function () {
table.dropColumn('forward_http_code');
})
.then(function () {
logger.info('[' + migrate_name + '] redirection_host Table altered');
});
logger.info('[' + migrate_name + '] Migrating Down Complete');
return Promise.resolve(true);
});
};