From a9a2c9e492a1cba03c21ddb6c6a3244eb0e51f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Mon, 31 Jul 2023 12:35:42 +0200 Subject: [PATCH] fix(core): Add missing primary key on the `execution_data` table on postgres (#6797) --- .../1690787606731-AddMissingPrimaryKeyOnExecutionData.ts | 9 +++++++++ .../cli/src/databases/migrations/postgresdb/index.ts | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 packages/cli/src/databases/migrations/postgresdb/1690787606731-AddMissingPrimaryKeyOnExecutionData.ts diff --git a/packages/cli/src/databases/migrations/postgresdb/1690787606731-AddMissingPrimaryKeyOnExecutionData.ts b/packages/cli/src/databases/migrations/postgresdb/1690787606731-AddMissingPrimaryKeyOnExecutionData.ts new file mode 100644 index 0000000000000..dbf0d1346fade --- /dev/null +++ b/packages/cli/src/databases/migrations/postgresdb/1690787606731-AddMissingPrimaryKeyOnExecutionData.ts @@ -0,0 +1,9 @@ +import type { IrreversibleMigration, MigrationContext } from '@/databases/types'; + +export class AddMissingPrimaryKeyOnExecutionData1690787606731 implements IrreversibleMigration { + async up({ queryRunner, tablePrefix }: MigrationContext) { + await queryRunner.query( + `ALTER TABLE "${tablePrefix}execution_data" ADD PRIMARY KEY("executionId");`, + ); + } +} diff --git a/packages/cli/src/databases/migrations/postgresdb/index.ts b/packages/cli/src/databases/migrations/postgresdb/index.ts index 53066755a9a21..511b165a8a1dc 100644 --- a/packages/cli/src/databases/migrations/postgresdb/index.ts +++ b/packages/cli/src/databases/migrations/postgresdb/index.ts @@ -40,6 +40,7 @@ import { MigrateIntegerKeysToString1690000000000 } from './1690000000000-Migrate import { SeparateExecutionData1690000000020 } from './1690000000020-SeparateExecutionData'; import { RemoveSkipOwnerSetup1681134145997 } from './1681134145997-RemoveSkipOwnerSetup'; import { RemoveResetPasswordColumns1690000000030 } from '../common/1690000000030-RemoveResetPasswordColumns'; +import { AddMissingPrimaryKeyOnExecutionData1690787606731 } from './1690787606731-AddMissingPrimaryKeyOnExecutionData'; export const postgresMigrations: Migration[] = [ InitialMigration1587669153312, @@ -83,4 +84,5 @@ export const postgresMigrations: Migration[] = [ SeparateExecutionData1690000000020, RemoveSkipOwnerSetup1681134145997, RemoveResetPasswordColumns1690000000030, + AddMissingPrimaryKeyOnExecutionData1690787606731, ];