-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
psp-8568 fix database scripts such that the draft disposition status …
…is actually disabled. (#4076)
- Loading branch information
1 parent
958b42f
commit e523b50
Showing
2 changed files
with
102 additions
and
84 deletions.
There are no files selected for viewing
93 changes: 51 additions & 42 deletions
93
...ripts/PSP_PIMS_S80_00/Alter Down/138_DML_PIMS_DISPOSITION_FILE_STATUS_TYPE_Alter_Down.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 |
---|---|---|
@@ -1,50 +1,59 @@ | ||
/* ----------------------------------------------------------------------------- | ||
Alter the data in the PIMS_DISPOSITION_FILE_STATUS_TYPE table. | ||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . | ||
Author Date Comment | ||
------------ ----------- ----------------------------------------------------- | ||
Doug Filteau 2024-May-01 Initial version. Disable DRAFT. | ||
----------------------------------------------------------------------------- */ | ||
Alter the data in the PIMS_DISPOSITION_FILE_STATUS_TYPE table. | ||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . | ||
Author Date Comment | ||
------------ ----------- ----------------------------------------------------- | ||
Doug Filteau 2024-May-01 Initial version. Disable DRAFT. | ||
----------------------------------------------------------------------------- */ | ||
SET | ||
XACT_ABORT ON | ||
GO | ||
SET | ||
TRANSACTION ISOLATION LEVEL SERIALIZABLE | ||
GO | ||
BEGIN TRANSACTION | ||
GO | ||
IF @ @ERROR <> 0 | ||
SET | ||
NOEXEC ON | ||
GO | ||
-- Disable the "DRAFT" type | ||
DECLARE @CurrCd NVARCHAR(20) | ||
SET | ||
@CurrCd = N'DRAFT' | ||
SELECT | ||
DISPOSITION_FILE_STATUS_TYPE_CODE | ||
FROM | ||
PIMS_DISPOSITION_FILE_STATUS_TYPE | ||
WHERE | ||
DISPOSITION_FILE_STATUS_TYPE_CODE = @CurrCd; | ||
|
||
SET XACT_ABORT ON | ||
GO | ||
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE | ||
GO | ||
BEGIN TRANSACTION | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
|
||
-- Disable the "DRAFT" type | ||
DECLARE @CurrCd NVARCHAR(20) | ||
SET @CurrCd = N'DRAFT' | ||
IF @ @ROWCOUNT = 1 BEGIN | ||
UPDATE | ||
PIMS_DISPOSITION_FILE_STATUS_TYPE | ||
SET | ||
IS_DISABLED = 0, | ||
CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1 | ||
WHERE | ||
DISPOSITION_FILE_STATUS_TYPE_CODE = @CurrCd; | ||
|
||
SELECT DISPOSITION_FILE_STATUS_TYPE_CODE | ||
FROM PIMS_DISPOSITION_FILE_STATUS_TYPE | ||
WHERE DISPOSITION_FILE_STATUS_TYPE_CODE = @CurrCd; | ||
|
||
IF @@ROWCOUNT = 1 | ||
BEGIN | ||
UPDATE PIMS_DISPOSITION_FILE_STATUS_TYPE | ||
SET IS_DISABLED = 1 | ||
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1 | ||
WHERE DISPOSITION_FILE_STATUS_TYPE_CODE = @CurrCd; | ||
END | ||
END | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
IF @ @ERROR <> 0 | ||
SET | ||
NOEXEC ON | ||
GO | ||
|
||
COMMIT TRANSACTION | ||
COMMIT TRANSACTION | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
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' | ||
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 | ||
|
||
GO |
93 changes: 51 additions & 42 deletions
93
...dbscripts/PSP_PIMS_S80_00/Alter Up/138_DML_PIMS_DISPOSITION_FILE_STATUS_TYPE_Alter_Up.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 |
---|---|---|
@@ -1,50 +1,59 @@ | ||
/* ----------------------------------------------------------------------------- | ||
Alter the data in the PIMS_DISPOSITION_FILE_STATUS_TYPE table. | ||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . | ||
Author Date Comment | ||
------------ ----------- ----------------------------------------------------- | ||
Doug Filteau 2024-May-01 Initial version. Enable DRAFT. | ||
----------------------------------------------------------------------------- */ | ||
Alter the data in the PIMS_DISPOSITION_FILE_STATUS_TYPE table. | ||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . | ||
Author Date Comment | ||
------------ ----------- ----------------------------------------------------- | ||
Doug Filteau 2024-May-01 Initial version. Enable DRAFT. | ||
----------------------------------------------------------------------------- */ | ||
SET | ||
XACT_ABORT ON | ||
GO | ||
SET | ||
TRANSACTION ISOLATION LEVEL SERIALIZABLE | ||
GO | ||
BEGIN TRANSACTION | ||
GO | ||
IF @ @ERROR <> 0 | ||
SET | ||
NOEXEC ON | ||
GO | ||
-- Disable the "DRAFT" type | ||
DECLARE @CurrCd NVARCHAR(20) | ||
SET | ||
@CurrCd = N'DRAFT' | ||
SELECT | ||
DISPOSITION_FILE_STATUS_TYPE_CODE | ||
FROM | ||
PIMS_DISPOSITION_FILE_STATUS_TYPE | ||
WHERE | ||
DISPOSITION_FILE_STATUS_TYPE_CODE = @CurrCd; | ||
|
||
SET XACT_ABORT ON | ||
GO | ||
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE | ||
GO | ||
BEGIN TRANSACTION | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
|
||
-- Disable the "DRAFT" type | ||
DECLARE @CurrCd NVARCHAR(20) | ||
SET @CurrCd = N'DRAFT' | ||
IF @ @ROWCOUNT = 1 BEGIN | ||
UPDATE | ||
PIMS_DISPOSITION_FILE_STATUS_TYPE | ||
SET | ||
IS_DISABLED = 1, | ||
CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1 | ||
WHERE | ||
DISPOSITION_FILE_STATUS_TYPE_CODE = @CurrCd; | ||
|
||
SELECT DISPOSITION_FILE_STATUS_TYPE_CODE | ||
FROM PIMS_DISPOSITION_FILE_STATUS_TYPE | ||
WHERE DISPOSITION_FILE_STATUS_TYPE_CODE = @CurrCd; | ||
|
||
IF @@ROWCOUNT = 1 | ||
BEGIN | ||
UPDATE PIMS_DISPOSITION_FILE_STATUS_TYPE | ||
SET IS_DISABLED = 0 | ||
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1 | ||
WHERE DISPOSITION_FILE_STATUS_TYPE_CODE = @CurrCd; | ||
END | ||
END | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
IF @ @ERROR <> 0 | ||
SET | ||
NOEXEC ON | ||
GO | ||
|
||
COMMIT TRANSACTION | ||
COMMIT TRANSACTION | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
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' | ||
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 | ||
|
||
GO |