( workflowId: string, tx: DbOrTx, deploymentVersionId?: string )
| 179 | * This should be called within a database transaction during undeploy |
| 180 | */ |
| 181 | export async function deleteSchedulesForWorkflow( |
| 182 | workflowId: string, |
| 183 | tx: DbOrTx, |
| 184 | deploymentVersionId?: string |
| 185 | ): Promise<void> { |
| 186 | await tx |
| 187 | .delete(workflowSchedule) |
| 188 | .where( |
| 189 | deploymentVersionId |
| 190 | ? and( |
| 191 | eq(workflowSchedule.workflowId, workflowId), |
| 192 | eq(workflowSchedule.deploymentVersionId, deploymentVersionId), |
| 193 | isNull(workflowSchedule.archivedAt) |
| 194 | ) |
| 195 | : and(eq(workflowSchedule.workflowId, workflowId), isNull(workflowSchedule.archivedAt)) |
| 196 | ) |
| 197 | |
| 198 | logger.info( |
| 199 | deploymentVersionId |
| 200 | ? `Deleted schedules for workflow ${workflowId} deployment ${deploymentVersionId}` |
| 201 | : `Deleted all schedules for workflow ${workflowId}` |
| 202 | ) |
| 203 | } |
| 204 | |
| 205 | async function cleanupDeploymentVersion(params: { |
| 206 | workflowId: string |
no test coverage detected