Skip to content

Commit

Permalink
fix: ORV2-3095 - Update: Permit revision changes to generated permit …
Browse files Browse the repository at this point in the history
…pdf (#1723)
  • Loading branch information
praju-aot authored Jan 2, 2025
1 parent f03c177 commit 45ef955
Show file tree
Hide file tree
Showing 5 changed files with 742 additions and 10 deletions.
222 changes: 222 additions & 0 deletions database/mssql/scripts/versions/revert/v_53_ddl_revert.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET NOCOUNT ON
GO

SET XACT_ABORT ON
GO

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO

BEGIN TRANSACTION
GO

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT_TEMPLATE]
WHERE DOCUMENT_ID IN (
SELECT ID
FROM [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'permit-template-v2.docx'
)

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'permit-template-v2.docx'

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT_TEMPLATE]
WHERE DOCUMENT_ID IN (
SELECT ID
FROM [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'permit-void-template-v2.docx'
)

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'permit-void-template-v2.docx'

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT_TEMPLATE]
WHERE DOCUMENT_ID IN (
SELECT ID
FROM [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'permit-revoked-template-v2.docx'
)

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'permit-revoked-template-v2.docx'

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT_TEMPLATE]
WHERE DOCUMENT_ID IN (
SELECT ID
FROM [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'stos-template-v2.docx'
)

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'stos-template-v2.docx'

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT_TEMPLATE]
WHERE DOCUMENT_ID IN (
SELECT ID
FROM [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'stos-void-template-v2.docx'
)

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'stos-void-template-v2.docx'

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT_TEMPLATE]
WHERE DOCUMENT_ID IN (
SELECT ID
FROM [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'stos-revoked-template-v2.docx'
)

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'stos-revoked-template-v2.docx'

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT_TEMPLATE]
WHERE DOCUMENT_ID IN (
SELECT ID
FROM [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'mfp-template-v2.docx'
)

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'mfp-template-v2.docx'

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT_TEMPLATE]
WHERE DOCUMENT_ID IN (
SELECT ID
FROM [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'mfp-void-template-v2.docx'
)

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'mfp-void-template-v2.docx'

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT_TEMPLATE]
WHERE DOCUMENT_ID IN (
SELECT ID
FROM [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'mfp-revoked-template-v2.docx'
)

IF @@ERROR <> 0
SET NOEXEC ON
GO

DELETE [dops].[ORBC_DOCUMENT]
WHERE FILE_NAME = 'mfp-revoked-template-v2.docx'

DECLARE @VersionDescription VARCHAR(255)

SET @VersionDescription = 'Revert permit templates from v2 to v1'

INSERT [dbo].[ORBC_SYS_VERSION] (
[VERSION_ID]
,[DESCRIPTION]
,[RELEASE_DATE]
)
VALUES (
52
,@VersionDescription
,getutcdate()
)
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 revert succeeded'
ELSE
BEGIN
IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION

PRINT 'The database revert failed'
END
GO
Loading

0 comments on commit 45ef955

Please sign in to comment.