Migrations

This commit is contained in:
baruffaldi 2021-02-10 18:12:02 +01:00
parent eb20add0c7
commit 9b83d35ef4
2 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,5 @@
const migrate_name = 'redirection_scheme'; const migrate_name = 'redirection_scheme';
const logger = require('../logger').migrate; const logger = require('../logger').migrate;
/** /**
* Migrate * Migrate
@ -10,16 +10,16 @@ const logger = require('../logger').migrate;
* @param {Promise} Promise * @param {Promise} Promise
* @returns {Promise} * @returns {Promise}
*/ */
exports.up = function (knex, Promise) { exports.up = function (knex/*, Promise*/) {
logger.info('[' + migrate_name + '] Migrating Up...'); logger.info('[' + migrate_name + '] Migrating Up...');
return knex.schema.table('redirection_host', (table) => { return knex.schema.table('redirection_host', (table) => {
table.string('forward_scheme').notNull().defaultTo('$scheme'); table.string('forward_scheme').notNull().defaultTo('$scheme');
}) })
.then(function () { .then(function () {
logger.info('[' + migrate_name + '] redirection_host Table altered'); logger.info('[' + migrate_name + '] redirection_host Table altered');
}); });
}; };
/** /**
@ -29,13 +29,13 @@ exports.up = function (knex, Promise) {
* @param {Promise} Promise * @param {Promise} Promise
* @returns {Promise} * @returns {Promise}
*/ */
exports.down = function (knex, Promise) { exports.down = function (knex/*, Promise*/) {
logger.info('[' + migrate_name + '] Migrating Down...'); logger.info('[' + migrate_name + '] Migrating Down...');
return knex.schema.table('redirection_host', (table) => { return knex.schema.table('redirection_host', (table) => {
table.dropColumn('forward_scheme'); table.dropColumn('forward_scheme');
}) })
.then(function () { .then(function () {
logger.info('[' + migrate_name + '] redirection_host Table altered'); logger.info('[' + migrate_name + '] redirection_host Table altered');
}); });
}; };

View File

@ -10,7 +10,7 @@ const logger = require('../logger').migrate;
* @param {Promise} Promise * @param {Promise} Promise
* @returns {Promise} * @returns {Promise}
*/ */
exports.up = function (knex, Promise) { exports.up = function (knex/*, Promise*/) {
logger.info('[' + migrate_name + '] Migrating Up...'); logger.info('[' + migrate_name + '] Migrating Up...');
@ -29,7 +29,7 @@ exports.up = function (knex, Promise) {
* @param {Promise} Promise * @param {Promise} Promise
* @returns {Promise} * @returns {Promise}
*/ */
exports.down = function (knex, Promise) { exports.down = function (knex/*, Promise*/) {
logger.info('[' + migrate_name + '] Migrating Down...'); logger.info('[' + migrate_name + '] Migrating Down...');
return knex.schema.table('redirection_host', (table) => { return knex.schema.table('redirection_host', (table) => {