Skip to content

Commit

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

PSP_PIMS | Development Sprint: S81.00 | Design Sprint: 80 | Date: 2024-May-22
- Added tables:
  - PIMS_LEASE_CHECKLIST_ITEM
  - PIMS_LEASE_CHECKLIST_ITEM_HIST
  - PIMS_LEASE_CHKLST_ITEM_STATUS_TYPE
  - PIMS_LEASE_CHKLST_ITEM_TYPE
- Altered tables:
  - PIMS_LEASE
- Added seed scripts:
  - 152_DML_PIMS_LEASE_CHKLST_SECTION_TYPE.sql
  - 153_DML_PIMS_LEASE_CHKLST_ITEM_TYPE.sql
  - 154_DML_PIMS_LEASE_CHKLST_ITEM_STATUS_TYPE.sql
- Altered seed scripts:
  - 072_DML_PIMS_INSURANCE_TYPE.sql
  - 049_DML_PIMS_DATA_SOURCE_TYPE.sql
- Added test scripts:
  - 076_PIMS_PIMS_LEASE_CHECKLIST_ITEM.sql
- Altered test scripts:
  - 033_PIMS_PROPERTY_ACQUISITION_FILE.sql
- Requires additional metadata to meet standards

* Updated IS-81 Database Schema

* Updated build. Removed Historical file number # from LIS and PS

---------

Co-authored-by: Manuel Rodriguez <marobej@gmail.com>
  • Loading branch information
dfilteau and FuriousLlama authored May 27, 2024
1 parent 1c098e2 commit d82387a
Show file tree
Hide file tree
Showing 237 changed files with 87,958 additions and 11,042 deletions.

Large diffs are not rendered by default.

This file was deleted.

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

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

UPDATE PIMS_STATIC_VARIABLE
WITH (UPDLOCK, SERIALIZABLE)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* -----------------------------------------------------------------------------
Alter the data in the PIMS_DISPOSITION_FILE_STATUS_TYPE table.
Alter the data in the PIMS_DATA_SOURCE_TYPE table.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Author Date Comment
------------ ----------- -----------------------------------------------------
Doug Filteau 2024-May-01 Initial version. Disable DRAFT.
Doug Filteau 2024-May-21 Initial version. Add/enable PIMS.
----------------------------------------------------------------------------- */

SET XACT_ABORT ON
Expand All @@ -15,20 +15,20 @@ GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Disable the "DRAFT" type
-- Disable the "PIMS" type
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'DRAFT'
SET @CurrCd = N'PIMS'

SELECT DISPOSITION_FILE_STATUS_TYPE_CODE
FROM PIMS_DISPOSITION_FILE_STATUS_TYPE
WHERE DISPOSITION_FILE_STATUS_TYPE_CODE = @CurrCd;
SELECT DATA_SOURCE_TYPE_CODE
FROM PIMS_DATA_SOURCE_TYPE
WHERE DATA_SOURCE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
BEGIN
UPDATE PIMS_DISPOSITION_FILE_STATUS_TYPE
UPDATE PIMS_DATA_SOURCE_TYPE
SET IS_DISABLED = 1
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE DISPOSITION_FILE_STATUS_TYPE_CODE = @CurrCd;
WHERE DATA_SOURCE_TYPE_CODE = @CurrCd;
END
GO
IF @@ERROR <> 0 SET NOEXEC ON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Alter the data in the PIMS_INSURANCE_TYPE table.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Author Date Comment
------------ ----------- -----------------------------------------------------
Doug Filteau 2024-May-01 Initial version. Edited ACCIDENT and UAVDRONE.
Doug Filteau 2024-May-01 Initial version. Added ACCIDENT and UAVDRONE.
Doug Filteau 2024-May-22 Alter the description for ACCIDENT.
----------------------------------------------------------------------------- */

SET XACT_ABORT ON
Expand All @@ -15,7 +16,7 @@ GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Disable the "ACCIDENT" type
-- Alter the "ACCIDENT" type
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'ACCIDENT'

Expand All @@ -24,33 +25,35 @@ FROM PIMS_INSURANCE_TYPE
WHERE INSURANCE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
BEGIN
UPDATE PIMS_INSURANCE_TYPE
SET IS_DISABLED = 1
SET DESCRIPTION = N'Accidental Coverage'
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE INSURANCE_TYPE_CODE = @CurrCd;
END
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Disable the "UAVDRONE" type
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'UAVDRONE'

SELECT INSURANCE_TYPE_CODE
FROM PIMS_INSURANCE_TYPE
WHERE INSURANCE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
BEGIN
UPDATE PIMS_INSURANCE_TYPE
SET IS_DISABLED = 1
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE INSURANCE_TYPE_CODE = @CurrCd;
END
-- --------------------------------------------------------------
-- Update the display order with the exception of the OTHER type.
-- --------------------------------------------------------------
UPDATE lpt
SET lpt.DISPLAY_ORDER = seq.ROW_NUM
, lpt.CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
FROM PIMS_INSURANCE_TYPE lpt JOIN
(SELECT INSURANCE_TYPE_CODE
, ROW_NUMBER() OVER (ORDER BY DESCRIPTION) AS ROW_NUM
FROM PIMS_INSURANCE_TYPE
WHERE INSURANCE_TYPE_CODE <> N'OTHER') seq ON seq.INSURANCE_TYPE_CODE = lpt.INSURANCE_TYPE_CODE
WHERE lpt.INSURANCE_TYPE_CODE <> N'OTHER'
GO
IF @@ERROR <> 0 SET NOEXEC ON

-- --------------------------------------------------------------
-- Set the OTHER type to always appear at the end of the list.
-- --------------------------------------------------------------
UPDATE PIMS_INSURANCE_TYPE
SET DISPLAY_ORDER = 99
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE INSURANCE_TYPE_CODE = N'OTHER'
GO

COMMIT TRANSACTION
Expand All @@ -66,4 +69,3 @@ ELSE BEGIN
PRINT 'The database update failed'
END
GO

This file was deleted.

Loading

0 comments on commit d82387a

Please sign in to comment.