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

fix: ORV2-3095 - Update: Permit revision changes to generated permit pdf #1723

Merged
merged 2 commits into from
Jan 2, 2025
Merged
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
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
Loading