Merge pull request #1037 from scomans/main

fix: renaming environments not updated in `secretimports` model
This commit is contained in:
Maidul Islam
2023-10-04 23:12:30 -04:00
committed by GitHub
@@ -394,6 +394,11 @@ export const renameWorkspaceEnvironment = async (req: Request, res: Response) =>
{ workspace: workspaceId, environment: oldEnvironmentSlug }, { workspace: workspaceId, environment: oldEnvironmentSlug },
{ environment: environmentSlug } { environment: environmentSlug }
); );
await SecretImport.updateMany(
{ workspace: workspaceId, 'imports.environment': oldEnvironmentSlug },
{ $set: { 'imports.$[element].environment': environmentSlug } },
{ arrayFilters: [{ 'element.environment': oldEnvironmentSlug }] },
);
await ServiceAccountWorkspacePermission.updateMany( await ServiceAccountWorkspacePermission.updateMany(
{ workspace: workspaceId, environment: oldEnvironmentSlug }, { workspace: workspaceId, environment: oldEnvironmentSlug },