-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into Automatic_version_update_dependabot
- Loading branch information
Showing
15 changed files
with
175 additions
and
32 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
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
36 changes: 36 additions & 0 deletions
36
...arningSolutions.Data.Migrations/202412020900_UpdateCandidateAssessmentSupervisorsTable.cs
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,36 @@ | ||
namespace DigitalLearningSolutions.Data.Migrations | ||
{ | ||
using FluentMigrator; | ||
|
||
[Migration(202412020900)] | ||
public class UpdateCandidateAssessmentSupervisorsTable : ForwardOnlyMigration | ||
{ | ||
public override void Up() | ||
{ | ||
Execute.Sql($@"UPDATE cas | ||
SET SelfAssessmentSupervisorRoleID = (SELECT ID FROM SelfAssessmentSupervisorRoles | ||
WHERE SelfAssessmentID = ssr.SelfAssessmentID and AllowDelegateNomination = 1) | ||
FROM CandidateAssessmentSupervisors cas INNER JOIN | ||
SelfAssessmentSupervisorRoles ssr ON cas.SelfAssessmentSupervisorRoleID = ssr.ID | ||
AND cas.Removed IS NULL AND ssr.AllowDelegateNomination = 0 INNER JOIN | ||
SupervisorDelegates sd ON cas.SupervisorDelegateId = sd.ID INNER JOIN | ||
AdminAccounts aa ON sd.SupervisorAdminID = aa.ID | ||
WHERE aa.IsSupervisor = 0 AND aa.IsNominatedSupervisor = 1 | ||
-- to exclude duplicate CandidateAssessmentID from update | ||
AND cas.CandidateAssessmentID NOT IN ( | ||
SELECT CandidateAssessmentID FROM CandidateAssessmentSupervisors WHERE CandidateAssessmentID in ( | ||
SELECT Cas2.CandidateAssessmentID | ||
FROM CandidateAssessmentSupervisors cas2 with (nolock) INNER JOIN | ||
SelfAssessmentSupervisorRoles ssr2 with (nolock) ON cas2.SelfAssessmentSupervisorRoleID = ssr2.ID | ||
AND cas2.Removed IS NULL AND ssr2.AllowDelegateNomination = 0 INNER JOIN | ||
SupervisorDelegates sd2 with (nolock) ON cas2.SupervisorDelegateId = sd2.ID INNER JOIN | ||
AdminAccounts aa2 with (nolock) ON sd2.SupervisorAdminID = aa2.ID | ||
WHERE aa2.IsSupervisor = 0 AND aa2.IsNominatedSupervisor = 1 | ||
) | ||
GROUP BY CandidateAssessmentID,SupervisorDelegateId | ||
HAVING COUNT(*)>1 | ||
)" | ||
); | ||
} | ||
} | ||
} |
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.