mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
fix(core): Change dedupe value column type from varchar(255) to text (#11357)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import type { MigrationContext, ReversibleMigration } from '@/databases/types';
|
||||
|
||||
const processedDataTableName = 'processed_data';
|
||||
export class UpdateProcessedDataValueColumnToText1729607673464 implements ReversibleMigration {
|
||||
async up({ schemaBuilder: { addNotNull }, isMysql, runQuery, tablePrefix }: MigrationContext) {
|
||||
const prefixedTableName = `${tablePrefix}${processedDataTableName}`;
|
||||
await runQuery(`ALTER TABLE ${prefixedTableName} ADD COLUMN value_temp TEXT;`);
|
||||
await runQuery(`UPDATE ${prefixedTableName} SET value_temp = value;`);
|
||||
await runQuery(`ALTER TABLE ${prefixedTableName} DROP COLUMN value;`);
|
||||
|
||||
if (isMysql) {
|
||||
await runQuery(`ALTER TABLE ${prefixedTableName} CHANGE value_temp value TEXT NOT NULL;`);
|
||||
} else {
|
||||
await runQuery(`ALTER TABLE ${prefixedTableName} RENAME COLUMN value_temp TO value`);
|
||||
await addNotNull(processedDataTableName, 'value');
|
||||
}
|
||||
}
|
||||
|
||||
async down({ schemaBuilder: { addNotNull }, isMysql, runQuery, tablePrefix }: MigrationContext) {
|
||||
const prefixedTableName = `${tablePrefix}${processedDataTableName}`;
|
||||
await runQuery(`ALTER TABLE ${prefixedTableName} ADD COLUMN value_temp VARCHAR(255);`);
|
||||
await runQuery(`UPDATE ${prefixedTableName} SET value_temp = value;`);
|
||||
await runQuery(`ALTER TABLE ${prefixedTableName} DROP COLUMN value;`);
|
||||
|
||||
if (isMysql) {
|
||||
await runQuery(
|
||||
`ALTER TABLE ${prefixedTableName} CHANGE value_temp value VARCHAR(255) NOT NULL;`,
|
||||
);
|
||||
} else {
|
||||
await runQuery(`ALTER TABLE ${prefixedTableName} RENAME COLUMN value_temp TO value`);
|
||||
await addNotNull(processedDataTableName, 'value');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,7 @@ import { AddApiKeysTable1724951148974 } from '../common/1724951148974-AddApiKeys
|
||||
import { CreateProcessedDataTable1726606152711 } from '../common/1726606152711-CreateProcessedDataTable';
|
||||
import { SeparateExecutionCreationFromStart1727427440136 } from '../common/1727427440136-SeparateExecutionCreationFromStart';
|
||||
import { AddMissingPrimaryKeyOnAnnotationTagMapping1728659839644 } from '../common/1728659839644-AddMissingPrimaryKeyOnAnnotationTagMapping';
|
||||
import { UpdateProcessedDataValueColumnToText1729607673464 } from '../common/1729607673464-UpdateProcessedDataValueColumnToText';
|
||||
|
||||
export const mysqlMigrations: Migration[] = [
|
||||
InitialMigration1588157391238,
|
||||
@@ -136,4 +137,5 @@ export const mysqlMigrations: Migration[] = [
|
||||
SeparateExecutionCreationFromStart1727427440136,
|
||||
CreateProcessedDataTable1726606152711,
|
||||
AddMissingPrimaryKeyOnAnnotationTagMapping1728659839644,
|
||||
UpdateProcessedDataValueColumnToText1729607673464,
|
||||
];
|
||||
|
||||
@@ -67,6 +67,7 @@ import { AddApiKeysTable1724951148974 } from '../common/1724951148974-AddApiKeys
|
||||
import { CreateProcessedDataTable1726606152711 } from '../common/1726606152711-CreateProcessedDataTable';
|
||||
import { SeparateExecutionCreationFromStart1727427440136 } from '../common/1727427440136-SeparateExecutionCreationFromStart';
|
||||
import { AddMissingPrimaryKeyOnAnnotationTagMapping1728659839644 } from '../common/1728659839644-AddMissingPrimaryKeyOnAnnotationTagMapping';
|
||||
import { UpdateProcessedDataValueColumnToText1729607673464 } from '../common/1729607673464-UpdateProcessedDataValueColumnToText';
|
||||
|
||||
export const postgresMigrations: Migration[] = [
|
||||
InitialMigration1587669153312,
|
||||
@@ -136,4 +137,5 @@ export const postgresMigrations: Migration[] = [
|
||||
SeparateExecutionCreationFromStart1727427440136,
|
||||
CreateProcessedDataTable1726606152711,
|
||||
AddMissingPrimaryKeyOnAnnotationTagMapping1728659839644,
|
||||
UpdateProcessedDataValueColumnToText1729607673464,
|
||||
];
|
||||
|
||||
@@ -64,6 +64,7 @@ import { RefactorExecutionIndices1723796243146 } from '../common/1723796243146-R
|
||||
import { CreateAnnotationTables1724753530828 } from '../common/1724753530828-CreateExecutionAnnotationTables';
|
||||
import { CreateProcessedDataTable1726606152711 } from '../common/1726606152711-CreateProcessedDataTable';
|
||||
import { SeparateExecutionCreationFromStart1727427440136 } from '../common/1727427440136-SeparateExecutionCreationFromStart';
|
||||
import { UpdateProcessedDataValueColumnToText1729607673464 } from '../common/1729607673464-UpdateProcessedDataValueColumnToText';
|
||||
|
||||
const sqliteMigrations: Migration[] = [
|
||||
InitialMigration1588102412422,
|
||||
@@ -130,6 +131,7 @@ const sqliteMigrations: Migration[] = [
|
||||
SeparateExecutionCreationFromStart1727427440136,
|
||||
CreateProcessedDataTable1726606152711,
|
||||
AddMissingPrimaryKeyOnAnnotationTagMapping1728659839644,
|
||||
UpdateProcessedDataValueColumnToText1729607673464,
|
||||
];
|
||||
|
||||
export { sqliteMigrations };
|
||||
|
||||
Reference in New Issue
Block a user