From 0867c7bbfe60f821129d2bd961c74f668827458a Mon Sep 17 00:00:00 2001 From: Omar Ajoue Date: Wed, 12 May 2021 05:43:24 +0200 Subject: [PATCH] :bug: Fix issue with long credential names in MySQL (#1771) --- .../1620729500000-ChangeCredentialDataSize.ts | 18 ++++++++++++++++++ .../src/databases/mysqldb/migrations/index.ts | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 packages/cli/src/databases/mysqldb/migrations/1620729500000-ChangeCredentialDataSize.ts diff --git a/packages/cli/src/databases/mysqldb/migrations/1620729500000-ChangeCredentialDataSize.ts b/packages/cli/src/databases/mysqldb/migrations/1620729500000-ChangeCredentialDataSize.ts new file mode 100644 index 0000000000..789e1d2172 --- /dev/null +++ b/packages/cli/src/databases/mysqldb/migrations/1620729500000-ChangeCredentialDataSize.ts @@ -0,0 +1,18 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; +import * as config from '../../../../config'; + +export class ChangeCredentialDataSize1620729500000 implements MigrationInterface { + name = 'ChangeCredentialDataSize1620729500000'; + + async up(queryRunner: QueryRunner): Promise { + const tablePrefix = config.get('database.tablePrefix'); + + await queryRunner.query('ALTER TABLE `' + tablePrefix + 'credentials_entity` MODIFY COLUMN `data` MEDIUMTEXT NOT NULL'); + } + + async down(queryRunner: QueryRunner): Promise { + const tablePrefix = config.get('database.tablePrefix'); + + await queryRunner.query('ALTER TABLE `' + tablePrefix + 'credentials_entity` MODIFY COLUMN `data` TEXT NOT NULL'); + } +} diff --git a/packages/cli/src/databases/mysqldb/migrations/index.ts b/packages/cli/src/databases/mysqldb/migrations/index.ts index 08ca45edbf..f5c110fec2 100644 --- a/packages/cli/src/databases/mysqldb/migrations/index.ts +++ b/packages/cli/src/databases/mysqldb/migrations/index.ts @@ -4,6 +4,7 @@ import { CreateIndexStoppedAt1594902918301 } from './1594902918301-CreateIndexSt import { AddWebhookId1611149998770 } from './1611149998770-AddWebhookId'; import { MakeStoppedAtNullable1607431743767 } from './1607431743767-MakeStoppedAtNullable'; import { ChangeDataSize1615306975123 } from './1615306975123-ChangeDataSize'; +import { ChangeCredentialDataSize1620729500000 } from './1620729500000-ChangeCredentialDataSize'; export const mysqlMigrations = [ InitialMigration1588157391238, @@ -12,4 +13,5 @@ export const mysqlMigrations = [ AddWebhookId1611149998770, MakeStoppedAtNullable1607431743767, ChangeDataSize1615306975123, + ChangeCredentialDataSize1620729500000, ];