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";
const migrateName = "redirect_auto_scheme";
const migrateName = "trust_forwarded_proto";
/**
* Migrate
@@ -11,8 +11,14 @@ const migrateName = "redirect_auto_scheme";
* @returns {Promise}
*/
const up = function (knex) {
return knex.schema.alterTable('proxy_host', (table) => {
logger.info(`[${migrateName}] Migrating Up...`);
return knex.schema
.alterTable('proxy_host', (table) => {
table.tinyint('trust_forwarded_proto').notNullable().defaultTo(0);
})
.then(() => {
logger.info(`[${migrateName}] proxy_host Table altered`);
});
};
@@ -23,8 +29,14 @@ const up = function (knex) {
* @returns {Promise}
*/
const down = function (knex) {
return knex.schema.alterTable('proxy_host', (table) => {
logger.info(`[${migrateName}] Migrating Down...`);
return knex.schema
.alterTable('proxy_host', (table) => {
table.dropColumn('trust_forwarded_proto');
})
.then(() => {
logger.info(`[${migrateName}] proxy_host Table altered`);
});
};