Skip to content
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

Release: development into main #545

Merged
merged 116 commits into from
Feb 29, 2024
Merged

Release: development into main #545

merged 116 commits into from
Feb 29, 2024

Conversation

Iain-Stanger
Copy link
Contributor

  • Release V1.6.0

jimwashbrook and others added 30 commits January 24, 2024 11:08
* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* terraform-docs: automated action

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: wip templates for adrs

* docs: draft highlevel mapping info

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* fix: check answers page title

* fix: remove line

* Linted Code in Dfe.PlanTech.Web/

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: handle textBodyDB entity being empty - possible fix
* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* terraform-docs: automated action

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: wip templates for adrs

* docs: draft highlevel mapping info

* docs: pad out adrs

* docs: add caching adr

* docs: Expand contentful caching process

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* wip

* feat: process options

* feat: support preview in cmsdbcontext

* tests: tests for save + autosave

* feat: add contentfuloptions to web proj

* fix: add default usepreview

* fix: correctly get ContentfulOptions in dbcontext

* chore: remove unneeded param, add docs

* chore: refactor ignore message condition
* fix: Add parameterless constructor again to fix tests

* chore: code cleanup recommendations

* fix: Remove this.getservice as causing errors
* feat: Hotfixes (#492)

* draft: docs: Caching documentation (#460)

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* terraform-docs: automated action

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: wip templates for adrs

* docs: draft highlevel mapping info

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: handle textBodyDB entity being empty - possible fix

* Linted Code in Dfe.PlanTech.Domain/

* ignore mapping of rich text id

* fix: Check answers page title (#487)

* fix: check answers page title

* fix: remove line

* Linted Code in Dfe.PlanTech.Web/

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* feat: Add caching docs (#486)

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* terraform-docs: automated action

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: wip templates for adrs

* docs: draft highlevel mapping info

* docs: pad out adrs

* docs: add caching adr

* docs: Expand contentful caching process

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* feat: Support preview mode in Content db (#489)

* wip

* feat: process options

* feat: support preview in cmsdbcontext

* tests: tests for save + autosave

* feat: add contentfuloptions to web proj

* fix: add default usepreview

* fix: correctly get ContentfulOptions in dbcontext

* chore: remove unneeded param, add docs

* chore: refactor ignore message condition

* fix: Azure Function Tests (#490)

* fix: Add parameterless constructor again to fix tests

* chore: code cleanup recommendations

* fix: Remove this.getservice as causing errors

* fix: service config issue

* refactor: use guard statement for cleaner code

* refactor: create only adds contentcomponent

* refactor: revert changes and skip create event

* refactor: only save or auto_save when a new entity has all its required fields

* test: update tests

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: uahussain12 <“umar.hussain@and.digital”>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: uahussain12 <uahussain12@users.noreply.github.com>
Co-authored-by: Zac King <zac.king@and.digital>
Co-authored-by: Iain STANGER <Iain.STANGER@EDUCATION.GOV.UK>
Co-authored-by: Zac <119302767+Zac-AND-Digital@users.noreply.github.com>

* wip: validating pages dynamically

* wip: validate textbodies

* wip

* wip: move validations to separate files

* feat: validate paragraphs

* feat: validate table

* feat: use class, add comments

* chore: rearrange files

* chore: add docs

* chore: delete moved files

* fix: add missing comma

* fix: file names, null data

* fix: add relative path

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: uahussain12 <“umar.hussain@and.digital”>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: uahussain12 <uahussain12@users.noreply.github.com>
Co-authored-by: Zac King <zac.king@and.digital>
Co-authored-by: Iain STANGER <Iain.STANGER@EDUCATION.GOV.UK>
Co-authored-by: Zac <119302767+Zac-AND-Digital@users.noreply.github.com>
* feat: Hotfixes (#492)

* draft: docs: Caching documentation (#460)

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* terraform-docs: automated action

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: wip templates for adrs

* docs: draft highlevel mapping info

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: handle textBodyDB entity being empty - possible fix

* Linted Code in Dfe.PlanTech.Domain/

* ignore mapping of rich text id

* fix: Check answers page title (#487)

* fix: check answers page title

* fix: remove line

* Linted Code in Dfe.PlanTech.Web/

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* feat: Add caching docs (#486)

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* terraform-docs: automated action

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: wip templates for adrs

* docs: draft highlevel mapping info

* docs: pad out adrs

* docs: add caching adr

* docs: Expand contentful caching process

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* feat: Support preview mode in Content db (#489)

* wip

* feat: process options

* feat: support preview in cmsdbcontext

* tests: tests for save + autosave

* feat: add contentfuloptions to web proj

* fix: add default usepreview

* fix: correctly get ContentfulOptions in dbcontext

* chore: remove unneeded param, add docs

* chore: refactor ignore message condition

* fix: Azure Function Tests (#490)

* fix: Add parameterless constructor again to fix tests

* chore: code cleanup recommendations

* fix: Remove this.getservice as causing errors

* fix: service config issue

* refactor: use guard statement for cleaner code

* refactor: create only adds contentcomponent

* refactor: revert changes and skip create event

* refactor: only save or auto_save when a new entity has all its required fields

* test: update tests

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: uahussain12 <“umar.hussain@and.digital”>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: uahussain12 <uahussain12@users.noreply.github.com>
Co-authored-by: Zac King <zac.king@and.digital>
Co-authored-by: Iain STANGER <Iain.STANGER@EDUCATION.GOV.UK>
Co-authored-by: Zac <119302767+Zac-AND-Digital@users.noreply.github.com>

* wip: validating pages dynamically

* wip: validate textbodies

* wip

* wip: move validations to separate files

* feat: validate paragraphs

* feat: validate table

* feat: use class, add comments

* chore: rearrange files

* chore: add docs

* chore: delete moved files

* fix: missing comma

* fix: remove file

* feaT: Process sections and categories on /self-assessment page

* fix: skip test due to missing data

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: uahussain12 <“umar.hussain@and.digital”>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: uahussain12 <uahussain12@users.noreply.github.com>
Co-authored-by: Zac King <zac.king@and.digital>
Co-authored-by: Iain STANGER <Iain.STANGER@EDUCATION.GOV.UK>
Co-authored-by: Zac <119302767+Zac-AND-Digital@users.noreply.github.com>
* feat: Hotfixes (#492)

* draft: docs: Caching documentation (#460)

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* terraform-docs: automated action

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: wip templates for adrs

* docs: draft highlevel mapping info

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: handle textBodyDB entity being empty - possible fix

* Linted Code in Dfe.PlanTech.Domain/

* ignore mapping of rich text id

* fix: Check answers page title (#487)

* fix: check answers page title

* fix: remove line

* Linted Code in Dfe.PlanTech.Web/

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* feat: Add caching docs (#486)

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* terraform-docs: automated action

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: initial documentation templates

* docs: add other headers

* docs: overview of readpage

* docs: add db schema

* docs: more caching process documentation

* docs: Update CMS schema diagram

* docs: Add dbdiagram code for schema

* docs: Finish Contentful caching process doc

* docs: wip templates for adrs

* docs: draft highlevel mapping info

* docs: pad out adrs

* docs: add caching adr

* docs: Expand contentful caching process

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* feat: Support preview mode in Content db (#489)

* wip

* feat: process options

* feat: support preview in cmsdbcontext

* tests: tests for save + autosave

* feat: add contentfuloptions to web proj

* fix: add default usepreview

* fix: correctly get ContentfulOptions in dbcontext

* chore: remove unneeded param, add docs

* chore: refactor ignore message condition

* fix: Azure Function Tests (#490)

* fix: Add parameterless constructor again to fix tests

* chore: code cleanup recommendations

* fix: Remove this.getservice as causing errors

* fix: service config issue

* refactor: use guard statement for cleaner code

* refactor: create only adds contentcomponent

* refactor: revert changes and skip create event

* refactor: only save or auto_save when a new entity has all its required fields

* test: update tests

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: uahussain12 <“umar.hussain@and.digital”>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: uahussain12 <uahussain12@users.noreply.github.com>
Co-authored-by: Zac King <zac.king@and.digital>
Co-authored-by: Iain STANGER <Iain.STANGER@EDUCATION.GOV.UK>
Co-authored-by: Zac <119302767+Zac-AND-Digital@users.noreply.github.com>

* wip: validating pages dynamically

* wip: validate textbodies

* wip

* wip: move validations to separate files

* feat: validate paragraphs

* feat: validate table

* feat: use class, add comments

* chore: rearrange files

* chore: add docs

* chore: delete moved files

* fix: missing comma

* refactor: cleanup duplicated code.

* merge development

* chore: delete old dupe files

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: uahussain12 <“umar.hussain@and.digital”>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: uahussain12 <uahussain12@users.noreply.github.com>
Co-authored-by: Zac King <zac.king@and.digital>
Co-authored-by: Iain STANGER <Iain.STANGER@EDUCATION.GOV.UK>
Co-authored-by: Zac <119302767+Zac-AND-Digital@users.noreply.github.com>
refactor/194327 - Azure Function Pipeline Optimisation
* fix: 💄 css stylings

Fixes 197437
197630

Doesn't fix 197620 intentionally as incorrect.

* fix: Remove outdated copying of a specific file
Copy link
Contributor

SQL Risks Found

./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230725_166107_ModifyGetSectionStatusesSprocFix.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230725_166107_ModifyGetSectionStatusesSprocFix.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: alter procedure getsectionstatuses @splitstringval nvarchar(255) as declare @val
nvarchar(50) create table #splittable(val nvarchar(50)) create table
#returntable(sectionid nvarchar(50), completed int, maturity nvarchar(20),
datecreated datetime) insert into #splittable select * from
string_split(@splitstringval, ',') declare db_cursor cursor for select val from
#splittable open db_cursor fetch next from db_cursor into @val while
@@fetch_status = 0 begin insert into #returntable select top 1 sectionid,
completed, maturity, datecreated from submission where sectionid = @val order by
datecreated desc fetch next from db_cursor into @val end close db_cursor
deallocate db_cursor select * from #returntable;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230725_166107_ModifyGetSectionStatusesSprocFix.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at lines 8, 28]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230921_1150_DeleteAnalyticsUser.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230921_1150_DeleteAnalyticsUser.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: if exists (select * from sys.database_principals where name = 'analyticsuser')
begin drop user [analyticsuser] end;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230921_1150_DeleteAnalyticsUser.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at line 1]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230922_1420_UpdateGetSectionStatusToAcceptEstablishmentId.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230922_1420_UpdateGetSectionStatusToAcceptEstablishmentId.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: alter procedure getsectionstatuses @splitstringval nvarchar(255),
@establishmentid int as declare @val nvarchar(50) create table #splittable(val
nvarchar(50)) create table #returntable(sectionid nvarchar(50), completed int,
maturity nvarchar(20), datecreated datetime) insert into #splittable select *
from string_split(@splitstringval, ',') declare db_cursor cursor for select val
from #splittable open db_cursor fetch next from db_cursor into @val while
@@fetch_status = 0 begin insert into #returntable select top 1 sectionid,
completed, maturity, datecreated from submission where sectionid = @val and
establishmentid = @establishmentid order by datecreated desc fetch next from
db_cursor into @val end close db_cursor deallocate db_cursor select * from
#returntable;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230922_1420_UpdateGetSectionStatusToAcceptEstablishmentId.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at lines 10, 31]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230718_168650_GetSectionStatusesSproc.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230718_168650_GetSectionStatusesSproc.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: create procedure getsectionstatuses @splitstringval nvarchar(255) as declare
@val nvarchar(50) create table #splittable(val nvarchar(50)) create table
#returntable(sectionid nvarchar(50), completed int) insert into #splittable
select * from string_split(@splitstringval, ',') declare db_cursor cursor for
select val from #splittable open db_cursor fetch next from db_cursor into @val
while @@fetch_status = 0 begin insert into #returntable select top 1 sectionid,
completed from submission where sectionid = @val order by datecreated desc fetch
next from db_cursor into @val end close db_cursor deallocate db_cursor select *
from #returntable;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230718_168650_GetSectionStatusesSproc.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at lines 8, 29]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230913_1224_UpdateSubmissionNullability.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230913_1224_UpdateSubmissionNullability.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: begin tran select id into #submissionids from [dbo].[submission] where sectionid
is null or sectionname is null delete from [dbo].[response] where exists (select
* from #submissionids where submissionid = #submissionids.id) delete from
[dbo].[submission] where sectionid is null or sectionname is null alter table
[dbo].[submission] alter column [sectionid] [nvarchar](50) not null alter table
[dbo].[submission] alter column [sectionname] [nvarchar](50) not null alter
table [dbo].[submission] drop column [recomendationid] commit tran;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230913_1224_UpdateSubmissionNullability.sql]: (HIGH RISK) (LOGICAL_DATABASE_DESIGN ANTI-PATTERN) Generic Primary Key
[Matching Expression: id at line 2]

[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230913_1224_UpdateSubmissionNullability.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at line 4]


==================== Summary ===================
All Anti-Patterns and Hints  :: 2
>  High Risk   :: 2
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230725_166107_ModifyGetSectionStatusesSproc.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230725_166107_ModifyGetSectionStatusesSproc.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: alter procedure getsectionstatuses @splitstringval nvarchar(255) as declare @val
nvarchar(50) create table #splittable(val nvarchar(50)) create table
#returntable(sectionid nvarchar(50), completed int) insert into #splittable
select * from string_split(@splitstringval, ',') declare db_cursor cursor for
select val from #splittable open db_cursor fetch next from db_cursor into @val
while @@fetch_status = 0 begin insert into #returntable select top 1 sectionid,
completed, maturity, datecreated from submission where sectionid = @val order by
datecreated desc fetch next from db_cursor into @val end close db_cursor
deallocate db_cursor select * from #returntable;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230725_166107_ModifyGetSectionStatusesSproc.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at lines 8, 29]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240111_0919_CreateAllRichTextContentForPageSlugFunction.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240111_0919_CreateAllRichTextContentForPageSlugFunction.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 2: create function [contentful].[selectallrichtextcontentforpageslug] ( @pageslug
nvarchar(max) ) returns @returntable table(id bigint, [value] nvarchar(max),
nodetype nvarchar(max), dataid bigint, parentid bigint) begin declare
@contentcomponentids table (id nvarchar(max)) declare @richtextids table (id
nvarchar(max)) insert into @contentcomponentids select
concat([beforecontentcomponentid], [contentcomponentid]) contentcomponentid from
[contentful].[pagecontents] pc left join [contentful].[pages] p on pc.pageid =
p.id where p.slug = @pageslug insert into @richtextids select richtextid from
[contentful].[textbodies] where id in (select * from @contentcomponentids) union
select richtextid from [contentful].[warnings] as w left join
[contentful].[textbodies] as tb on w.textid = tb.id where w.id in (select * from
@contentcomponentids) declare @idcolumn int select @idcolumn = min(id) from
@richtextids while @idcolumn is not null begin insert into @returntable select
[id], [value], [nodetype], [dataid], [parentid] from
[contentful].[selectallrichtextcontentforparentid](@idcolumn) select @idcolumn =
min(id) from @richtextids where id > @idcolumn end return end;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240111_0919_CreateAllRichTextContentForPageSlugFunction.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at lines 16, 20]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240219_1407_FixWarningComponent.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240219_1407_FixWarningComponent.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: create or alter view [contentful].[richtextcontentsbyslug] as ( select [slug],
[id], [value], [nodetype], [dataid], [parentid], [published], [archived],
[deleted] from ( select [richtextid], [slug], [archived], [deleted], [published]
from ( --- get richtextids for all text bodies and warnings select [richtextid],
isnull([warning].[id], [tb].[id]) as contentid from [contentful].[textbodies] as
tb left join [contentful].warnings as warning on [warning].[textid] = [tb].[id]
) as richtexts left join --get all contents for a page ( select max([slug]) as
[slug], [contentid] from ( select isnull( [beforecontentcomponentid],
[contentcomponentid] ) as [contentid], [p].[slug] from
[contentful].[pagecontents] pc left join [contentful].[pages] p on [pc].[pageid]
= [p].[id] ) as pc group by [pc].[contentid] ) as contents on
[contents].[contentid] = [richtexts].[contentid] left join( select [id],
[archived], [published], [deleted] from [contentful].[contentcomponents] ) as cc
on [cc].[id] = [richtexts].[contentid] ) as richtextcontents outer apply (
select [id], [value], [nodetype], [dataid], [parentid] from
[contentful].[selectallrichtextcontentforparentid]([richtextcontents].[richtextid]) ) as richtextcontentswithslug );
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240219_1407_FixWarningComponent.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) JOIN Without Equality Check
[Matching Expression: join --get all contents for a page ( select max([slug]) as [slug], [contentid]
from ( select isnull( [beforecontentcomponentid], [contentcomponentid] ) as
[contentid], [p].[slug] from [contentful].[pagecontents] pc left at line 31]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240209_1647_CreateRichTextContentWithPageSlugView.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240209_1647_CreateRichTextContentWithPageSlugView.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: create or alter view [contentful].[richtextcontentsbyslug] as ( select [slug],
[id], [value], [nodetype], [dataid], [parentid], [published], [archived],
[deleted] from ( select [richtextid], [slug], [archived], [deleted], [published]
from ( --- get richtextids for all text bodies and warnings select [richtextid],
[id] as [contentid] from [contentful].[textbodies] as tb union select
[richtextid], [tb].[id] as [contentid] from [contentful].[warnings] as w left
join [contentful].[textbodies] as tb on [w].[textid] = [tb].[id] ) as richtexts
left join --get all contents for a page ( select max([slug]) as [slug],
[contentid] from ( select isnull( [beforecontentcomponentid],
[contentcomponentid] ) as [contentid], [p].[slug] from
[contentful].[pagecontents] pc left join [contentful].[pages] p on [pc].[pageid]
= [p].[id] ) as pc group by [pc].[contentid] ) as contents on
[contents].[contentid] = [richtexts].[contentid] left join( select [id],
[archived], [published], [deleted] from [contentful].[contentcomponents] ) as cc
on [cc].[id] = [richtexts].[contentid] ) as richtextcontents outer apply (
select [id], [value], [nodetype], [dataid], [parentid] from
[contentful].[selectallrichtextcontentforparentid]([richtextcontents].[richtextid]) ) as richtextcontentswithslug );
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240209_1647_CreateRichTextContentWithPageSlugView.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) JOIN Without Equality Check
[Matching Expression: join --get all contents for a page ( select max([slug]) as [slug], [contentid]
from ( select isnull( [beforecontentcomponentid], [contentcomponentid] ) as
[contentid], [p].[slug] from [contentful].[pagecontents] pc left at line 37]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/EnvironmentSpecificScripts/dev/2023/20230810_110900_DeleteDataForEstablishmentSproc.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/EnvironmentSpecificScripts/dev/2023/20230810_110900_DeleteDataForEstablishmentSproc.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: create procedure [dbo].[deletedataforestablishment] @establishmentref
nvarchar(50) as begin try begin tran declare @establishmentuid int declare
@rowsdeletedcount int select @establishmentuid = id from [dbo].[establishment]
where establishmentref = @establishmentref select id, establishmentid into
#submissionids from [dbo].[submission] where [submission].establishmentid =
@establishmentuid delete from[dbo].[response] where exists (select * from
#submissionids where [response].submissionid = #submissionids.id) delete from
[dbo].[submission] where [submission].establishmentid = @establishmentuid commit
tran return @@rowcount end try begin catch rollback tran return 0 end catch;
[./src/Dfe.PlanTech.DatabaseUpgrader/EnvironmentSpecificScripts/dev/2023/20230810_110900_DeleteDataForEstablishmentSproc.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at line 17]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0

Copy link

* cicd: don't lint if dir not had changes

* feat: add order columnt ot able

* fix: remove incorrect changes
@jimwashbrook jimwashbrook merged commit 04c1f7b into main Feb 29, 2024
18 of 20 checks passed
Copy link
Contributor

SQL Risks Found

./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230725_166107_ModifyGetSectionStatusesSprocFix.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230725_166107_ModifyGetSectionStatusesSprocFix.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: alter procedure getsectionstatuses @splitstringval nvarchar(255) as declare @val
nvarchar(50) create table #splittable(val nvarchar(50)) create table
#returntable(sectionid nvarchar(50), completed int, maturity nvarchar(20),
datecreated datetime) insert into #splittable select * from
string_split(@splitstringval, ',') declare db_cursor cursor for select val from
#splittable open db_cursor fetch next from db_cursor into @val while
@@fetch_status = 0 begin insert into #returntable select top 1 sectionid,
completed, maturity, datecreated from submission where sectionid = @val order by
datecreated desc fetch next from db_cursor into @val end close db_cursor
deallocate db_cursor select * from #returntable;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230725_166107_ModifyGetSectionStatusesSprocFix.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at lines 8, 28]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230921_1150_DeleteAnalyticsUser.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230921_1150_DeleteAnalyticsUser.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: if exists (select * from sys.database_principals where name = 'analyticsuser')
begin drop user [analyticsuser] end;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230921_1150_DeleteAnalyticsUser.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at line 1]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230922_1420_UpdateGetSectionStatusToAcceptEstablishmentId.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230922_1420_UpdateGetSectionStatusToAcceptEstablishmentId.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: alter procedure getsectionstatuses @splitstringval nvarchar(255),
@establishmentid int as declare @val nvarchar(50) create table #splittable(val
nvarchar(50)) create table #returntable(sectionid nvarchar(50), completed int,
maturity nvarchar(20), datecreated datetime) insert into #splittable select *
from string_split(@splitstringval, ',') declare db_cursor cursor for select val
from #splittable open db_cursor fetch next from db_cursor into @val while
@@fetch_status = 0 begin insert into #returntable select top 1 sectionid,
completed, maturity, datecreated from submission where sectionid = @val and
establishmentid = @establishmentid order by datecreated desc fetch next from
db_cursor into @val end close db_cursor deallocate db_cursor select * from
#returntable;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230922_1420_UpdateGetSectionStatusToAcceptEstablishmentId.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at lines 10, 31]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230718_168650_GetSectionStatusesSproc.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230718_168650_GetSectionStatusesSproc.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: create procedure getsectionstatuses @splitstringval nvarchar(255) as declare
@val nvarchar(50) create table #splittable(val nvarchar(50)) create table
#returntable(sectionid nvarchar(50), completed int) insert into #splittable
select * from string_split(@splitstringval, ',') declare db_cursor cursor for
select val from #splittable open db_cursor fetch next from db_cursor into @val
while @@fetch_status = 0 begin insert into #returntable select top 1 sectionid,
completed from submission where sectionid = @val order by datecreated desc fetch
next from db_cursor into @val end close db_cursor deallocate db_cursor select *
from #returntable;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230718_168650_GetSectionStatusesSproc.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at lines 8, 29]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230913_1224_UpdateSubmissionNullability.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230913_1224_UpdateSubmissionNullability.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: begin tran select id into #submissionids from [dbo].[submission] where sectionid
is null or sectionname is null delete from [dbo].[response] where exists (select
* from #submissionids where submissionid = #submissionids.id) delete from
[dbo].[submission] where sectionid is null or sectionname is null alter table
[dbo].[submission] alter column [sectionid] [nvarchar](50) not null alter table
[dbo].[submission] alter column [sectionname] [nvarchar](50) not null alter
table [dbo].[submission] drop column [recomendationid] commit tran;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230913_1224_UpdateSubmissionNullability.sql]: (HIGH RISK) (LOGICAL_DATABASE_DESIGN ANTI-PATTERN) Generic Primary Key
[Matching Expression: id at line 2]

[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230913_1224_UpdateSubmissionNullability.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at line 4]


==================== Summary ===================
All Anti-Patterns and Hints  :: 2
>  High Risk   :: 2
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230725_166107_ModifyGetSectionStatusesSproc.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230725_166107_ModifyGetSectionStatusesSproc.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: alter procedure getsectionstatuses @splitstringval nvarchar(255) as declare @val
nvarchar(50) create table #splittable(val nvarchar(50)) create table
#returntable(sectionid nvarchar(50), completed int) insert into #splittable
select * from string_split(@splitstringval, ',') declare db_cursor cursor for
select val from #splittable open db_cursor fetch next from db_cursor into @val
while @@fetch_status = 0 begin insert into #returntable select top 1 sectionid,
completed, maturity, datecreated from submission where sectionid = @val order by
datecreated desc fetch next from db_cursor into @val end close db_cursor
deallocate db_cursor select * from #returntable;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2023/20230725_166107_ModifyGetSectionStatusesSproc.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at lines 8, 29]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240111_0919_CreateAllRichTextContentForPageSlugFunction.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240111_0919_CreateAllRichTextContentForPageSlugFunction.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 2: create function [contentful].[selectallrichtextcontentforpageslug] ( @pageslug
nvarchar(max) ) returns @returntable table(id bigint, [value] nvarchar(max),
nodetype nvarchar(max), dataid bigint, parentid bigint) begin declare
@contentcomponentids table (id nvarchar(max)) declare @richtextids table (id
nvarchar(max)) insert into @contentcomponentids select
concat([beforecontentcomponentid], [contentcomponentid]) contentcomponentid from
[contentful].[pagecontents] pc left join [contentful].[pages] p on pc.pageid =
p.id where p.slug = @pageslug insert into @richtextids select richtextid from
[contentful].[textbodies] where id in (select * from @contentcomponentids) union
select richtextid from [contentful].[warnings] as w left join
[contentful].[textbodies] as tb on w.textid = tb.id where w.id in (select * from
@contentcomponentids) declare @idcolumn int select @idcolumn = min(id) from
@richtextids while @idcolumn is not null begin insert into @returntable select
[id], [value], [nodetype], [dataid], [parentid] from
[contentful].[selectallrichtextcontentforparentid](@idcolumn) select @idcolumn =
min(id) from @richtextids where id > @idcolumn end return end;
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240111_0919_CreateAllRichTextContentForPageSlugFunction.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at lines 16, 20]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240219_1407_FixWarningComponent.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240219_1407_FixWarningComponent.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: create or alter view [contentful].[richtextcontentsbyslug] as ( select [slug],
[id], [value], [nodetype], [dataid], [parentid], [published], [archived],
[deleted] from ( select [richtextid], [slug], [archived], [deleted], [published]
from ( --- get richtextids for all text bodies and warnings select [richtextid],
isnull([warning].[id], [tb].[id]) as contentid from [contentful].[textbodies] as
tb left join [contentful].warnings as warning on [warning].[textid] = [tb].[id]
) as richtexts left join --get all contents for a page ( select max([slug]) as
[slug], [contentid] from ( select isnull( [beforecontentcomponentid],
[contentcomponentid] ) as [contentid], [p].[slug] from
[contentful].[pagecontents] pc left join [contentful].[pages] p on [pc].[pageid]
= [p].[id] ) as pc group by [pc].[contentid] ) as contents on
[contents].[contentid] = [richtexts].[contentid] left join( select [id],
[archived], [published], [deleted] from [contentful].[contentcomponents] ) as cc
on [cc].[id] = [richtexts].[contentid] ) as richtextcontents outer apply (
select [id], [value], [nodetype], [dataid], [parentid] from
[contentful].[selectallrichtextcontentforparentid]([richtextcontents].[richtextid]) ) as richtextcontentswithslug );
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240219_1407_FixWarningComponent.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) JOIN Without Equality Check
[Matching Expression: join --get all contents for a page ( select max([slug]) as [slug], [contentid]
from ( select isnull( [beforecontentcomponentid], [contentcomponentid] ) as
[contentid], [p].[slug] from [contentful].[pagecontents] pc left at line 31]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240209_1647_CreateRichTextContentWithPageSlugView.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240209_1647_CreateRichTextContentWithPageSlugView.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: create or alter view [contentful].[richtextcontentsbyslug] as ( select [slug],
[id], [value], [nodetype], [dataid], [parentid], [published], [archived],
[deleted] from ( select [richtextid], [slug], [archived], [deleted], [published]
from ( --- get richtextids for all text bodies and warnings select [richtextid],
[id] as [contentid] from [contentful].[textbodies] as tb union select
[richtextid], [tb].[id] as [contentid] from [contentful].[warnings] as w left
join [contentful].[textbodies] as tb on [w].[textid] = [tb].[id] ) as richtexts
left join --get all contents for a page ( select max([slug]) as [slug],
[contentid] from ( select isnull( [beforecontentcomponentid],
[contentcomponentid] ) as [contentid], [p].[slug] from
[contentful].[pagecontents] pc left join [contentful].[pages] p on [pc].[pageid]
= [p].[id] ) as pc group by [pc].[contentid] ) as contents on
[contents].[contentid] = [richtexts].[contentid] left join( select [id],
[archived], [published], [deleted] from [contentful].[contentcomponents] ) as cc
on [cc].[id] = [richtexts].[contentid] ) as richtextcontents outer apply (
select [id], [value], [nodetype], [dataid], [parentid] from
[contentful].[selectallrichtextcontentforparentid]([richtextcontents].[richtextid]) ) as richtextcontentswithslug );
[./src/Dfe.PlanTech.DatabaseUpgrader/Scripts/2024/20240209_1647_CreateRichTextContentWithPageSlugView.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) JOIN Without Equality Check
[Matching Expression: join --get all contents for a page ( select max([slug]) as [slug], [contentid]
from ( select isnull( [beforecontentcomponentid], [contentcomponentid] ) as
[contentid], [p].[slug] from [contentful].[pagecontents] pc left at line 37]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0
./src/Dfe.PlanTech.DatabaseUpgrader/EnvironmentSpecificScripts/dev/2023/20230810_110900_DeleteDataForEstablishmentSproc.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: ./src/Dfe.PlanTech.DatabaseUpgrader/EnvironmentSpecificScripts/dev/2023/20230810_110900_DeleteDataForEstablishmentSproc.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: create procedure [dbo].[deletedataforestablishment] @establishmentref
nvarchar(50) as begin try begin tran declare @establishmentuid int declare
@rowsdeletedcount int select @establishmentuid = id from [dbo].[establishment]
where establishmentref = @establishmentref select id, establishmentid into
#submissionids from [dbo].[submission] where [submission].establishmentid =
@establishmentuid delete from[dbo].[response] where exists (select * from
#submissionids where [response].submissionid = #submissionids.id) delete from
[dbo].[submission] where [submission].establishmentid = @establishmentuid commit
tran return @@rowcount end try begin catch rollback tran return 0 end catch;
[./src/Dfe.PlanTech.DatabaseUpgrader/EnvironmentSpecificScripts/dev/2023/20230810_110900_DeleteDataForEstablishmentSproc.sql]: (HIGH RISK) (QUERY ANTI-PATTERN) SELECT *
[Matching Expression: select * at line 17]


==================== Summary ===================
All Anti-Patterns and Hints  :: 1
>  High Risk   :: 1
>  Medium Risk :: 0
>  Low Risk    :: 0
>  Hints       :: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants