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

IS-72.00 Database Schema #3716

Merged
merged 4 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ GO

-- Update the database version number.
DECLARE @CurrVer NVARCHAR(100)
SET @CurrVer = N'67.00'
SET @CurrVer = N'70.00'

UPDATE PIMS_STATIC_VARIABLE
WITH (UPDLOCK, SERIALIZABLE)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* -----------------------------------------------------------------------------
Alter the data in the PIMS_DSP_CHKLST_ITEM_TYPE table.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Author Date Comment
------------ ----------- -----------------------------------------------------
Doug Filteau 2024-Jan-10 Initial version
----------------------------------------------------------------------------- */

SET XACT_ABORT ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
BEGIN TRANSACTION
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Insert the "SGNDXFRPPH" type
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'SGNDXFRPPH'

SELECT DSP_CHKLST_ITEM_TYPE_CODE
FROM PIMS_DSP_CHKLST_ITEM_TYPE
WHERE DSP_CHKLST_ITEM_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
BEGIN
DELETE
FROM PIMS_DSP_CHKLST_ITEM_TYPE
WHERE DSP_CHKLST_ITEM_TYPE_CODE = @CurrCd;
END
GO
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
-- ----------------------------------------------------------------------------------
-- Migrate the contact data from the PIMS_PROPERTY_CONTACT table to the PIMS_PROPERTY
-- table.
-- ----------------------------------------------------------------------------------

SET XACT_ABORT ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
BEGIN TRANSACTION
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Migrate the PROPERTY_MANAGER_ID data
PRINT N'Migrate the PROPERTY_MANAGER_ID data'
GO
UPDATE prop
SET prop.PROPERTY_MANAGER_ID = cnct.PERSON_ID
, prop.CONCURRENCY_CONTROL_NUMBER = prop.CONCURRENCY_CONTROL_NUMBER + 1
FROM PIMS_PROPERTY prop join
PIMS_PROPERTY_CONTACT cnct ON cnct.PROPERTY_ID = prop.PROPERTY_ID
WHERE cnct.PERSON_ID IS NOT NULL
AND prop.PROPERTY_MANAGER_ID IS NULL
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Migrate the ORGANIZATION_ID data
PRINT N'Migrate the ORGANIZATION_ID data'
GO
UPDATE prop
SET prop.PROP_MGMT_ORG_ID = cnct.ORGANIZATION_ID
, prop.CONCURRENCY_CONTROL_NUMBER = prop.CONCURRENCY_CONTROL_NUMBER + 1
FROM PIMS_PROPERTY prop join
PIMS_PROPERTY_CONTACT cnct ON cnct.PROPERTY_ID = prop.PROPERTY_ID
WHERE cnct.ORGANIZATION_ID IS NOT NULL
AND prop.PROP_MGMT_ORG_ID IS NULL
GO
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
Binary file not shown.
Loading
Loading