( credentialId: string, workspaceId: string, needle: string )
| 133 | } |
| 134 | |
| 135 | async function clearInDeploymentVersions( |
| 136 | credentialId: string, |
| 137 | workspaceId: string, |
| 138 | needle: string |
| 139 | ): Promise<void> { |
| 140 | const rows = await db |
| 141 | .select({ |
| 142 | id: schema.workflowDeploymentVersion.id, |
| 143 | state: schema.workflowDeploymentVersion.state, |
| 144 | }) |
| 145 | .from(schema.workflowDeploymentVersion) |
| 146 | .innerJoin(schema.workflow, eq(schema.workflow.id, schema.workflowDeploymentVersion.workflowId)) |
| 147 | .where( |
| 148 | and( |
| 149 | eq(schema.workflow.workspaceId, workspaceId), |
| 150 | sql`${schema.workflowDeploymentVersion.state}::text LIKE ${needle}` |
| 151 | ) |
| 152 | ) |
| 153 | |
| 154 | for (const row of rows) { |
| 155 | const next = clearCredentialInValue(row.state, credentialId) |
| 156 | if (next.changed) { |
| 157 | await db |
| 158 | .update(schema.workflowDeploymentVersion) |
| 159 | .set({ state: next.value }) |
| 160 | .where(eq(schema.workflowDeploymentVersion.id, row.id)) |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | async function clearInPausedExecutions( |
| 166 | credentialId: string, |
no test coverage detected