diff --git a/packages/cli/src/databases/migrations/mysqldb/1690000000030-SeparateExecutionData.ts b/packages/cli/src/databases/migrations/mysqldb/1690000000030-SeparateExecutionData.ts index 7bf58e9c7d0f1..cb56cf7b63e11 100644 --- a/packages/cli/src/databases/migrations/mysqldb/1690000000030-SeparateExecutionData.ts +++ b/packages/cli/src/databases/migrations/mysqldb/1690000000030-SeparateExecutionData.ts @@ -6,7 +6,7 @@ export class SeparateExecutionData1690000000030 implements ReversibleMigration { `CREATE TABLE ${tablePrefix}execution_data ( executionId int(11) NOT NULL primary key, workflowData json NOT NULL, - data TEXT NOT NULL, + data MEDIUMTEXT NOT NULL, CONSTRAINT \`${tablePrefix}execution_data_FK\` FOREIGN KEY (\`executionId\`) REFERENCES \`${tablePrefix}execution_entity\` (\`id\`) ON DELETE CASCADE ) ENGINE=InnoDB`, @@ -30,7 +30,7 @@ export class SeparateExecutionData1690000000030 implements ReversibleMigration { await queryRunner.query( `ALTER TABLE ${tablePrefix}execution_entity ADD workflowData json NULL, - ADD data text NULL`, + ADD data MEDIUMTEXT NULL`, ); await queryRunner.query( diff --git a/packages/cli/src/databases/migrations/mysqldb/1690000000031-FixExecutionDataType.ts b/packages/cli/src/databases/migrations/mysqldb/1690000000031-FixExecutionDataType.ts new file mode 100644 index 0000000000000..7107eaec1363d --- /dev/null +++ b/packages/cli/src/databases/migrations/mysqldb/1690000000031-FixExecutionDataType.ts @@ -0,0 +1,17 @@ +import type { MigrationContext, IrreversibleMigration } from '@db/types'; + +export class FixExecutionDataType1690000000031 implements IrreversibleMigration { + async up({ queryRunner, tablePrefix }: MigrationContext) { + /** + * SeparateExecutionData migration for MySQL/MariaDB accidentally changed the data-type for `data` column to `TEXT`. + * This migration changes it back. + * The previous migration has been patched to avoid converting to `TEXT`, which might fail. + * + * For any users who already ran the previous migration, this migration should fix the column type. + * For any users who run these migrations in the same batch, this migration would be no-op, as the column type is already `MEDIUMTEXT` + */ + await queryRunner.query( + 'ALTER TABLE `' + tablePrefix + 'execution_data` MODIFY COLUMN `data` MEDIUMTEXT', + ); + } +} diff --git a/packages/cli/src/databases/migrations/mysqldb/index.ts b/packages/cli/src/databases/migrations/mysqldb/index.ts index c8a0d39cd7a0d..18e666a1454e2 100644 --- a/packages/cli/src/databases/migrations/mysqldb/index.ts +++ b/packages/cli/src/databases/migrations/mysqldb/index.ts @@ -40,6 +40,7 @@ import { CreateVariables1677501636753 } from './1677501636753-CreateVariables'; import { AddUserActivatedProperty1681134145996 } from './1681134145996-AddUserActivatedProperty'; import { MigrateIntegerKeysToString1690000000001 } from './1690000000001-MigrateIntegerKeysToString'; import { SeparateExecutionData1690000000030 } from './1690000000030-SeparateExecutionData'; +import { FixExecutionDataType1690000000031 } from './1690000000031-FixExecutionDataType'; import { RemoveSkipOwnerSetup1681134145997 } from './1681134145997-RemoveSkipOwnerSetup'; export const mysqlMigrations: Migration[] = [ @@ -84,5 +85,6 @@ export const mysqlMigrations: Migration[] = [ AddUserActivatedProperty1681134145996, MigrateIntegerKeysToString1690000000001, SeparateExecutionData1690000000030, + FixExecutionDataType1690000000031, RemoveSkipOwnerSetup1681134145997, ];