Files
outline/server/migrations/20260604140753-increase-url-column-lengths.js
T
Tom Moor 1cc10f5fff fix: Increase valid user-supplied URL length to 1024 (#12585)
* fix: Increase valid user-supplied URL length to 1024

* fix: Wrap URL length migration in a transaction

Wrap the multi-column changeColumn operations in a transaction so a
failure on any column rolls back the whole migration rather than leaving
the database partially migrated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 23:30:55 -04:00

107 lines
2.5 KiB
JavaScript

"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.changeColumn(
"webhook_subscriptions",
"url",
{
type: Sequelize.STRING(1024),
allowNull: false,
},
{ transaction }
);
await queryInterface.changeColumn(
"oauth_clients",
"developerUrl",
{
type: Sequelize.STRING(1024),
allowNull: true,
},
{ transaction }
);
await queryInterface.changeColumn(
"oauth_clients",
"avatarUrl",
{
type: Sequelize.STRING(1024),
allowNull: true,
},
{ transaction }
);
await queryInterface.changeColumn(
"oauth_clients",
"redirectUris",
{
type: Sequelize.ARRAY(Sequelize.STRING(1024)),
allowNull: false,
defaultValue: [],
},
{ transaction }
);
await queryInterface.changeColumn(
"oauth_authorization_codes",
"redirectUri",
{
type: Sequelize.STRING(1024),
allowNull: false,
},
{ transaction }
);
});
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.changeColumn(
"oauth_authorization_codes",
"redirectUri",
{
type: Sequelize.STRING(255),
allowNull: false,
},
{ transaction }
);
await queryInterface.changeColumn(
"oauth_clients",
"redirectUris",
{
type: Sequelize.ARRAY(Sequelize.STRING(255)),
allowNull: false,
defaultValue: [],
},
{ transaction }
);
await queryInterface.changeColumn(
"oauth_clients",
"avatarUrl",
{
type: Sequelize.STRING(255),
allowNull: true,
},
{ transaction }
);
await queryInterface.changeColumn(
"oauth_clients",
"developerUrl",
{
type: Sequelize.STRING(255),
allowNull: true,
},
{ transaction }
);
await queryInterface.changeColumn(
"webhook_subscriptions",
"url",
{
type: Sequelize.STRING(255),
allowNull: false,
},
{ transaction }
);
});
},
};