Fix invalid protected environment access levels
What does this MR do and why?
Rerun the migration from Cleanup invalid deploy access levels for protec... (!110686 - merged) with a few modifications
We needed to do that because we didn't have the model validation, and after Cleanup invalid deploy access levels for protec... (!110686 - merged) was merged users were able to create a few invalid records:
[ gprd ] production> ProtectedEnvironments::DeployAccessLevel.where("user_id IS NOT NULL AND group_id IS NOT NULL").count
=> 0
[ gprd ] production> ProtectedEnvironments::DeployAccessLevel.where("user_id IS NOT NULL AND access_level IS NOT NULL").count
=> 2
[ gprd ] production> ProtectedEnvironments::DeployAccessLevel.where("group_id IS NOT NULL AND access_level IS NOT NULL").count
=> 0
So we wouldn't be able to introduce the database constraint for this. After Validate ProtectedEnvironments::DeployAccessLev... (!114449 - merged) we can merge this one and we won't have invalid records in the database.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #330483 (closed)
Edited by Vladimir Shushlin