mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
* 🚧 add webhookId to URL
* 🚧 add webhookId to webhook entity, 🔧 refactor migrations
* 🚧 🐘 postgres migration
* 🚧 add mySQL migration
* 🚧 refactor mongoDB
* 🚧 add webhookId to IWebhookDb
* 🚧 starting workflow with dynamic route works
* ⚡ production dynamic webhooks complete
* 🎨 fix lint issues
* 🔧 dynamic path for webhook-test complete
* 🎨 fix lint issues
* 🎨 fix typescript issue
* ⚡ add error message for dynamic webhook-test
* 🔨 improve handling of leading `/`
* 🚧 add webhookId to URL
* 🚧 add webhookId to webhook entity, 🔧 refactor migrations
* 🚧 🐘 postgres migration
* 🚧 add mySQL migration
* 🚧 refactor mongoDB
* 🚧 add webhookId to IWebhookDb
* 🚧 starting workflow with dynamic route works
* ⚡ production dynamic webhooks complete
* 🎨 fix lint issues
* 🔧 dynamic path for webhook-test complete
* 🎨 fix lint issues
* 🎨 fix typescript issue
* ⚡ add error message for dynamic webhook-test
* 🔨 improve handling of leading `/`
* ⚡ Fix issue that tab-title did not get reset on new workflow
* Revert "⚡ Fix issue that tab-title did not get reset on new workflow"
This reverts commit 699d0a8946
.
* 🔧 reset params before extraction
* 🐘 removing unique constraint for webhookId
* 🚧 handle multiple webhooks per id
* 🔧 enable webhook-test for multiple WH with same id
* 🐘 add migration for postgres
* ⚡ add mysql migration
* 🎨 fix lint issue
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
27 lines
1.9 KiB
TypeScript
27 lines
1.9 KiB
TypeScript
import {MigrationInterface, QueryRunner} from "typeorm";
|
|
import * as config from '../../../../config';
|
|
|
|
export class AddWebhookId1611071044839 implements MigrationInterface {
|
|
name = 'AddWebhookId1611071044839';
|
|
|
|
async up(queryRunner: QueryRunner): Promise<void> {
|
|
const tablePrefix = config.get('database.tablePrefix');
|
|
|
|
await queryRunner.query(`CREATE TABLE "temporary_webhook_entity" ("workflowId" integer NOT NULL, "webhookPath" varchar NOT NULL, "method" varchar NOT NULL, "node" varchar NOT NULL, "webhookId" varchar, "pathLength" integer, PRIMARY KEY ("webhookPath", "method"))`);
|
|
await queryRunner.query(`INSERT INTO "temporary_webhook_entity"("workflowId", "webhookPath", "method", "node") SELECT "workflowId", "webhookPath", "method", "node" FROM "${tablePrefix}webhook_entity"`);
|
|
await queryRunner.query(`DROP TABLE "${tablePrefix}webhook_entity"`);
|
|
await queryRunner.query(`ALTER TABLE "temporary_webhook_entity" RENAME TO "${tablePrefix}webhook_entity"`);
|
|
await queryRunner.query(`CREATE INDEX "IDX_${tablePrefix}742496f199721a057051acf4c2" ON "${tablePrefix}webhook_entity" ("webhookId", "method", "pathLength") `);
|
|
}
|
|
|
|
async down(queryRunner: QueryRunner): Promise<void> {
|
|
const tablePrefix = config.get('database.tablePrefix');
|
|
|
|
await queryRunner.query(`DROP INDEX "IDX_${tablePrefix}742496f199721a057051acf4c2"`);
|
|
await queryRunner.query(`ALTER TABLE "${tablePrefix}webhook_entity" RENAME TO "temporary_webhook_entity"`);
|
|
await queryRunner.query(`CREATE TABLE "${tablePrefix}webhook_entity" ("workflowId" integer NOT NULL, "webhookPath" varchar NOT NULL, "method" varchar NOT NULL, "node" varchar NOT NULL, PRIMARY KEY ("webhookPath", "method"))`);
|
|
await queryRunner.query(`INSERT INTO "${tablePrefix}webhook_entity"("workflowId", "webhookPath", "method", "node") SELECT "workflowId", "webhookPath", "method", "node" FROM "temporary_webhook_entity"`);
|
|
await queryRunner.query(`DROP TABLE "temporary_webhook_entity"`);
|
|
}
|
|
}
|