generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:ORV2-2922: GL Code Update (#1632)
- Loading branch information
Showing
12 changed files
with
140 additions
and
7 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
database/mssql/scripts/sampledata/permit.ORBC_PAYMENT_METHOD_TYPE.Table.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,4 @@ | ||
SET NOCOUNT ON | ||
GO | ||
UPDATE [permit].[ORBC_PAYMENT_METHOD_TYPE] SET GL_PROJ_CODE='$(GL_PROJ_CODE)' WHERE PAYMENT_METHOD_TYPE= '$(PAYMENT_METHOD_TYPE)' | ||
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
27 changes: 27 additions & 0 deletions
27
database/mssql/scripts/versions/revert/v_45_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,27 @@ | ||
SET ANSI_NULLS ON | ||
GO | ||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
SET NOCOUNT ON | ||
GO | ||
|
||
SET XACT_ABORT ON | ||
|
||
BEGIN TRY | ||
BEGIN TRANSACTION | ||
|
||
ALTER TABLE [permit].[ORBC_PAYMENT_METHOD_TYPE] DROP COLUMN [GL_PROJ_CODE]; | ||
|
||
COMMIT | ||
END TRY | ||
|
||
BEGIN CATCH | ||
IF @@TRANCOUNT > 0 | ||
ROLLBACK; | ||
THROW | ||
END CATCH | ||
|
||
DECLARE @VersionDescription VARCHAR(255) | ||
SET @VersionDescription = 'Reverting addition of GL_PROJ_CODE to ORBC_PAYMENT_METHOD_TYPE.' | ||
|
||
INSERT [dbo].[ORBC_SYS_VERSION] ([VERSION_ID], [DESCRIPTION], [RELEASE_DATE]) VALUES (44, @VersionDescription, getutcdate()) |
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,45 @@ | ||
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 | ||
ALTER TABLE [permit].[ORBC_PAYMENT_METHOD_TYPE] ADD [GL_PROJ_CODE] [char] (7) NULL | ||
GO | ||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'GL Project Code' , @level0type=N'SCHEMA',@level0name=N'permit', @level1type=N'TABLE',@level1name=N'ORBC_PAYMENT_METHOD_TYPE', @level2type=N'COLUMN',@level2name=N'GL_PROJ_CODE' | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
|
||
DECLARE @VersionDescription VARCHAR(255) | ||
SET @VersionDescription = 'Add GL_PROJ_CODE col to ORBC_PAYMENT_METHOD_TYPE' | ||
|
||
INSERT [dbo].[ORBC_SYS_VERSION] ([VERSION_ID], [DESCRIPTION], [UPDATE_SCRIPT], [REVERT_SCRIPT], [RELEASE_DATE]) VALUES (45, @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 | ||
|
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,4 @@ | ||
-- Test that the GL_PROJ_CODE column has been added correctly | ||
SET NOCOUNT ON | ||
|
||
select COL_LENGTH('$(DB_NAME).[permit].[ORBC_PAYMENT_METHOD_TYPE]', 'GL_PROJ_CODE') |
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,16 @@ | ||
#!/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 45 are run from this shell script. | ||
# TESTS_DIR variable set by the calling test-runner script. | ||
|
||
TEST_45_1_RESULT=$(/opt/mssql-tools/bin/sqlcmd -U ${USER} -P "${PASS}" -S ${SERVER} -v DB_NAME=${DATABASE} -h -1 -i ${TESTS_DIR}/v_45_1_test.sql | xargs) | ||
if [[ $TEST_45_1_RESULT -eq 7 ]]; then | ||
echo "Test 45.1 passed: GL_PROJ_CODE column created in ORBC_PAYMENT_METHOD_TYPE" | ||
else | ||
echo "******** Test 45.1 failed: GL_PROJ_CODE column missing in ORBC_PAYMENT_METHOD_TYPE" | ||
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
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
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