-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ODS-6548] Remove clustered indexes from authorization views for SQL Server #1182
Conversation
DROP INDEX UX_EducationOrganizationIdToStudentUSI ON auth.EducationOrganizationIdToStudentUSI; | ||
GO | ||
|
||
IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'auth.EducationOrganizationIdToStudentUSI')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use CREATE OR ALTER VIEW
below instead -- and then remove this block.
DROP INDEX UX_EducationOrganizationIdToParentUSI ON auth.EducationOrganizationIdToParentUSI; | ||
GO | ||
|
||
IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'auth.EducationOrganizationIdToParentUSI')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CREATE OR ALTER VIEW
is already in use below, so no need for this block.
GO | ||
|
||
CREATE OR ALTER VIEW auth.EducationOrganizationIdToParentUSI AS | ||
SELECT edOrgs.SourceEducationOrganizationId, spa.ParentUSI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you've missed the COUNT_BIG
part of the SQL statement on this one. I haven't built it locally, but from migration scripts in the folder, it seems like the most recent version is the "1350" file, which has it.
Please modify this SQL as follows:
CREATE OR ALTER VIEW auth.EducationOrganizationIdToParentUSI
SELECT edOrgs.SourceEducationOrganizationId, spa.ParentUSI, COUNT_BIG(*) AS Ignored
FROM auth.EducationOrganizationIdToEducationOrganizationId edOrgs
INNER JOIN edfi.StudentSchoolAssociation ssa
ON edOrgs.TargetEducationOrganizationId = ssa.SchoolId
INNER JOIN edfi.StudentParentAssociation spa
ON ssa.StudentUSI = spa.StudentUSI
GROUP BY edOrgs.SourceEducationOrganizationId, spa.ParentUSI
GROUP BY edOrgs.SourceEducationOrganizationId, spa.ParentUSI | ||
GO | ||
|
||
IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'auth.EducationOrganizationIdToStaffUSI')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use CREATE OR ALTER VIEW
below instead -- and then remove this block.
ON edOrgs.TargetEducationOrganizationId = seo_empl.EducationOrganizationId | ||
GO | ||
|
||
IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'auth.EducationOrganizationIdToStudentUSIThroughResponsibility')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use CREATE OR ALTER VIEW
below instead -- and then remove this block.
DROP VIEW auth.EducationOrganizationIdToStudentUSIThroughResponsibility; | ||
GO | ||
|
||
CREATE VIEW auth.EducationOrganizationIdToStudentUSIThroughResponsibility AS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use CREATE OR ALTER VIEW
instead.
GROUP BY edOrgs.SourceEducationOrganizationId, spa.ContactUSI | ||
GO | ||
|
||
IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'auth.EducationOrganizationIdToStaffUSI')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use CREATE OR ALTER VIEW
below instead -- and then remove this block.
ON edOrgs.TargetEducationOrganizationId = seo_empl.EducationOrganizationId | ||
GO | ||
|
||
IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'auth.EducationOrganizationIdToStudentUSIThroughResponsibility')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use CREATE OR ALTER VIEW
below instead -- and then remove this block.
INNER JOIN edfi.StudentEducationOrganizationResponsibilityAssociation seora | ||
ON edOrgs.TargetEducationOrganizationId = seora.EducationOrganizationId | ||
GROUP BY edOrgs.SourceEducationOrganizationId, seora.StudentUSI | ||
GO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a blank line at the end of the file.
INNER JOIN edfi.StudentEducationOrganizationResponsibilityAssociation seora | ||
ON edOrgs.TargetEducationOrganizationId = seora.EducationOrganizationId | ||
GROUP BY edOrgs.SourceEducationOrganizationId, seora.StudentUSI | ||
GO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a blank line at the end of the file.
@gmcelhanon @mjaksn Ready for review again . Thank you ! |
No description provided.