From 67816b997a2c951beb5df52466efb5445af20ad9 Mon Sep 17 00:00:00 2001 From: Young-Jin Chung Date: Wed, 6 May 2020 13:00:21 -0700 Subject: [PATCH 1/9] Version 1.3 --- api/Hmcr.Api/appsettings.json | 2 +- api/Hmcr.Hangfire/appsettings.json | 2 +- openshift/configmaps/api-appsettings.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/Hmcr.Api/appsettings.json b/api/Hmcr.Api/appsettings.json index 98da1cbd..7c98b2ee 100644 --- a/api/Hmcr.Api/appsettings.json +++ b/api/Hmcr.Api/appsettings.json @@ -1,7 +1,7 @@ { "AllowedHosts": "*", "Constants": { - "Version": "1.2.1.0", + "Version": "1.3.0.0", "SwaggerApiUrl": "/swagger/v1/swagger.json" }, "Serilog": { diff --git a/api/Hmcr.Hangfire/appsettings.json b/api/Hmcr.Hangfire/appsettings.json index ca6671a5..592326ec 100644 --- a/api/Hmcr.Hangfire/appsettings.json +++ b/api/Hmcr.Hangfire/appsettings.json @@ -1,7 +1,7 @@ { "AllowedHosts": "*", "Constants": { - "Version": "1.2.0.0", + "Version": "1.3.0.0", "SwaggerApiUrl": "/swagger/v1/swagger.json" }, "Serilog": { diff --git a/openshift/configmaps/api-appsettings.yaml b/openshift/configmaps/api-appsettings.yaml index ce0bd715..2f584bc5 100644 --- a/openshift/configmaps/api-appsettings.yaml +++ b/openshift/configmaps/api-appsettings.yaml @@ -9,7 +9,7 @@ objects: { "AllowedHosts": "*", "Constants": { - "Version": "1.2.1.0", + "Version": "1.3.0.0", "SwaggerApiUrl": "/swagger/v1/swagger.json" }, "Serilog": { From 849ad221434815437f2db796fe6f9c6b409cfeed Mon Sep 17 00:00:00 2001 From: Young-Jin Chung Date: Mon, 11 May 2020 11:39:25 -0700 Subject: [PATCH 2/9] DB script - HMCR-633 --- ...R_PDM-dml_CODE_LOOKUP_CHANGE-V20_S1.21.sql | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 database/V21.1/1_HMR_PDM-dml_CODE_LOOKUP_CHANGE-V20_S1.21.sql diff --git a/database/V21.1/1_HMR_PDM-dml_CODE_LOOKUP_CHANGE-V20_S1.21.sql b/database/V21.1/1_HMR_PDM-dml_CODE_LOOKUP_CHANGE-V20_S1.21.sql new file mode 100644 index 00000000..f850a3dc --- /dev/null +++ b/database/V21.1/1_HMR_PDM-dml_CODE_LOOKUP_CHANGE-V20_S1.21.sql @@ -0,0 +1,23 @@ +/* ---------------------------------------------------------------------- */ +/* Target DBMS: MS SQL Server 2017 */ +/* Project name: Highway Maintenance Reporting */ +/* Author: Ayodeji Kuponiyi */ +/* Script type: DML */ +/* Created on: 2020-05-11 */ +/* ---------------------------------------------------------------------- */ + +USE HMR_DEV; + +/* Updates + JIRA Ticket: https://jira.th.gov.bc.ca/browse/HMCR-633 + + i) Remove major event type as an option from HMR_CODE_LOOKUP. + +*/ + + +IF EXISTS + (SELECT * FROM [dbo].[HMR_CODE_LOOKUP] WHERE CODE_SET = 'WRK_RPT_MAINT_TYPE' AND CODE_NAME = 'Major Event') + DELETE [dbo].[HMR_CODE_LOOKUP] WHERE CODE_SET = 'WRK_RPT_MAINT_TYPE' AND CODE_NAME = 'Major Event'; + +GO \ No newline at end of file From 65055e9cbf7fa99348364bae4341fc4289e07259 Mon Sep 17 00:00:00 2001 From: BcGovNeal <47604552+BcGovNeal@users.noreply.github.com> Date: Tue, 12 May 2020 09:47:18 -0700 Subject: [PATCH 3/9] Hide API Access in quick links (#472) --- client/src/js/components/fragments/Header.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/js/components/fragments/Header.js b/client/src/js/components/fragments/Header.js index dddf9b31..f4fa51bf 100644 --- a/client/src/js/components/fragments/Header.js +++ b/client/src/js/components/fragments/Header.js @@ -104,9 +104,11 @@ const Header = ({ currentUser }) => { Quick Links - - API Access - + {currentUser.userType === Constants.USER_TYPE.INTERNAL && ( + + API Access + + )} Version From 323a13f800a40495464064a67def48fb4c42895b Mon Sep 17 00:00:00 2001 From: Young-Jin Chung Date: Wed, 13 May 2020 07:53:33 -0700 Subject: [PATCH 4/9] Version 1.2.2 --- api/Hmcr.Api/appsettings.json | 2 +- api/Hmcr.Hangfire/appsettings.json | 2 +- openshift/configmaps/api-appsettings.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/Hmcr.Api/appsettings.json b/api/Hmcr.Api/appsettings.json index 7c98b2ee..c90fbe5d 100644 --- a/api/Hmcr.Api/appsettings.json +++ b/api/Hmcr.Api/appsettings.json @@ -1,7 +1,7 @@ { "AllowedHosts": "*", "Constants": { - "Version": "1.3.0.0", + "Version": "1.2.2.0", "SwaggerApiUrl": "/swagger/v1/swagger.json" }, "Serilog": { diff --git a/api/Hmcr.Hangfire/appsettings.json b/api/Hmcr.Hangfire/appsettings.json index 592326ec..b433d146 100644 --- a/api/Hmcr.Hangfire/appsettings.json +++ b/api/Hmcr.Hangfire/appsettings.json @@ -1,7 +1,7 @@ { "AllowedHosts": "*", "Constants": { - "Version": "1.3.0.0", + "Version": "1.2.2.0", "SwaggerApiUrl": "/swagger/v1/swagger.json" }, "Serilog": { diff --git a/openshift/configmaps/api-appsettings.yaml b/openshift/configmaps/api-appsettings.yaml index 2f584bc5..3aac1379 100644 --- a/openshift/configmaps/api-appsettings.yaml +++ b/openshift/configmaps/api-appsettings.yaml @@ -9,7 +9,7 @@ objects: { "AllowedHosts": "*", "Constants": { - "Version": "1.3.0.0", + "Version": "1.2.2.0", "SwaggerApiUrl": "/swagger/v1/swagger.json" }, "Serilog": { From e683bc7fbd2fb9633d36ea9ff2322dc09b4cfc1c Mon Sep 17 00:00:00 2001 From: Young-Jin Chung Date: Wed, 13 May 2020 14:19:00 -0700 Subject: [PATCH 5/9] DB script - clean up PROD DB --- ...ml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22.sql | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 database/V21.1/2_HMR_PDM-dml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22.sql diff --git a/database/V21.1/2_HMR_PDM-dml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22.sql b/database/V21.1/2_HMR_PDM-dml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22.sql new file mode 100644 index 00000000..2ee83120 --- /dev/null +++ b/database/V21.1/2_HMR_PDM-dml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22.sql @@ -0,0 +1,157 @@ +--============================================= +-- Author: Ayodeji Kuponiyi +-- Create date: 2020-05-13 +-- Updates: +-- Deleting submission entries in all relevant tables. +-- ============================================= + +USE HMR_DEV; -- uncomment appropriate instance +--USE HMR_TST; +--USE HMR_UAT; +--USE HMR_PRD; +GO + + +DELETE HMR_WORK_REPORT + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_WORK_REPORT.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER = 19 + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' +) + +DELETE HMR_WORK_REPORT_HIST + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_WORK_REPORT_HIST.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER = 19 + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' +) + + +DELETE HMR_ROCKFALL_REPORT + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_ROCKFALL_REPORT.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER = 19 + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' +) + +DELETE HMR_ROCKFALL_REPORT_HIST + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_ROCKFALL_REPORT_HIST.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER = 19 + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' +) + + +DELETE HMR_WILDLIFE_REPORT + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_WILDLIFE_REPORT.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER = 19 + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' +) + +DELETE HMR_WILDLIFE_REPORT_HIST + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_WILDLIFE_REPORT_HIST.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER = 19 + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' +) + +DELETE HMR_FEEDBACK_MESSAGE + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_FEEDBACK_MESSAGE.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER = 19 + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' +) + + +DELETE HMR_SUBMISSION_ROW + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_SUBMISSION_ROW.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER = 19 + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' +) + +DELETE HMR_SUBMISSION_ROW_HIST + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_SUBMISSION_ROW_HIST.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER = 19 + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' +) + +DELETE HMR_SUBMISSION_OBJECT + + WHERE + SERVICE_AREA_NUMBER = 19 + AND FORMAT(APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' \ No newline at end of file From d6a0324067c9260df5dbd445430dd95ba240b84a Mon Sep 17 00:00:00 2001 From: Young-Jin Chung Date: Thu, 14 May 2020 07:49:55 -0700 Subject: [PATCH 6/9] Increasing command timeout to 600 seconds --- api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs b/api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs index f5fdc5ad..72eea2ae 100644 --- a/api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs +++ b/api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs @@ -79,7 +79,7 @@ public static void AddHmcrControllers(this IServiceCollection services) public static void AddHmcrDbContext(this IServiceCollection services, string connectionString) { - services.AddDbContext(options => options.UseSqlServer(connectionString, x => x.UseNetTopologySuite())); + services.AddDbContext(options => options.UseSqlServer(connectionString, x => x.UseNetTopologySuite().CommandTimeout(600))); } public static void AddHmcrAutoMapper(this IServiceCollection services) From dbc3358bb638c5c41e5ebbab5ef528ec58261c8b Mon Sep 17 00:00:00 2001 From: Young-Jin Chung Date: Thu, 14 May 2020 13:36:19 -0700 Subject: [PATCH 7/9] increase the command timeout to 1800 seconds --- api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs b/api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs index 72eea2ae..d5216016 100644 --- a/api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs +++ b/api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs @@ -79,7 +79,7 @@ public static void AddHmcrControllers(this IServiceCollection services) public static void AddHmcrDbContext(this IServiceCollection services, string connectionString) { - services.AddDbContext(options => options.UseSqlServer(connectionString, x => x.UseNetTopologySuite().CommandTimeout(600))); + services.AddDbContext(options => options.UseSqlServer(connectionString, x => x.UseNetTopologySuite().CommandTimeout(1800))); } public static void AddHmcrAutoMapper(this IServiceCollection services) From f52e3c0ee6c36849c13069402a3e6654705f7ad7 Mon Sep 17 00:00:00 2001 From: Young-Jin Chung Date: Fri, 15 May 2020 14:26:41 -0700 Subject: [PATCH 8/9] DB script to delete submission data --- ...ml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22.sql | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/database/V21.1/2_HMR_PDM-dml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22.sql b/database/V21.1/2_HMR_PDM-dml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22.sql index 2ee83120..3a6f6e16 100644 --- a/database/V21.1/2_HMR_PDM-dml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22.sql +++ b/database/V21.1/2_HMR_PDM-dml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22.sql @@ -1,8 +1,11 @@ ---============================================= +-- ============================================= -- Author: Ayodeji Kuponiyi -- Create date: 2020-05-13 + + + -- Updates: --- Deleting submission entries in all relevant tables. +-- Deleting submission entries in all relevant tables on or before May 06 2020. -- ============================================= USE HMR_DEV; -- uncomment appropriate instance @@ -24,7 +27,7 @@ WHERE EXISTS WHERE so.SUBMISSION_OBJECT_ID = HMR_WORK_REPORT.SUBMISSION_OBJECT_ID AND so.SERVICE_AREA_NUMBER = 19 - AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '06-MAY-2020' ) DELETE HMR_WORK_REPORT_HIST @@ -39,7 +42,7 @@ WHERE EXISTS WHERE so.SUBMISSION_OBJECT_ID = HMR_WORK_REPORT_HIST.SUBMISSION_OBJECT_ID AND so.SERVICE_AREA_NUMBER = 19 - AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '06-MAY-2020' ) @@ -55,7 +58,7 @@ WHERE EXISTS WHERE so.SUBMISSION_OBJECT_ID = HMR_ROCKFALL_REPORT.SUBMISSION_OBJECT_ID AND so.SERVICE_AREA_NUMBER = 19 - AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '06-MAY-2020' ) DELETE HMR_ROCKFALL_REPORT_HIST @@ -70,7 +73,7 @@ WHERE EXISTS WHERE so.SUBMISSION_OBJECT_ID = HMR_ROCKFALL_REPORT_HIST.SUBMISSION_OBJECT_ID AND so.SERVICE_AREA_NUMBER = 19 - AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '06-MAY-2020' ) @@ -86,7 +89,7 @@ WHERE EXISTS WHERE so.SUBMISSION_OBJECT_ID = HMR_WILDLIFE_REPORT.SUBMISSION_OBJECT_ID AND so.SERVICE_AREA_NUMBER = 19 - AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '06-MAY-2020' ) DELETE HMR_WILDLIFE_REPORT_HIST @@ -101,7 +104,7 @@ WHERE EXISTS WHERE so.SUBMISSION_OBJECT_ID = HMR_WILDLIFE_REPORT_HIST.SUBMISSION_OBJECT_ID AND so.SERVICE_AREA_NUMBER = 19 - AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '06-MAY-2020' ) DELETE HMR_FEEDBACK_MESSAGE @@ -116,7 +119,7 @@ WHERE EXISTS WHERE so.SUBMISSION_OBJECT_ID = HMR_FEEDBACK_MESSAGE.SUBMISSION_OBJECT_ID AND so.SERVICE_AREA_NUMBER = 19 - AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '06-MAY-2020' ) @@ -132,7 +135,7 @@ WHERE EXISTS WHERE so.SUBMISSION_OBJECT_ID = HMR_SUBMISSION_ROW.SUBMISSION_OBJECT_ID AND so.SERVICE_AREA_NUMBER = 19 - AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '06-MAY-2020' ) DELETE HMR_SUBMISSION_ROW_HIST @@ -147,11 +150,11 @@ WHERE EXISTS WHERE so.SUBMISSION_OBJECT_ID = HMR_SUBMISSION_ROW_HIST.SUBMISSION_OBJECT_ID AND so.SERVICE_AREA_NUMBER = 19 - AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '06-MAY-2020' ) DELETE HMR_SUBMISSION_OBJECT WHERE SERVICE_AREA_NUMBER = 19 - AND FORMAT(APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '19-MAY-2020' \ No newline at end of file + AND FORMAT(APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '06-MAY-2020' \ No newline at end of file From 2556149055373ed5099543d71449ab0508cd261b Mon Sep 17 00:00:00 2001 From: Young-Jin Chung Date: Wed, 20 May 2020 09:57:53 -0700 Subject: [PATCH 9/9] DB Script --- ..._DELETE_PRD_SUBMISSION_OBJ-V22_S1.22-2.sql | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 database/V21.2/1_HMR_PDM-dml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22-2.sql diff --git a/database/V21.2/1_HMR_PDM-dml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22-2.sql b/database/V21.2/1_HMR_PDM-dml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22-2.sql new file mode 100644 index 00000000..861824c9 --- /dev/null +++ b/database/V21.2/1_HMR_PDM-dml_DELETE_PRD_SUBMISSION_OBJ-V22_S1.22-2.sql @@ -0,0 +1,164 @@ +-- ============================================= +-- Author: Ayodeji Kuponiyi +-- Create date: 2020-05-13 +-- Update date: 2020-05-20 + + + +-- Comments: +-- Original: + --Deleting submission entries in all relevant tables on or before May 06 2020 for SA 19 +-- Updates 2020-05-20: + --Included May 07 and SA 14 +-- ============================================= + +USE HMR_DEV; -- uncomment appropriate instance +--USE HMR_TST; +--USE HMR_UAT; +--USE HMR_PRD; +GO + + +DELETE HMR_WORK_REPORT + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_WORK_REPORT.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER IN (14,19) + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '07-MAY-2020' +) + +DELETE HMR_WORK_REPORT_HIST + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_WORK_REPORT_HIST.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER IN (14,19) + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '07-MAY-2020' +) + + +DELETE HMR_ROCKFALL_REPORT + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_ROCKFALL_REPORT.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER IN (14,19) + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '07-MAY-2020' +) + +DELETE HMR_ROCKFALL_REPORT_HIST + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_ROCKFALL_REPORT_HIST.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER IN (14,19) + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '07-MAY-2020' +) + + +DELETE HMR_WILDLIFE_REPORT + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_WILDLIFE_REPORT.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER IN (14,19) + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '07-MAY-2020' +) + +DELETE HMR_WILDLIFE_REPORT_HIST + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_WILDLIFE_REPORT_HIST.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER IN (14,19) + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '07-MAY-2020' +) + +DELETE HMR_FEEDBACK_MESSAGE + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_FEEDBACK_MESSAGE.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER IN (14,19) + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '07-MAY-2020' +) + + +DELETE HMR_SUBMISSION_ROW + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_SUBMISSION_ROW.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER IN (14,19) + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '07-MAY-2020' +) + +DELETE HMR_SUBMISSION_ROW_HIST + +WHERE EXISTS + +( + SELECT * + + FROM [dbo].[HMR_SUBMISSION_OBJECT] so + + WHERE so.SUBMISSION_OBJECT_ID = HMR_SUBMISSION_ROW_HIST.SUBMISSION_OBJECT_ID + + AND so.SERVICE_AREA_NUMBER IN (14,19) + AND FORMAT(so.APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '07-MAY-2020' +) + +DELETE HMR_SUBMISSION_OBJECT + + WHERE + SERVICE_AREA_NUMBER IN (14,19) + AND FORMAT(APP_CREATE_TIMESTAMP, 'dd-MM-yyyy') <= '07-MAY-2020' \ No newline at end of file