Update refresh_state table column for mysql databases

Signed-off-by: kapaje <enri.kapaj@sisal.al>
This commit is contained in:
kapaje
2025-04-01 22:51:04 +02:00
parent 20413a0716
commit 0e710fc837
2 changed files with 49 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/plugin-catalog-backend': patch
---
This patch addresses an issue identified in Backstage when configured with a MySQL database. If an entity of type location
(e..all.yaml) has more than 70 referenced entities, clicking "Refresh" does not update the referenced entities as expected. This occurs because the TEXT type in MySQL has a limit of 65,535 bytes, which is insufficient to store all the referenced entities, causing the refresh operation to fail.
@@ -0,0 +1,43 @@
/*
* Copyright 2024 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @param {import('knex').Knex} knex
* @returns {Promise<void>}
*/
exports.up = async function up(knex) {
const isMySQL = knex.client.config.client.includes('mysql');
// update the columns to longtext for MySQL
if (isMySQL) {
await knex.schema.alterTable('refresh_state', table => {
table.text('unprocessed_entity', 'longtext').alter();
table.text('cache', 'longtext').alter();
});
}
};
/**
* @param {import('knex').Knex} knex
* @returns {Promise<void>}
*/
exports.down = async function down(knex) {
const isMySQL = knex.client.config.client.includes('mysql');
if (isMySQL) {
await knex.schema.alterTable('refresh_state', table => {
table.text('unprocessed_entity').alter();
table.text('cache').alter();
});
}
};