mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
fix(core): Fix migrations for MySQL/MariaDB (#6591)
This commit is contained in:
parent
3ca66be380
commit
29882a6f39
|
@ -6,7 +6,7 @@ export class SeparateExecutionData1690000000030 implements ReversibleMigration {
|
||||||
`CREATE TABLE ${tablePrefix}execution_data (
|
`CREATE TABLE ${tablePrefix}execution_data (
|
||||||
executionId int(11) NOT NULL primary key,
|
executionId int(11) NOT NULL primary key,
|
||||||
workflowData json NOT NULL,
|
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
|
CONSTRAINT \`${tablePrefix}execution_data_FK\` FOREIGN KEY (\`executionId\`) REFERENCES \`${tablePrefix}execution_entity\` (\`id\`) ON DELETE CASCADE
|
||||||
)
|
)
|
||||||
ENGINE=InnoDB`,
|
ENGINE=InnoDB`,
|
||||||
|
@ -30,7 +30,7 @@ export class SeparateExecutionData1690000000030 implements ReversibleMigration {
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`ALTER TABLE ${tablePrefix}execution_entity
|
`ALTER TABLE ${tablePrefix}execution_entity
|
||||||
ADD workflowData json NULL,
|
ADD workflowData json NULL,
|
||||||
ADD data text NULL`,
|
ADD data MEDIUMTEXT NULL`,
|
||||||
);
|
);
|
||||||
|
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
|
|
|
@ -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',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -40,6 +40,7 @@ import { CreateVariables1677501636753 } from './1677501636753-CreateVariables';
|
||||||
import { AddUserActivatedProperty1681134145996 } from './1681134145996-AddUserActivatedProperty';
|
import { AddUserActivatedProperty1681134145996 } from './1681134145996-AddUserActivatedProperty';
|
||||||
import { MigrateIntegerKeysToString1690000000001 } from './1690000000001-MigrateIntegerKeysToString';
|
import { MigrateIntegerKeysToString1690000000001 } from './1690000000001-MigrateIntegerKeysToString';
|
||||||
import { SeparateExecutionData1690000000030 } from './1690000000030-SeparateExecutionData';
|
import { SeparateExecutionData1690000000030 } from './1690000000030-SeparateExecutionData';
|
||||||
|
import { FixExecutionDataType1690000000031 } from './1690000000031-FixExecutionDataType';
|
||||||
|
|
||||||
export const mysqlMigrations: Migration[] = [
|
export const mysqlMigrations: Migration[] = [
|
||||||
InitialMigration1588157391238,
|
InitialMigration1588157391238,
|
||||||
|
@ -83,4 +84,5 @@ export const mysqlMigrations: Migration[] = [
|
||||||
AddUserActivatedProperty1681134145996,
|
AddUserActivatedProperty1681134145996,
|
||||||
MigrateIntegerKeysToString1690000000001,
|
MigrateIntegerKeysToString1690000000001,
|
||||||
SeparateExecutionData1690000000030,
|
SeparateExecutionData1690000000030,
|
||||||
|
FixExecutionDataType1690000000031,
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue