fix: reformat migration scripts

This commit is contained in:
jerry-yuan
2026-01-31 13:28:53 +00:00
parent 187d21a0d5
commit 2b6a617599

View File

@@ -1,6 +1,6 @@
import { migrate as logger } from "../logger.js"; import { migrate as logger } from "../logger.js";
const migrateName = "redirect_auto_scheme"; const migrateName = "trust_forwarded_proto";
/** /**
* Migrate * Migrate
@@ -11,9 +11,15 @@ const migrateName = "redirect_auto_scheme";
* @returns {Promise} * @returns {Promise}
*/ */
const up = function (knex) { const up = function (knex) {
return knex.schema.alterTable('proxy_host', (table) => { logger.info(`[${migrateName}] Migrating Up...`);
table.tinyint('trust_forwarded_proto').notNullable().defaultTo(0);
}); return knex.schema
.alterTable('proxy_host', (table) => {
table.tinyint('trust_forwarded_proto').notNullable().defaultTo(0);
})
.then(() => {
logger.info(`[${migrateName}] proxy_host Table altered`);
});
}; };
/** /**
@@ -23,9 +29,15 @@ const up = function (knex) {
* @returns {Promise} * @returns {Promise}
*/ */
const down = function (knex) { const down = function (knex) {
return knex.schema.alterTable('proxy_host', (table) => { logger.info(`[${migrateName}] Migrating Down...`);
table.dropColumn('trust_forwarded_proto');
}); return knex.schema
.alterTable('proxy_host', (table) => {
table.dropColumn('trust_forwarded_proto');
})
.then(() => {
logger.info(`[${migrateName}] proxy_host Table altered`);
});
}; };
export { up, down }; export { up, down };