From e60edc3bff68a6e7fb72af7454bf8f77d2e3baad Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Tue, 23 Jun 2020 12:43:40 +0200 Subject: [PATCH] :zap: Minor improvements --- .../mysqldb/migrations/1592447867632-WebhookModel.ts | 2 +- .../postgresdb/migrations/1589476000887-WebhookModel.ts | 5 +++-- .../sqlite/migrations/1588102412422-InitialMigration.ts | 5 ++++- .../sqlite/migrations/1592445003908-WebhookModel.ts | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/databases/mysqldb/migrations/1592447867632-WebhookModel.ts b/packages/cli/src/databases/mysqldb/migrations/1592447867632-WebhookModel.ts index 6c81f612ed..8a49080462 100644 --- a/packages/cli/src/databases/mysqldb/migrations/1592447867632-WebhookModel.ts +++ b/packages/cli/src/databases/mysqldb/migrations/1592447867632-WebhookModel.ts @@ -13,7 +13,7 @@ import { import { Workflow, -} from 'n8n-workflow/dist/src/Workflow'; +} from 'n8n-workflow'; import { IWebhookDb, diff --git a/packages/cli/src/databases/postgresdb/migrations/1589476000887-WebhookModel.ts b/packages/cli/src/databases/postgresdb/migrations/1589476000887-WebhookModel.ts index dfbf94a799..e53fc28915 100644 --- a/packages/cli/src/databases/postgresdb/migrations/1589476000887-WebhookModel.ts +++ b/packages/cli/src/databases/postgresdb/migrations/1589476000887-WebhookModel.ts @@ -11,7 +11,7 @@ import { import { Workflow, -} from 'n8n-workflow/dist/src/Workflow'; +} from 'n8n-workflow'; import { IWebhookDb, @@ -24,12 +24,13 @@ export class WebhookModel1589476000887 implements MigrationInterface { async up(queryRunner: QueryRunner): Promise { let tablePrefix = config.get('database.tablePrefix'); + const tablePrefixIndex = tablePrefix; const schema = config.get('database.postgresdb.schema'); if (schema) { tablePrefix = schema + '.' + tablePrefix; } - await queryRunner.query(`CREATE TABLE ${tablePrefix}webhook_entity ("workflowId" integer NOT NULL, "webhookPath" character varying NOT NULL, "method" character varying NOT NULL, "node" character varying NOT NULL, CONSTRAINT "PK_b21ace2e13596ccd87dc9bf4ea6" PRIMARY KEY ("webhookPath", "method"))`, undefined); + await queryRunner.query(`CREATE TABLE ${tablePrefix}webhook_entity ("workflowId" integer NOT NULL, "webhookPath" character varying NOT NULL, "method" character varying NOT NULL, "node" character varying NOT NULL, CONSTRAINT "PK_${tablePrefixIndex}b21ace2e13596ccd87dc9bf4ea6" PRIMARY KEY ("webhookPath", "method"))`, undefined); const workflows = await queryRunner.query(`SELECT * FROM ${tablePrefix}workflow_entity WHERE active=true`) as IWorkflowDb[]; const data: IWebhookDb[] = []; diff --git a/packages/cli/src/databases/sqlite/migrations/1588102412422-InitialMigration.ts b/packages/cli/src/databases/sqlite/migrations/1588102412422-InitialMigration.ts index c2bb55040e..09a0da911a 100644 --- a/packages/cli/src/databases/sqlite/migrations/1588102412422-InitialMigration.ts +++ b/packages/cli/src/databases/sqlite/migrations/1588102412422-InitialMigration.ts @@ -1,4 +1,7 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; +import { + MigrationInterface, + QueryRunner, +} from 'typeorm'; import * as config from '../../../../config'; diff --git a/packages/cli/src/databases/sqlite/migrations/1592445003908-WebhookModel.ts b/packages/cli/src/databases/sqlite/migrations/1592445003908-WebhookModel.ts index f1402fad88..92704482b2 100644 --- a/packages/cli/src/databases/sqlite/migrations/1592445003908-WebhookModel.ts +++ b/packages/cli/src/databases/sqlite/migrations/1592445003908-WebhookModel.ts @@ -1,7 +1,7 @@ import { MigrationInterface, QueryRunner, -} from "typeorm"; +} from 'typeorm'; import * as config from '../../../../config'; @@ -13,7 +13,7 @@ import { import { Workflow, -} from 'n8n-workflow/dist/src/Workflow'; +} from 'n8n-workflow'; import { IWebhookDb,