-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ODS-6569] Update 4.0 artifacts to include all 7.3 sql script updates…
… from MetaEd (#1187)
- Loading branch information
1 parent
f5f76ac
commit 74ebd05
Showing
13 changed files
with
2,961 additions
and
1,854 deletions.
There are no files selected for viewing
948 changes: 474 additions & 474 deletions
948
Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/MsSql/Structure/Ods/0020-Tables.sql
Large diffs are not rendered by default.
Oops, something went wrong.
156 changes: 0 additions & 156 deletions
156
...ation/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/MsSql/Structure/Ods/0030-ForeignKeys.sql
Large diffs are not rendered by default.
Oops, something went wrong.
148 changes: 74 additions & 74 deletions
148
...0/Artifacts/MsSql/Structure/Ods/1410-CreateIndex-EdOrgIdsRelationship-AuthPerformance.sql
Large diffs are not rendered by default.
Oops, something went wrong.
221 changes: 111 additions & 110 deletions
221
...ture/Ods/1470-Add-AggregateId-columns.sql → ...Structure/Ods/1460-AggregateIdColumns.sql
Large diffs are not rendered by default.
Oops, something went wrong.
477 changes: 477 additions & 0 deletions
477
...0/Artifacts/MsSql/Structure/Ods/1465-UpdateIndex-EdOrgIdsRelationship-AuthPerformance.sql
Large diffs are not rendered by default.
Oops, something went wrong.
232 changes: 232 additions & 0 deletions
232
.../4.0.0/Artifacts/MsSql/Structure/Ods/Changes/0230-CreateIndirectUpdateCascadeTriggers.sql
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,232 @@ | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
-- Licensed to the Ed-Fi Alliance under one or more agreements. | ||
-- The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | ||
-- See the LICENSE and NOTICES files in the project root for more information. | ||
|
||
CREATE TRIGGER [edfi].[edfi_AssessmentSection_TR_Assessment_Update] | ||
ON [edfi].[AssessmentSection] | ||
AFTER UPDATE | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
-- Check if any volatile foreign key values have changed | ||
IF UPDATE(LocalCourseCode) | ||
OR UPDATE(SchoolId) | ||
OR UPDATE(SchoolYear) | ||
OR UPDATE(SectionIdentifier) | ||
OR UPDATE(SessionName) | ||
BEGIN | ||
-- Update the LastModifiedDate in the root table to the current UTC time | ||
UPDATE rt | ||
SET rt.LastModifiedDate = GETUTCDATE() | ||
FROM [edfi].[Assessment] rt | ||
INNER JOIN inserted i | ||
ON rt.AssessmentIdentifier = i.AssessmentIdentifier | ||
AND rt.Namespace = i.Namespace; | ||
END | ||
END; | ||
GO | ||
|
||
CREATE TRIGGER [edfi].[edfi_BellScheduleClassPeriod_TR_BellSchedule_Update] | ||
ON [edfi].[BellScheduleClassPeriod] | ||
AFTER UPDATE | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
-- Check if any volatile foreign key values have changed | ||
IF UPDATE(ClassPeriodName) | ||
OR UPDATE(SchoolId) | ||
BEGIN | ||
-- Update the LastModifiedDate in the root table to the current UTC time | ||
UPDATE rt | ||
SET rt.LastModifiedDate = GETUTCDATE() | ||
FROM [edfi].[BellSchedule] rt | ||
INNER JOIN inserted i | ||
ON rt.BellScheduleName = i.BellScheduleName | ||
AND rt.SchoolId = i.SchoolId; | ||
END | ||
END; | ||
GO | ||
|
||
CREATE TRIGGER [edfi].[edfi_ReportCardGrade_TR_ReportCard_Update] | ||
ON [edfi].[ReportCardGrade] | ||
AFTER UPDATE | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
-- Check if any volatile foreign key values have changed | ||
IF UPDATE(BeginDate) | ||
OR UPDATE(GradeTypeDescriptorId) | ||
OR UPDATE(GradingPeriodDescriptorId) | ||
OR UPDATE(GradingPeriodSequence) | ||
OR UPDATE(GradingPeriodSchoolYear) | ||
OR UPDATE(LocalCourseCode) | ||
OR UPDATE(SchoolId) | ||
OR UPDATE(SchoolYear) | ||
OR UPDATE(SectionIdentifier) | ||
OR UPDATE(SessionName) | ||
OR UPDATE(StudentUSI) | ||
BEGIN | ||
-- Update the LastModifiedDate in the root table to the current UTC time | ||
UPDATE rt | ||
SET rt.LastModifiedDate = GETUTCDATE() | ||
FROM [edfi].[ReportCard] rt | ||
INNER JOIN inserted i | ||
ON rt.EducationOrganizationId = i.EducationOrganizationId | ||
AND rt.GradingPeriodDescriptorId = i.GradingPeriodDescriptorId | ||
AND rt.GradingPeriodSequence = i.GradingPeriodSequence | ||
AND rt.GradingPeriodSchoolId = i.GradingPeriodSchoolId | ||
AND rt.GradingPeriodSchoolYear = i.GradingPeriodSchoolYear | ||
AND rt.StudentUSI = i.StudentUSI; | ||
END | ||
END; | ||
GO | ||
|
||
CREATE TRIGGER [edfi].[edfi_SectionClassPeriod_TR_Section_Update] | ||
ON [edfi].[SectionClassPeriod] | ||
AFTER UPDATE | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
-- Check if any volatile foreign key values have changed | ||
IF UPDATE(ClassPeriodName) | ||
OR UPDATE(SchoolId) | ||
BEGIN | ||
-- Update the LastModifiedDate in the root table to the current UTC time | ||
UPDATE rt | ||
SET rt.LastModifiedDate = GETUTCDATE() | ||
FROM [edfi].[Section] rt | ||
INNER JOIN inserted i | ||
ON rt.LocalCourseCode = i.LocalCourseCode | ||
AND rt.SchoolId = i.SchoolId | ||
AND rt.SchoolYear = i.SchoolYear | ||
AND rt.SectionIdentifier = i.SectionIdentifier | ||
AND rt.SessionName = i.SessionName; | ||
END | ||
END; | ||
GO | ||
|
||
CREATE TRIGGER [edfi].[edfi_StudentCohortAssociationSection_TR_StudentCohortAssociation_Update] | ||
ON [edfi].[StudentCohortAssociationSection] | ||
AFTER UPDATE | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
-- Check if any volatile foreign key values have changed | ||
IF UPDATE(LocalCourseCode) | ||
OR UPDATE(SchoolId) | ||
OR UPDATE(SchoolYear) | ||
OR UPDATE(SectionIdentifier) | ||
OR UPDATE(SessionName) | ||
BEGIN | ||
-- Update the LastModifiedDate in the root table to the current UTC time | ||
UPDATE rt | ||
SET rt.LastModifiedDate = GETUTCDATE() | ||
FROM [edfi].[StudentCohortAssociation] rt | ||
INNER JOIN inserted i | ||
ON rt.BeginDate = i.BeginDate | ||
AND rt.CohortIdentifier = i.CohortIdentifier | ||
AND rt.EducationOrganizationId = i.EducationOrganizationId | ||
AND rt.StudentUSI = i.StudentUSI; | ||
END | ||
END; | ||
GO | ||
|
||
CREATE TRIGGER [edfi].[edfi_StudentCompetencyObjectiveStudentSectionAssociation_TR_StudentCompetencyObjective_Update] | ||
ON [edfi].[StudentCompetencyObjectiveStudentSectionAssociation] | ||
AFTER UPDATE | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
-- Check if any volatile foreign key values have changed | ||
IF UPDATE(BeginDate) | ||
OR UPDATE(LocalCourseCode) | ||
OR UPDATE(SchoolId) | ||
OR UPDATE(SchoolYear) | ||
OR UPDATE(SectionIdentifier) | ||
OR UPDATE(SessionName) | ||
OR UPDATE(StudentUSI) | ||
BEGIN | ||
-- Update the LastModifiedDate in the root table to the current UTC time | ||
UPDATE rt | ||
SET rt.LastModifiedDate = GETUTCDATE() | ||
FROM [edfi].[StudentCompetencyObjective] rt | ||
INNER JOIN inserted i | ||
ON rt.GradingPeriodDescriptorId = i.GradingPeriodDescriptorId | ||
AND rt.GradingPeriodSequence = i.GradingPeriodSequence | ||
AND rt.GradingPeriodSchoolId = i.GradingPeriodSchoolId | ||
AND rt.GradingPeriodSchoolYear = i.GradingPeriodSchoolYear | ||
AND rt.ObjectiveEducationOrganizationId = i.ObjectiveEducationOrganizationId | ||
AND rt.Objective = i.Objective | ||
AND rt.ObjectiveGradeLevelDescriptorId = i.ObjectiveGradeLevelDescriptorId | ||
AND rt.StudentUSI = i.StudentUSI; | ||
END | ||
END; | ||
GO | ||
|
||
CREATE TRIGGER [edfi].[edfi_StudentLearningObjectiveStudentSectionAssociation_TR_StudentLearningObjective_Update] | ||
ON [edfi].[StudentLearningObjectiveStudentSectionAssociation] | ||
AFTER UPDATE | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
-- Check if any volatile foreign key values have changed | ||
IF UPDATE(BeginDate) | ||
OR UPDATE(LocalCourseCode) | ||
OR UPDATE(SchoolId) | ||
OR UPDATE(SchoolYear) | ||
OR UPDATE(SectionIdentifier) | ||
OR UPDATE(SessionName) | ||
OR UPDATE(StudentUSI) | ||
BEGIN | ||
-- Update the LastModifiedDate in the root table to the current UTC time | ||
UPDATE rt | ||
SET rt.LastModifiedDate = GETUTCDATE() | ||
FROM [edfi].[StudentLearningObjective] rt | ||
INNER JOIN inserted i | ||
ON rt.GradingPeriodDescriptorId = i.GradingPeriodDescriptorId | ||
AND rt.GradingPeriodSequence = i.GradingPeriodSequence | ||
AND rt.GradingPeriodSchoolId = i.GradingPeriodSchoolId | ||
AND rt.GradingPeriodSchoolYear = i.GradingPeriodSchoolYear | ||
AND rt.LearningObjectiveId = i.LearningObjectiveId | ||
AND rt.Namespace = i.Namespace | ||
AND rt.StudentUSI = i.StudentUSI; | ||
END | ||
END; | ||
GO | ||
|
||
CREATE TRIGGER [edfi].[edfi_StudentSectionAttendanceEventClassPeriod_TR_StudentSectionAttendanceEvent_Update] | ||
ON [edfi].[StudentSectionAttendanceEventClassPeriod] | ||
AFTER UPDATE | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
-- Check if any volatile foreign key values have changed | ||
IF UPDATE(ClassPeriodName) | ||
OR UPDATE(SchoolId) | ||
BEGIN | ||
-- Update the LastModifiedDate in the root table to the current UTC time | ||
UPDATE rt | ||
SET rt.LastModifiedDate = GETUTCDATE() | ||
FROM [edfi].[StudentSectionAttendanceEvent] rt | ||
INNER JOIN inserted i | ||
ON rt.AttendanceEventCategoryDescriptorId = i.AttendanceEventCategoryDescriptorId | ||
AND rt.EventDate = i.EventDate | ||
AND rt.LocalCourseCode = i.LocalCourseCode | ||
AND rt.SchoolId = i.SchoolId | ||
AND rt.SchoolYear = i.SchoolYear | ||
AND rt.SectionIdentifier = i.SectionIdentifier | ||
AND rt.SessionName = i.SessionName | ||
AND rt.StudentUSI = i.StudentUSI; | ||
END | ||
END; | ||
GO | ||
|
Oops, something went wrong.