-
Notifications
You must be signed in to change notification settings - Fork 943
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #866 from activepieces/feat/scheduler-piece
Feat/scheduler piece
- Loading branch information
Showing
82 changed files
with
723 additions
and
463 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
6 changes: 3 additions & 3 deletions
6
packages/backend/src/app/app-event-routing/app-event-routing.module.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
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
57 changes: 57 additions & 0 deletions
57
packages/backend/src/app/database/migration/1679014156667-migrate-schedule.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,57 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm" | ||
import { logger } from "../../helper/logger"; | ||
|
||
const FLOW_VERSION_TABLE = "flow_version"; | ||
export class migrateSchedule1679014156667 implements MigrationInterface { | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
logger.info("migrateSchedule1679014156667, started"); | ||
|
||
let count = 0; | ||
const flowVersionRepo = queryRunner.connection.getRepository(FLOW_VERSION_TABLE); | ||
const flowVersions = await flowVersionRepo.find(); | ||
|
||
for (const flowVersion of flowVersions) { | ||
const step = flowVersion.trigger; | ||
if(step.type === "SCHEDULE") { | ||
step.type = "PIECE_TRIGGER"; | ||
step.settings = { | ||
input: { | ||
cronExpression: step.settings.cronExpression | ||
}, | ||
triggerName: "cron_expression", | ||
pieceName: "schedule", | ||
pieceVersion: "0.0.1", | ||
} | ||
count++; | ||
await flowVersionRepo.update(flowVersion.id, flowVersion); | ||
} | ||
} | ||
logger.info("migrateSchedule1679014156667, finished flows " + count); | ||
|
||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
logger.info("rolling back migrateSchedule1679014156667, started"); | ||
|
||
let count = 0; | ||
const flowVersionRepo = queryRunner.connection.getRepository(FLOW_VERSION_TABLE); | ||
const flowVersions = await flowVersionRepo.find(); | ||
|
||
for (const flowVersion of flowVersions) { | ||
const step = flowVersion.trigger; | ||
if(step.type === "PIECE_TRIGGER") { | ||
if(step.settings.pieceName === "schedule"){ | ||
step.type = "SCHEDULE"; | ||
step.settings = { | ||
cronExpression: step.settings.input.cronExpression | ||
} | ||
count++; | ||
await flowVersionRepo.update(flowVersion.id, flowVersion); | ||
} | ||
} | ||
} | ||
logger.info("rolling back migrateSchedule1679014156667, finished flows " + count); | ||
} | ||
|
||
} |
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
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.