Skip to content

Commit

Permalink
IS-72.00 Database Schema (#3716)
Browse files Browse the repository at this point in the history
* IS-72.00 Database Schema

PSP_PIMS S72.00 Sprint 72 2024-Jan-16
- Altered tables:
  - PIMS_PROPERTY
  - PIMS_PROPERTY_HIST
- Altered build scripts:
  - 002_PSP_PIMS_Build.sql
  - 020_DML_PIMS_STATIC_VARIABLE.sql
  - 148_DML_PIMS_DSP_CHKLST_ITEM_TYPE.sql
- Added test scripts:
  - 071_PIMS_PROPERTY_CONTACT.sql
- Altered test scripts:
  - 005_DML_LEASE_PROPERTY.sql
- Requires additional metadata to meet standards

* fixed build not matching alter up result

* aligned latest folder

---------

Co-authored-by: Manuel Rodriguez <marobej@gmail.com>
  • Loading branch information
dfilteau and FuriousLlama authored Jan 23, 2024
1 parent 1337b7a commit 03a7a3f
Show file tree
Hide file tree
Showing 202 changed files with 78,352 additions and 15,383 deletions.

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

0 comments on commit 03a7a3f

Please sign in to comment.