Skip to content

Commit

Permalink
Update to IS-77.00 Database Schema (#3935)
Browse files Browse the repository at this point in the history
* Update to IS-77.00 Database Schema

* Updated Views

Changes to HAS_ACQUISITION_FILE calculation
  • Loading branch information
dfilteau authored Apr 8, 2024
1 parent 496e789 commit 189f340
Show file tree
Hide file tree
Showing 10 changed files with 546 additions and 632 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Script generated by Aqua Data Studio Schema Synchronization for MS SQL Server 2016 on Wed Apr 03 12:01:36 PDT 2024
-- Script generated by Aqua Data Studio Schema Synchronization for MS SQL Server 2016 on Fri Apr 05 14:36:18 PDT 2024
-- Execute this script on:
-- PSP_PIMS_S77.00/dbo - This database/schema will be modified
-- to synchronize it with MS SQL Server 2016:
Expand Down Expand Up @@ -108,51 +108,16 @@ GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Alter table dbo.PIMS_PROPERTY_HIST
PRINT N'Alter table dbo.PIMS_PROPERTY_HIST'
GO
UPDATE [dbo].[PIMS_PROPERTY_HIST] SET [IS_DISPOSED] = CONVERT([bit],(0)) WHERE [IS_DISPOSED] IS NULL
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
ALTER TABLE [dbo].[PIMS_PROPERTY_HIST] ALTER COLUMN [IS_DISPOSED] bit NOT NULL
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
ALTER TABLE [dbo].[PIMS_PROPERTY_HIST] ADD DEFAULT CONVERT([bit],(0)) FOR [IS_DISPOSED]
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
UPDATE [dbo].[PIMS_PROPERTY_HIST] SET [IS_OTHER_INTEREST] = CONVERT([bit],(0)) WHERE [IS_OTHER_INTEREST] IS NULL
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
ALTER TABLE [dbo].[PIMS_PROPERTY_HIST] ALTER COLUMN [IS_OTHER_INTEREST] bit NOT NULL
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
ALTER TABLE [dbo].[PIMS_PROPERTY_HIST] ADD DEFAULT CONVERT([bit],(0)) FOR [IS_OTHER_INTEREST]
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
UPDATE [dbo].[PIMS_PROPERTY_HIST] SET [IS_PROPERTY_OF_INTEREST] = CONVERT([bit],(0)) WHERE [IS_PROPERTY_OF_INTEREST] IS NULL
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
ALTER TABLE [dbo].[PIMS_PROPERTY_HIST] ALTER COLUMN [IS_PROPERTY_OF_INTEREST] bit NOT NULL
GO
IF @@ERROR <> 0 SET NOEXEC ON
-- Alter table dbo.PIMS_TAKE
PRINT N'Alter table dbo.PIMS_TAKE'
GO
ALTER TABLE [dbo].[PIMS_PROPERTY_HIST] ADD DEFAULT CONVERT([bit],(0)) FOR [IS_PROPERTY_OF_INTEREST]
ALTER TABLE [dbo].[PIMS_TAKE]
DROP CONSTRAINT IF EXISTS [TAKE_IS_ACTIVE_LEASE_DEF]
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Alter table dbo.PIMS_TAKE
PRINT N'Alter table dbo.PIMS_TAKE'
GO
ALTER TABLE [dbo].[PIMS_TAKE]
DROP COLUMN IF EXISTS [COMPLETION_DT]
DROP COLUMN IF EXISTS [ACTIVE_LEASE_AREA], [ACTIVE_LEASE_END_DT], [COMPLETION_DT], [IS_ACTIVE_LEASE]
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
Expand All @@ -161,7 +126,7 @@ GO
PRINT N'Alter table dbo.PIMS_TAKE_HIST'
GO
ALTER TABLE [dbo].[PIMS_TAKE_HIST]
DROP COLUMN IF EXISTS [COMPLETION_DT]
DROP COLUMN IF EXISTS [ACTIVE_LEASE_AREA], [ACTIVE_LEASE_END_DT], [COMPLETION_DT], [IS_ACTIVE_LEASE]
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
Expand Down Expand Up @@ -774,56 +739,29 @@ GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Drop dynamically-named default constraint
PRINT N'Drop dynamically-named default constraint'
-- Alter table dbo.PIMS_PROPERTY_HIST.IS_DISPOSED
PRINT N'Alter table dbo.PIMS_PROPERTY_HIST.IS_DISPOSED'
GO
DECLARE @sqlQry VARCHAR(1000)
DECLARE @defName VARCHAR(100)
SET @defName = (SELECT obj.NAME
FROM SYSOBJECTS obj INNER JOIN
SYSCOLUMNS col on obj.ID = col.CDEFAULT INNER JOIN
SYSOBJECTS tbl on col.ID = tbl.ID
WHERE obj.XTYPE = 'D'
AND tbl.NAME = 'PIMS_PROPERTY_HIST'
AND col.NAME = 'IS_DISPOSED')
SET @sqlQry = 'ALTER TABLE [dbo].[PIMS_PROPERTY_HIST] DROP CONSTRAINT IF EXISTS [' + @defName + ']'
EXEC (@sqlQry)
ALTER TABLE [dbo].[PIMS_PROPERTY_HIST]
ALTER COLUMN [IS_DISPOSED] bit NOT NULL
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Drop dynamically-named default constraint
PRINT N'Drop dynamically-named default constraint'
-- Alter table dbo.PIMS_PROPERTY_HIST.IS_OTHER_INTEREST
PRINT N'Alter table dbo.PIMS_PROPERTY_HIST.IS_OTHER_INTEREST'
GO
DECLARE @sqlQry VARCHAR(1000)
DECLARE @defName VARCHAR(100)
SET @defName = (SELECT obj.NAME
FROM SYSOBJECTS obj INNER JOIN
SYSCOLUMNS col on obj.ID = col.CDEFAULT INNER JOIN
SYSOBJECTS tbl on col.ID = tbl.ID
WHERE obj.XTYPE = 'D'
AND tbl.NAME = 'PIMS_PROPERTY_HIST'
AND col.NAME = 'IS_OTHER_INTEREST')
SET @sqlQry = 'ALTER TABLE [dbo].[PIMS_PROPERTY_HIST] DROP CONSTRAINT IF EXISTS [' + @defName + ']'
EXEC (@sqlQry)
ALTER TABLE [dbo].[PIMS_PROPERTY_HIST]
ALTER COLUMN [IS_OTHER_INTEREST] bit NOT NULL
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Drop dynamically-named default constraint
PRINT N'Drop dynamically-named default constraint'
GO
DECLARE @sqlQry VARCHAR(1000)
DECLARE @defName VARCHAR(100)
SET @defName = (SELECT obj.NAME
FROM SYSOBJECTS obj INNER JOIN
SYSCOLUMNS col on obj.ID = col.CDEFAULT INNER JOIN
SYSOBJECTS tbl on col.ID = tbl.ID
WHERE obj.XTYPE = 'D'
AND tbl.NAME = 'PIMS_PROPERTY_HIST'
AND col.NAME = 'IS_PROPERTY_OF_INTEREST')
SET @sqlQry = 'ALTER TABLE [dbo].[PIMS_PROPERTY_HIST] DROP CONSTRAINT IF EXISTS [' + @defName + ']'
EXEC (@sqlQry)
-- Alter table dbo.PIMS_PROPERTY_HIST.IS_PROPERTY_OF_INTEREST
PRINT N'Alter table dbo.PIMS_PROPERTY_HIST.IS_PROPERTY_OF_INTEREST'
GO
ALTER TABLE [dbo].[PIMS_PROPERTY_HIST]
ALTER COLUMN [IS_PROPERTY_OF_INTEREST] bit NOT NULL
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
Expand Down
Binary file not shown.
Loading

0 comments on commit 189f340

Please sign in to comment.