Minor improvements

This commit is contained in:
Jan Oberhauser 2020-06-23 12:43:40 +02:00
parent 94cd2c76c2
commit e60edc3bff
4 changed files with 10 additions and 6 deletions

View file

@ -13,7 +13,7 @@ import {
import { import {
Workflow, Workflow,
} from 'n8n-workflow/dist/src/Workflow'; } from 'n8n-workflow';
import { import {
IWebhookDb, IWebhookDb,

View file

@ -11,7 +11,7 @@ import {
import { import {
Workflow, Workflow,
} from 'n8n-workflow/dist/src/Workflow'; } from 'n8n-workflow';
import { import {
IWebhookDb, IWebhookDb,
@ -24,12 +24,13 @@ export class WebhookModel1589476000887 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> { async up(queryRunner: QueryRunner): Promise<void> {
let tablePrefix = config.get('database.tablePrefix'); let tablePrefix = config.get('database.tablePrefix');
const tablePrefixIndex = tablePrefix;
const schema = config.get('database.postgresdb.schema'); const schema = config.get('database.postgresdb.schema');
if (schema) { if (schema) {
tablePrefix = schema + '.' + tablePrefix; 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 workflows = await queryRunner.query(`SELECT * FROM ${tablePrefix}workflow_entity WHERE active=true`) as IWorkflowDb[];
const data: IWebhookDb[] = []; const data: IWebhookDb[] = [];

View file

@ -1,4 +1,7 @@
import { MigrationInterface, QueryRunner } from "typeorm"; import {
MigrationInterface,
QueryRunner,
} from 'typeorm';
import * as config from '../../../../config'; import * as config from '../../../../config';

View file

@ -1,7 +1,7 @@
import { import {
MigrationInterface, MigrationInterface,
QueryRunner, QueryRunner,
} from "typeorm"; } from 'typeorm';
import * as config from '../../../../config'; import * as config from '../../../../config';
@ -13,7 +13,7 @@ import {
import { import {
Workflow, Workflow,
} from 'n8n-workflow/dist/src/Workflow'; } from 'n8n-workflow';
import { import {
IWebhookDb, IWebhookDb,