mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
Database migrations created
This commit is contained in:
parent
329d0ecaed
commit
1f122e9145
49
backend/migrations/20210210154702_redirection_scheme.js
Normal file
49
backend/migrations/20210210154702_redirection_scheme.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
const migrate_name = 'redirection_scheme';
|
||||||
|
const logger = require('../logger').migrate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate
|
||||||
|
*
|
||||||
|
* @see http://knexjs.org/#Schema
|
||||||
|
*
|
||||||
|
* @param {Object} knex
|
||||||
|
* @param {Promise} Promise
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
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 () {
|
||||||
|
logger.info('[' + migrate_name + '] redirection_host Table altered');
|
||||||
|
});
|
||||||
|
|
||||||
|
logger.info('[' + migrate_name + '] Migrating Up Complete');
|
||||||
|
|
||||||
|
return Promise.resolve(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undo Migrate
|
||||||
|
*
|
||||||
|
* @param {Object} knex
|
||||||
|
* @param {Promise} Promise
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
exports.down = function (knex, Promise) {
|
||||||
|
logger.info('[' + migrate_name + '] Migrating Down...');
|
||||||
|
|
||||||
|
return knex.schema.table('redirection_host', (table) => {
|
||||||
|
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);
|
||||||
|
};
|
49
backend/migrations/20210210154703_redirection_status_code.js
Normal file
49
backend/migrations/20210210154703_redirection_status_code.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
const migrate_name = 'redirection_status_code';
|
||||||
|
const logger = require('../logger').migrate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate
|
||||||
|
*
|
||||||
|
* @see http://knexjs.org/#Schema
|
||||||
|
*
|
||||||
|
* @param {Object} knex
|
||||||
|
* @param {Promise} Promise
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
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 () {
|
||||||
|
logger.info('[' + migrate_name + '] redirection_host Table altered');
|
||||||
|
});
|
||||||
|
|
||||||
|
logger.info('[' + migrate_name + '] Migrating Up Complete');
|
||||||
|
|
||||||
|
return Promise.resolve(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undo Migrate
|
||||||
|
*
|
||||||
|
* @param {Object} knex
|
||||||
|
* @param {Promise} Promise
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
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 () {
|
||||||
|
logger.info('[' + migrate_name + '] redirection_host Table altered');
|
||||||
|
});
|
||||||
|
|
||||||
|
logger.info('[' + migrate_name + '] Migrating Down Complete');
|
||||||
|
|
||||||
|
return Promise.resolve(true);
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user