generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ORV2-2083 - Update Permit template names to generic ones. (#1258)
Co-authored-by: John Fletcher <[email protected]>
- Loading branch information
1 parent
5c780be
commit 6ae4e51
Showing
12 changed files
with
170 additions
and
11 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
database/mssql/scripts/versions/revert/v_24_ddl_revert.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,59 @@ | ||
SET ANSI_NULLS ON | ||
GO | ||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
SET NOCOUNT ON | ||
GO | ||
|
||
SET XACT_ABORT ON | ||
GO | ||
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE | ||
GO | ||
BEGIN TRANSACTION | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
|
||
UPDATE [dops].[ORBC_DOCUMENT_TEMPLATE] SET TEMPLATE_NAME='PERMIT_TROS',DB_LAST_UPDATE_TIMESTAMP=GETUTCDATE() WHERE TEMPLATE_NAME='PERMIT' | ||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
UPDATE [dops].[ORBC_DOCUMENT_TEMPLATE] SET TEMPLATE_NAME='PERMIT_TROS_VOID',DB_LAST_UPDATE_TIMESTAMP=GETUTCDATE() WHERE TEMPLATE_NAME='PERMIT_VOID' | ||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
UPDATE [dops].[ORBC_DOCUMENT_TEMPLATE] SET TEMPLATE_NAME='PERMIT_TROS_REVOKED',DB_LAST_UPDATE_TIMESTAMP=GETUTCDATE() WHERE TEMPLATE_NAME='PERMIT_REVOKED' | ||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
UPDATE [dops].[ORBC_DOCUMENT] SET FILE_NAME='tros-template-v1.docx',DB_LAST_UPDATE_TIMESTAMP=GETUTCDATE() WHERE ID IN (SELECT DOCUMENT_ID FROM [dops].[ORBC_DOCUMENT_TEMPLATE] WHERE TEMPLATE_NAME='PERMIT_TROS') | ||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
UPDATE [dops].[ORBC_DOCUMENT] SET FILE_NAME='tros-template-void-template-v1.docx',DB_LAST_UPDATE_TIMESTAMP=GETUTCDATE() WHERE ID IN (SELECT DOCUMENT_ID FROM [dops].[ORBC_DOCUMENT_TEMPLATE] WHERE TEMPLATE_NAME='PERMIT_TROS_VOID') | ||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
UPDATE [dops].[ORBC_DOCUMENT] SET FILE_NAME='tros-template-revoked-template-v1.docx',DB_LAST_UPDATE_TIMESTAMP=GETUTCDATE() WHERE ID IN (SELECT DOCUMENT_ID FROM [dops].[ORBC_DOCUMENT_TEMPLATE] WHERE TEMPLATE_NAME='PERMIT_TROS_REVOKED') | ||
|
||
DECLARE @VersionDescription VARCHAR(255) | ||
SET @VersionDescription = 'Revert the name of permit template documents' | ||
|
||
INSERT [dbo].[ORBC_SYS_VERSION] ([VERSION_ID], [DESCRIPTION], [RELEASE_DATE]) VALUES (23, @VersionDescription, getutcdate()) | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
|
||
COMMIT TRANSACTION | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
DECLARE @Success AS BIT | ||
SET @Success = 1 | ||
SET NOEXEC OFF | ||
IF (@Success = 1) PRINT 'The database update succeeded' | ||
ELSE BEGIN | ||
IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION | ||
PRINT 'The database update failed' | ||
END | ||
GO | ||
|
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,63 @@ | ||
SET ANSI_NULLS ON | ||
GO | ||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
SET NOCOUNT ON | ||
GO | ||
|
||
SET XACT_ABORT ON | ||
GO | ||
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE | ||
GO | ||
BEGIN TRANSACTION | ||
GO | ||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
UPDATE [dops].[ORBC_DOCUMENT_TEMPLATE] SET TEMPLATE_NAME='PERMIT',DB_LAST_UPDATE_TIMESTAMP=GETUTCDATE() WHERE TEMPLATE_NAME='PERMIT_TROS' | ||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
UPDATE [dops].[ORBC_DOCUMENT_TEMPLATE] SET TEMPLATE_NAME='PERMIT_VOID',DB_LAST_UPDATE_TIMESTAMP=GETUTCDATE() WHERE TEMPLATE_NAME='PERMIT_TROS_VOID' | ||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
UPDATE [dops].[ORBC_DOCUMENT_TEMPLATE] SET TEMPLATE_NAME='PERMIT_REVOKED',DB_LAST_UPDATE_TIMESTAMP=GETUTCDATE() WHERE TEMPLATE_NAME='PERMIT_TROS_REVOKED' | ||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
UPDATE [dops].[ORBC_DOCUMENT] SET FILE_NAME='permit-template-v1.docx',DB_LAST_UPDATE_TIMESTAMP=GETUTCDATE() WHERE ID IN (SELECT DOCUMENT_ID FROM [dops].[ORBC_DOCUMENT_TEMPLATE] WHERE TEMPLATE_NAME='PERMIT') | ||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
UPDATE [dops].[ORBC_DOCUMENT] SET FILE_NAME='permit-template-void-template-v1.docx',DB_LAST_UPDATE_TIMESTAMP=GETUTCDATE() WHERE ID IN (SELECT DOCUMENT_ID FROM [dops].[ORBC_DOCUMENT_TEMPLATE] WHERE TEMPLATE_NAME='PERMIT_VOID') | ||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
UPDATE [dops].[ORBC_DOCUMENT] SET FILE_NAME='permit-template-revoked-template-v1.docx',DB_LAST_UPDATE_TIMESTAMP=GETUTCDATE() WHERE ID IN (SELECT DOCUMENT_ID FROM [dops].[ORBC_DOCUMENT_TEMPLATE] WHERE TEMPLATE_NAME='PERMIT_REVOKED') | ||
|
||
|
||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
|
||
DECLARE @VersionDescription VARCHAR(255) | ||
SET @VersionDescription = 'Update the name of permit template documents' | ||
|
||
INSERT [dbo].[ORBC_SYS_VERSION] ([VERSION_ID], [DESCRIPTION], [UPDATE_SCRIPT], [REVERT_SCRIPT], [RELEASE_DATE]) VALUES (24, @VersionDescription, '$(UPDATE_SCRIPT)', '$(REVERT_SCRIPT)', getutcdate()) | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
|
||
COMMIT TRANSACTION | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
DECLARE @Success AS BIT | ||
SET @Success = 1 | ||
SET NOEXEC OFF | ||
IF (@Success = 1) PRINT 'The database update succeeded' | ||
ELSE BEGIN | ||
IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION | ||
PRINT 'The database update failed' | ||
END | ||
GO |
File renamed without changes.
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,5 @@ | ||
-- Test that the permit template names have been updated correctly | ||
SET NOCOUNT ON | ||
|
||
SELECT COUNT(*) FROM $(DB_NAME).[dops].[ORBC_DOCUMENT_TEMPLATE] | ||
WHERE TEMPLATE_NAME IN ('PERMIT','PERMIT_VOID','PERMIT_REVOKED') |
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,5 @@ | ||
-- Test that the template file names have been updated correctly | ||
SET NOCOUNT ON | ||
|
||
SELECT COUNT(*) FROM $(DB_NAME).[dops].[ORBC_DOCUMENT] | ||
WHERE FILE_NAME IN ('permit-template-v1.docx','permit-template-void-template-v1.docx','permit-template-revoked-template-v1.docx') |
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,23 @@ | ||
#!/bin/bash | ||
|
||
# Retrieve arguments | ||
source ${SCRIPT_DIR}/utility/getopt.sh | ||
USAGE="-u USER -p PASS -s SERVER -d DATABASE" | ||
parse_options "${USAGE}" ${@} | ||
|
||
# All database tests for database version 24 are run from this shell script. | ||
# TESTS_DIR variable set by the calling test-runner script. | ||
|
||
TEST_24_1_RESULT=$(/opt/mssql-tools/bin/sqlcmd -U ${USER} -P "${PASS}" -S ${SERVER} -v DB_NAME=${DATABASE} -h -1 -i ${TESTS_DIR}/v_24_1_test.sql | xargs) | ||
if [[ $TEST_24_1_RESULT -eq 3 ]]; then | ||
echo "Test 24.1 passed: Template names updated correctly" | ||
else | ||
echo "******** Test 24.1 failed: Template names not updated correctly" | ||
fi | ||
|
||
TEST_24_2_RESULT=$(/opt/mssql-tools/bin/sqlcmd -U ${USER} -P "${PASS}" -S ${SERVER} -v DB_NAME=${DATABASE} -h -1 -i ${TESTS_DIR}/v_24_2_test.sql | xargs) | ||
if [[ $TEST_24_2_RESULT -eq 3 ]]; then | ||
echo "Test 24.2 passed: File names updated correctly" | ||
else | ||
echo "******** Test 24.2 failed: File names not updated correctly" | ||
fi |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export enum TemplateName { | ||
PERMIT_TROS = 'PERMIT_TROS', | ||
PERMIT = 'PERMIT', | ||
PAYMENT_RECEIPT = 'PAYMENT_RECEIPT', | ||
PERMIT_TROS_VOID = 'PERMIT_TROS_VOID', | ||
PERMIT_TROS_REVOKED = 'PERMIT_TROS_REVOKED', | ||
PERMIT_VOID = 'PERMIT_VOID', | ||
PERMIT_REVOKED = 'PERMIT_REVOKED', | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export enum TemplateName { | ||
PERMIT_TROS = 'PERMIT_TROS', | ||
PERMIT = 'PERMIT', | ||
PAYMENT_RECEIPT = 'PAYMENT_RECEIPT', | ||
PERMIT_TROS_VOID = 'PERMIT_TROS_VOID', | ||
PERMIT_TROS_REVOKED = 'PERMIT_TROS_REVOKED', | ||
PERMIT_VOID = 'PERMIT_VOID', | ||
PERMIT_REVOKED = 'PERMIT_REVOKED', | ||
} |
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