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-97.00 Database Schema #4553

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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 @@ -18,7 +18,7 @@ GO

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

UPDATE PIMS_STATIC_VARIABLE
WITH (UPDLOCK, SERIALIZABLE)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/* -----------------------------------------------------------------------------
Alter the data in the PIMS_SUBFILE_INTEREST_TYPE table.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Author Date Comment
------------ ----------- -----------------------------------------------------
Doug Filteau 2024-Dec-19 Initial version.
----------------------------------------------------------------------------- */

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

-- Update the "TENANT" type
PRINT N'Update the "TENANT" type'
GO
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'TENANT'

SELECT SUBFILE_INTEREST_TYPE_CODE
FROM PIMS_SUBFILE_INTEREST_TYPE
WHERE SUBFILE_INTEREST_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_SUBFILE_INTEREST_TYPE
SET DESCRIPTION = N'Tenant (Monthly) Leaseholder'
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE SUBFILE_INTEREST_TYPE_CODE = @CurrCd;
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Update/insert the "LSHOLDR" type
PRINT N'Update the "LSHOLDR" type'
GO
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'LSHOLDR'

SELECT SUBFILE_INTEREST_TYPE_CODE
FROM PIMS_SUBFILE_INTEREST_TYPE
WHERE SUBFILE_INTEREST_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_SUBFILE_INTEREST_TYPE
SET IS_DISABLED = 1
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE SUBFILE_INTEREST_TYPE_CODE = @CurrCd;
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

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

SELECT SUBFILE_INTEREST_TYPE_CODE
FROM PIMS_SUBFILE_INTEREST_TYPE
WHERE SUBFILE_INTEREST_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_SUBFILE_INTEREST_TYPE
SET IS_DISABLED = 1
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE SUBFILE_INTEREST_TYPE_CODE = @CurrCd;
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- --------------------------------------------------------------
-- Update the display order with the exception of the OTHER type.
-- --------------------------------------------------------------
UPDATE prt
SET prt.DISPLAY_ORDER = seq.ROW_NUM
, prt.CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
FROM PIMS_SUBFILE_INTEREST_TYPE prt JOIN
(SELECT SUBFILE_INTEREST_TYPE_CODE
, ROW_NUMBER() OVER (ORDER BY DESCRIPTION) AS ROW_NUM
FROM PIMS_SUBFILE_INTEREST_TYPE
WHERE SUBFILE_INTEREST_TYPE_CODE <> N'OTHER') seq ON seq.SUBFILE_INTEREST_TYPE_CODE = prt.SUBFILE_INTEREST_TYPE_CODE
WHERE prt.SUBFILE_INTEREST_TYPE_CODE <> N'OTHER'
GO

-- --------------------------------------------------------------
-- Set the OTHER type to always appear at the end of the list.
-- --------------------------------------------------------------
UPDATE PIMS_SUBFILE_INTEREST_TYPE
SET DISPLAY_ORDER = 999
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE SUBFILE_INTEREST_TYPE_CODE = N'OTHER'
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,42 @@
/* -----------------------------------------------------------------------------
Migrate the data for the compensation requisition payees.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Author Date Comment
------------ ----------- -----------------------------------------------------
Doug Filteau 2024-Dec-24 Initial version.
----------------------------------------------------------------------------- */

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

-- Migrate the data for the compensation requisition payees
PRINT N'Migrate the data for the compensation requisition payees'
GO
UPDATE req
SET req.ACQUISITION_OWNER_ID = pay.ACQUISITION_OWNER_ID
, req.INTEREST_HOLDER_ID = pay.INTEREST_HOLDER_ID
, req.ACQUISITION_FILE_TEAM_ID = pay.ACQUISITION_FILE_TEAM_ID
, req.CONCURRENCY_CONTROL_NUMBER = req.CONCURRENCY_CONTROL_NUMBER + 1
FROM PIMS_COMP_REQ_PAYEE pay JOIN
PIMS_COMPENSATION_REQUISITION req ON req.COMPENSATION_REQUISITION_ID = pay.COMPENSATION_REQUISITION_ID
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,46 @@
/* -----------------------------------------------------------------------------
Drop the PIMS_COMP_REQ_PAYEE table.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Author Date Comment
------------ ----------- -----------------------------------------------------
Doug Filteau 2024-Dec-24 Initial version.
----------------------------------------------------------------------------- */

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

-- Drop table dbo.PIMS_COMP_REQ_PAYEE
PRINT N'Drop table dbo.PIMS_COMP_REQ_PAYEE'
GO
DROP TABLE IF EXISTS [dbo].[PIMS_COMP_REQ_PAYEE]
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Drop sequence dbo.PIMS_COMP_REQ_PAYEE_ID_SEQ
PRINT N'Drop sequence dbo.PIMS_COMP_REQ_PAYEE_ID_SEQ'
GO
DROP SEQUENCE IF EXISTS [dbo].[PIMS_COMP_REQ_PAYEE_ID_SEQ]
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.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- File generated on 12/17/2024 10:35:16 AM.
-- File generated on 12/24/2024 10:53:40 AM.
-- Autogenerated file. Do not manually modify.

:On Error Exit
Expand All @@ -14,14 +14,20 @@ PRINT ' == DB TRANSACTION START ========'

--Script section

PRINT '- Executing PSP_PIMS_S96_00/Alter Down/002_PSP_PIMS_Alter_Down.sql '
:setvar filepath "PSP_PIMS_S96_00/Alter Down/002_PSP_PIMS_Alter_Down.sql"
PRINT '- Executing PSP_PIMS_S97_00/Alter Down/002_PSP_PIMS_Alter_Down.sql '
:setvar filepath "PSP_PIMS_S97_00/Alter Down/002_PSP_PIMS_Alter_Down.sql"
:r $(filepath)
PRINT '- Executing PSP_PIMS_S96_00/Alter Down/010_DML_PIMS_STATIC_VARIABLE_VERSION.sql '
:setvar filepath "PSP_PIMS_S96_00/Alter Down/010_DML_PIMS_STATIC_VARIABLE_VERSION.sql"
PRINT '- Executing PSP_PIMS_S97_00/Alter Down/010_DML_PIMS_STATIC_VARIABLE_VERSION.sql '
:setvar filepath "PSP_PIMS_S97_00/Alter Down/010_DML_PIMS_STATIC_VARIABLE_VERSION.sql"
:r $(filepath)
PRINT '- Executing PSP_PIMS_S96_00/Alter Down/011_DML_PIMS_ROLE_NAME.sql '
:setvar filepath "PSP_PIMS_S96_00/Alter Down/011_DML_PIMS_ROLE_NAME.sql"
PRINT '- Executing PSP_PIMS_S97_00/Alter Down/157_DML_PIMS_SUBFILE_INTEREST_TYPE_Alter_Down.sql '
:setvar filepath "PSP_PIMS_S97_00/Alter Down/157_DML_PIMS_SUBFILE_INTEREST_TYPE_Alter_Down.sql"
:r $(filepath)
PRINT '- Executing PSP_PIMS_S97_00/Alter Down/998_Migrate_Comp_Req_Payees_Alter_Down.sql '
:setvar filepath "PSP_PIMS_S97_00/Alter Down/998_Migrate_Comp_Req_Payees_Alter_Down.sql"
:r $(filepath)
PRINT '- Executing PSP_PIMS_S97_00/Alter Down/999_DML_PIMS_COMP_REQ_PAYEE_Alter_Down.sql '
:setvar filepath "PSP_PIMS_S97_00/Alter Down/999_DML_PIMS_COMP_REQ_PAYEE_Alter_Down.sql"
:r $(filepath)

--End script section
Expand Down
Loading
Loading