-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ado-6-ndv-simplify-credentials
* master: fix(core): Fixes event msg confirmations if no subscribers present (#5118) refactor(core): Diverge syntax error handling in expressions (#5124) fix(editor): Recover from unsaved finished execution (#5121) feat(editor): Executions page (#4997) docs: Update the contribution guidelines for node creation (#5120) feat: Expression extension framework (#4372) fix(editor): Fixes event bus test (#5119) refactor(TelegramTrigger Node, ShopifyTrigger Node): Standardize node triggers actions (#5117) feat(editor): Remove prevent-ndv-auto-open feature flag (#5114) refactor: On workflow deletion, cascade delete all entities associated with it (#5102) # Conflicts: # packages/editor-ui/src/Interface.ts
- Loading branch information
Showing
61 changed files
with
3,701 additions
and
581 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/cli/src/databases/migrations/mysqldb/1673268682475-DeleteExecutionsWithWorkflows.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
import { logMigrationEnd, logMigrationStart } from '@db/utils/migrationHelpers'; | ||
import config from '@/config'; | ||
|
||
export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInterface { | ||
name = 'DeleteExecutionsWithWorkflows1673268682475'; | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
logMigrationStart(this.name); | ||
const tablePrefix = config.getEnv('database.tablePrefix'); | ||
|
||
await queryRunner.query(`ALTER TABLE \`${tablePrefix}execution_entity\` MODIFY workflowId INT`); | ||
|
||
const workflowIds: Array<{ id: number }> = await queryRunner.query(` | ||
SELECT id FROM \`${tablePrefix}execution_entity\` | ||
`); | ||
|
||
await queryRunner.query( | ||
`DELETE FROM \`${tablePrefix}execution_entity\` | ||
WHERE workflowId IS NOT NULL | ||
${workflowIds.length ? `AND workflowId NOT IN (${workflowIds.map(({ id }) => id).join()})` : ''}`, | ||
); | ||
|
||
await queryRunner.query( | ||
`ALTER TABLE \`${tablePrefix}execution_entity\` | ||
ADD CONSTRAINT \`FK_${tablePrefix}execution_entity_workflowId\` | ||
FOREIGN KEY (\`workflowId\`) REFERENCES \`${tablePrefix}workflow_entity\`(\`id\`) | ||
ON DELETE CASCADE`, | ||
); | ||
|
||
logMigrationEnd(this.name); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
const tablePrefix = config.getEnv('database.tablePrefix'); | ||
await queryRunner.query( | ||
`ALTER TABLE \`${tablePrefix}execution_entity\` | ||
DROP FOREIGN KEY \`FK_${tablePrefix}execution_entity_workflowId\``, | ||
); | ||
|
||
await queryRunner.query( | ||
`ALTER TABLE \`${tablePrefix}execution_entity\` MODIFY workflowId varchar(255);`, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...es/cli/src/databases/migrations/postgresdb/1673268682475-DeleteExecutionsWithWorkflows.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
import { logMigrationEnd, logMigrationStart } from '@db/utils/migrationHelpers'; | ||
import config from '@/config'; | ||
|
||
export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInterface { | ||
name = 'DeleteExecutionsWithWorkflows1673268682475'; | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
logMigrationStart(this.name); | ||
const tablePrefix = config.getEnv('database.tablePrefix'); | ||
|
||
await queryRunner.query( | ||
`ALTER TABLE ${tablePrefix}execution_entity | ||
ALTER COLUMN "workflowId" TYPE INTEGER USING "workflowId"::integer`, | ||
); | ||
|
||
const workflowIds: Array<{ id: number }> = await queryRunner.query(` | ||
SELECT id FROM ${tablePrefix}workflow_entity | ||
`); | ||
|
||
await queryRunner.query( | ||
`DELETE FROM ${tablePrefix}execution_entity | ||
WHERE "workflowId" IS NOT NULL | ||
${ | ||
workflowIds.length | ||
? `AND "workflowId" NOT IN (${workflowIds.map(({ id }) => id).join()})` | ||
: '' | ||
}`, | ||
); | ||
|
||
await queryRunner.query( | ||
`ALTER TABLE ${tablePrefix}execution_entity | ||
ADD CONSTRAINT "FK_${tablePrefix}execution_entity_workflowId" | ||
FOREIGN KEY ("workflowId") REFERENCES ${tablePrefix}workflow_entity ("id") | ||
ON DELETE CASCADE`, | ||
); | ||
|
||
logMigrationEnd(this.name); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
const tablePrefix = config.getEnv('database.tablePrefix'); | ||
await queryRunner.query( | ||
`ALTER TABLE ${tablePrefix}execution_entity | ||
DROP CONSTRAINT "FK_${tablePrefix}execution_entity_workflowId"`, | ||
); | ||
|
||
await queryRunner.query( | ||
`ALTER TABLE ${tablePrefix}execution_entity | ||
ALTER COLUMN "workflowId" TYPE TEXT`, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
packages/cli/src/databases/migrations/sqlite/1673268682475-DeleteExecutionsWithWorkflows.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
import { logMigrationEnd, logMigrationStart } from '@db/utils/migrationHelpers'; | ||
import config from '@/config'; | ||
|
||
export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInterface { | ||
name = 'DeleteExecutionsWithWorkflows1673268682475'; | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
logMigrationStart(this.name); | ||
const tablePrefix = config.getEnv('database.tablePrefix'); | ||
|
||
const workflowIds: Array<{ id: number }> = await queryRunner.query(` | ||
SELECT id FROM "${tablePrefix}workflow_entity" | ||
`); | ||
|
||
await queryRunner.query( | ||
`DELETE FROM "${tablePrefix}execution_entity" | ||
WHERE "workflowId" IS NOT NULL | ||
${ | ||
workflowIds.length | ||
? `AND "workflowId" NOT IN (${workflowIds.map(({ id }) => id).join()})` | ||
: '' | ||
}`, | ||
); | ||
|
||
await queryRunner.query('PRAGMA foreign_keys=OFF'); | ||
|
||
await queryRunner.query(`DROP TABLE IF EXISTS "${tablePrefix}temporary_execution_entity"`); | ||
await queryRunner.query( | ||
`CREATE TABLE "${tablePrefix}temporary_execution_entity" ( | ||
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, | ||
"workflowId" int, | ||
"finished" boolean NOT NULL, | ||
"mode" varchar NOT NULL, | ||
"retryOf" varchar, | ||
"retrySuccessId" varchar, | ||
"startedAt" datetime NOT NULL, | ||
"stoppedAt" datetime, | ||
"waitTill" datetime, | ||
"workflowData" text NOT NULL, | ||
"data" text NOT NULL, | ||
FOREIGN KEY("workflowId") REFERENCES "${tablePrefix}workflow_entity" ("id") ON DELETE CASCADE | ||
)`, | ||
); | ||
|
||
const columns = | ||
'"id", "workflowId", "finished", "mode", "retryOf", "retrySuccessId", "startedAt", "stoppedAt", "waitTill", "workflowData", "data"'; | ||
await queryRunner.query( | ||
`INSERT INTO "${tablePrefix}temporary_execution_entity"(${columns}) SELECT ${columns} FROM "${tablePrefix}execution_entity"`, | ||
); | ||
await queryRunner.query(`DROP TABLE "${tablePrefix}execution_entity"`); | ||
await queryRunner.query( | ||
`ALTER TABLE "${tablePrefix}temporary_execution_entity" RENAME TO "${tablePrefix}execution_entity"`, | ||
); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_${tablePrefix}cefb067df2402f6aed0638a6c1" ON "${tablePrefix}execution_entity" ("stoppedAt")`, | ||
); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_${tablePrefix}ca4a71b47f28ac6ea88293a8e2" ON "${tablePrefix}execution_entity" ("waitTill")`, | ||
); | ||
await queryRunner.query(`VACUUM;`); | ||
|
||
await queryRunner.query('PRAGMA foreign_keys=ON'); | ||
|
||
logMigrationEnd(this.name); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
const tablePrefix = config.getEnv('database.tablePrefix'); | ||
await queryRunner.query('PRAGMA foreign_keys=OFF'); | ||
|
||
await queryRunner.query(`DROP TABLE IF EXISTS "${tablePrefix}temporary_execution_entity"`); | ||
await queryRunner.query( | ||
`CREATE TABLE "${tablePrefix}temporary_execution_entity" ( | ||
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, | ||
"workflowId" varchar, | ||
"finished" boolean NOT NULL, | ||
"mode" varchar NOT NULL, | ||
"retryOf" varchar, | ||
"retrySuccessId" varchar, | ||
"startedAt" datetime NOT NULL, | ||
"stoppedAt" datetime, | ||
"waitTill" datetime, | ||
"workflowData" text NOT NULL, | ||
"data" text NOT NULL | ||
)`, | ||
); | ||
|
||
const columns = | ||
'"id", "workflowId", "finished", "mode", "retryOf", "retrySuccessId", "startedAt", "stoppedAt", "waitTill", "workflowData", "data"'; | ||
await queryRunner.query( | ||
`INSERT INTO "${tablePrefix}temporary_execution_entity"(${columns}) SELECT ${columns} FROM "${tablePrefix}execution_entity"`, | ||
); | ||
await queryRunner.query(`DROP TABLE "${tablePrefix}execution_entity"`); | ||
await queryRunner.query( | ||
`ALTER TABLE "${tablePrefix}temporary_execution_entity" RENAME TO "${tablePrefix}execution_entity"`, | ||
); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_${tablePrefix}cefb067df2402f6aed0638a6c1" ON "${tablePrefix}execution_entity" ("stoppedAt")`, | ||
); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_${tablePrefix}ca4a71b47f28ac6ea88293a8e2" ON "${tablePrefix}execution_entity" ("waitTill")`, | ||
); | ||
await queryRunner.query(`VACUUM;`); | ||
|
||
await queryRunner.query('PRAGMA foreign_keys=ON'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.