generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/loadtests9
- Loading branch information
Showing
199 changed files
with
7,863 additions
and
3,274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
database/mssql/scripts/versions/revert/v_50_ddl_revert.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
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 | ||
|
||
-- Foreign key indexes on all tables | ||
DROP INDEX [tps].[ETL_PROCESSES].[IX_FK_ETL_PROCESSES_ETL_PROCESS_TYPE]; | ||
DROP INDEX [dbo].[ORBC_ADDRESS].[IX_FK_ORBC_ADDRESS_PROVINCE]; | ||
DROP INDEX [case].[ORBC_CASE_ACTIVITY].[IX_FK_ORBC_CASE_ACTIVITY_CASE_ACTIVITY_TYPE]; | ||
DROP INDEX [case].[ORBC_CASE_ACTIVITY].[IX_FK_ORBC_CASE_ACTIVITY_CASE_EVENT_ID]; | ||
DROP INDEX [case].[ORBC_CASE_ACTIVITY].[IX_FK_ORBC_CASE_ACTIVITY_CASE_ID]; | ||
DROP INDEX [case].[ORBC_CASE].[IX_FK_ORBC_CASE_CASE_STATUS_TYPE]; | ||
DROP INDEX [case].[ORBC_CASE].[IX_FK_ORBC_CASE_CASE_TYPE]; | ||
DROP INDEX [case].[ORBC_CASE_DOCUMENT].[IX_FK_ORBC_CASE_DOCUMENT_CASE_EVENT_ID]; | ||
DROP INDEX [case].[ORBC_CASE_DOCUMENT].[IX_FK_ORBC_CASE_DOCUMENT_CASE_ID]; | ||
DROP INDEX [case].[ORBC_CASE_EVENT].[IX_FK_ORBC_CASE_EVENT_CASE_EVENT_TYPE]; | ||
DROP INDEX [case].[ORBC_CASE_NOTES].[IX_FK_ORBC_CASE_NOTES_CASE_EVENT_ID]; | ||
DROP INDEX [case].[ORBC_CASE_NOTES].[IX_FK_ORBC_CASE_NOTES_CASE_ID]; | ||
DROP INDEX [case].[ORBC_CASE].[IX_FK_ORBC_CASE_ORIGINAL_CASE_ID]; | ||
DROP INDEX [case].[ORBC_CASE].[IX_FK_ORBC_CASE_PERMIT_ID]; | ||
DROP INDEX [case].[ORBC_CASE].[IX_FK_ORBC_CASE_PREVIOUS_CASE_ID]; | ||
DROP INDEX [dbo].[ORBC_COMPANY].[IX_FK_ORBC_COMPANY_DIRECTORY]; | ||
DROP INDEX [dbo].[ORBC_COMPANY].[IX_FK_ORBC_COMPANY_MAILING_ADDRESS]; | ||
DROP INDEX [dbo].[ORBC_COMPANY].[IX_FK_ORBC_COMPANY_PRIMARY_CONTACT]; | ||
DROP INDEX [dbo].[ORBC_COMPANY_SUSPEND_ACTIVITY].[IX_FK_ORBC_COMPANY_SUSPEND_ACTIVITY_ORBC_COMPANY]; | ||
DROP INDEX [dbo].[ORBC_COMPANY_SUSPEND_ACTIVITY].[IX_FK_ORBC_COMPANY_SUSPEND_ACTIVITY_SUSPEND_ACTIVITY_TYPE]; | ||
DROP INDEX [dbo].[ORBC_COMPANY_USER].[IX_FK_ORBC_COMPANY_USER_COMPANY]; | ||
DROP INDEX [dbo].[ORBC_COMPANY_USER].[IX_FK_ORBC_COMPANY_USER_USER]; | ||
DROP INDEX [dbo].[ORBC_COMPANY_USER].[IX_FK_ORBC_COMPANY_USER_USER_AUTH_GROUP]; | ||
DROP INDEX [dbo].[ORBC_COMPANY_USER].[IX_FK_ORBC_COMPANY_USER_USER_STATUS]; | ||
DROP INDEX [dbo].[ORBC_CONTACT].[IX_FK_ORBC_CONTACT_PROVINCE]; | ||
DROP INDEX [permit].[ORBC_CREDIT_ACCOUNT_ACTIVITY].[IX_FK_ORBC_CREDIT_ACCOUNT_ACTIVITY_CREDIT_ACCOUNT_ACTIVITY_TYPE]; | ||
DROP INDEX [permit].[ORBC_CREDIT_ACCOUNT_ACTIVITY].[IX_FK_ORBC_CREDIT_ACCOUNT_ACTIVITY_CREDIT_ACCOUNT_ID]; | ||
DROP INDEX [permit].[ORBC_CREDIT_ACCOUNT].[IX_FK_ORBC_CREDIT_ACCOUNT_COMPANY_ID]; | ||
DROP INDEX [permit].[ORBC_CREDIT_ACCOUNT].[IX_FK_ORBC_CREDIT_ACCOUNT_CREDIT_ACCOUNT_STATUS_TYPE]; | ||
DROP INDEX [permit].[ORBC_CREDIT_ACCOUNT].[IX_FK_ORBC_CREDIT_ACCOUNT_CREDIT_ACCOUNT_TYPE]; | ||
DROP INDEX [permit].[ORBC_CREDIT_ACCOUNT_USER].[IX_FK_ORBC_CREDIT_ACCOUNT_USER_COMPANY_ID]; | ||
DROP INDEX [permit].[ORBC_CREDIT_ACCOUNT_USER].[IX_FK_ORBC_CREDIT_ACCOUNT_USER_CREDIT_ACCOUNT_ID]; | ||
DROP INDEX [permit].[ORBC_GL_CODE_TYPE].[IX_FK_ORBC_GL_CODE_TYPE_GL_TYPE]; | ||
DROP INDEX [permit].[ORBC_GL_CODE_TYPE].[IX_FK_ORBC_GL_CODE_TYPE_PAYMENT_CARD_TYPE]; | ||
DROP INDEX [permit].[ORBC_GL_CODE_TYPE].[IX_FK_ORBC_GL_CODE_TYPE_PAYMENT_METHOD_TYPE]; | ||
DROP INDEX [permit].[ORBC_GL_CODE_TYPE].[IX_FK_ORBC_GL_CODE_TYPE_PERMIT_TYPE]; | ||
DROP INDEX [access].[ORBC_GROUP_ROLE].[IX_FK_ORBC_GROUP_ROLE_ROLE]; | ||
DROP INDEX [access].[ORBC_GROUP_ROLE].[IX_FK_ORBC_GROUP_ROLE_USER_AUTH_GROUP]; | ||
DROP INDEX [permit].[ORBC_LOA_DETAILS].[IX_FK_ORBC_LOA_DETAILS_COMPANY]; | ||
DROP INDEX [permit].[ORBC_LOA_DETAILS].[IX_FK_ORBC_LOA_DETAILS_ORIGINAL_LOA_ID]; | ||
DROP INDEX [permit].[ORBC_LOA_DETAILS].[IX_FK_ORBC_LOA_DETAILS_PREVIOUS_LOA_ID]; | ||
DROP INDEX [permit].[ORBC_LOA_PERMIT_TYPE_DETAILS].[IX_FK_ORBC_LOA_PERMIT_TYPE_LOA_ID]; | ||
DROP INDEX [permit].[ORBC_LOA_PERMIT_TYPE_DETAILS].[IX_FK_ORBC_LOA_PERMIT_TYPES_PERMIT_TYPE]; | ||
DROP INDEX [permit].[ORBC_LOA_VEHICLES].[IX_FK_ORBC_LOA_VEHICLES_LOA_ID]; | ||
DROP INDEX [dbo].[ORBC_PENDING_IDIR_USER].[IX_FK_ORBC_PENDING_IDIR_USER_AUTH_GROUP]; | ||
DROP INDEX [dbo].[ORBC_PENDING_USER].[IX_FK_ORBC_PENDING_USER_AUTH_GROUP]; | ||
DROP INDEX [dbo].[ORBC_PENDING_USER].[IX_FK_ORBC_PENDING_USER_COMPANY]; | ||
DROP INDEX [permit].[ORBC_PERMIT_COMMENTS].[IX_FK_ORBC_PERMIT_COMMENTS_PERMIT]; | ||
DROP INDEX [permit].[ORBC_PERMIT_DATA].[IX_FK_ORBC_PERMIT_ID]; | ||
DROP INDEX [permit].[ORBC_PERMIT].[IX_FK_ORBC_PERMIT_PARENT_PERMIT]; | ||
DROP INDEX [permit].[ORBC_PERMIT].[IX_FK_ORBC_PERMIT_PERMIT_APPLICATION_ORIGIN]; | ||
DROP INDEX [permit].[ORBC_PERMIT].[IX_FK_ORBC_PERMIT_PERMIT_APPROVAL_SOURCE]; | ||
DROP INDEX [permit].[ORBC_PERMIT].[IX_FK_ORBC_PERMIT_PERMIT_ISSUED_BY]; | ||
DROP INDEX [permit].[ORBC_PERMIT].[IX_FK_ORBC_PERMIT_PERMIT_STATUS_TYPE]; | ||
DROP INDEX [permit].[ORBC_PERMIT].[IX_FK_ORBC_PERMIT_PERMIT_TYPE]; | ||
DROP INDEX [permit].[ORBC_PERMIT_STATE].[IX_FK_ORBC_PERMIT_STATE_PERMIT]; | ||
DROP INDEX [permit].[ORBC_PERMIT_STATE].[IX_FK_ORBC_PERMIT_STATE_PERMIT_STATUS]; | ||
DROP INDEX [dbo].[ORBC_POWER_UNIT].[IX_FK_ORBC_POWER_UNIT_COMPANY]; | ||
DROP INDEX [dbo].[ORBC_POWER_UNIT].[IX_FK_ORBC_POWER_UNIT_POWER_UNIT_TYPE]; | ||
DROP INDEX [dbo].[ORBC_POWER_UNIT].[IX_FK_ORBC_POWER_UNIT_PROVINCE]; | ||
DROP INDEX [permit].[ORBC_SPECIAL_AUTH].[IX_FK_ORBC_SPECIAL_AUTH_COMPANY_ID]; | ||
DROP INDEX [permit].[ORBC_SPECIAL_AUTH].[IX_FK_ORBC_SPECIAL_AUTH_NO_FEE_TYPE]; | ||
DROP INDEX [dbo].[ORBC_TRAILER].[IX_FK_ORBC_TRAILER_COMPANY]; | ||
DROP INDEX [dbo].[ORBC_TRAILER].[IX_FK_ORBC_TRAILER_PROVINCE]; | ||
DROP INDEX [dbo].[ORBC_TRAILER].[IX_FK_ORBC_TRAILER_TRAILER_TYPE]; | ||
DROP INDEX [dbo].[ORBC_USER].[IX_FK_ORBC_USER_CONTACT]; | ||
DROP INDEX [dbo].[ORBC_USER].[IX_FK_ORBC_USER_DIRECTORY]; | ||
DROP INDEX [dbo].[ORBC_USER].[IX_FK_ORBC_USER_USER_AUTH_GROUP]; | ||
DROP INDEX [dbo].[ORBC_USER].[IX_FK_ORBC_USER_USER_STATUS]; | ||
DROP INDEX [permit].[ORBC_CFS_TRANSACTION_DETAIL].[IX_ORBC_CFS_DETAILS_TRANSACTION_ID_FK]; | ||
DROP INDEX [permit].[ORBC_CFS_TRANSACTION_DETAIL].[IX_ORBC_CFS_TRANSACTION_DETAIL_FILE_STATUS_FK]; | ||
DROP INDEX [dops].[ORBC_DOCUMENT].[IX_ORBC_DOCUMENT_COMPANY_ID_FK]; | ||
DROP INDEX [permit].[ORBC_LOA_DETAILS].[IX_ORBC_LOA_DETAILS_DOCUMENT_ID_FK]; | ||
DROP INDEX [permit].[ORBC_LOA_VEHICLES].[IX_ORBC_LOA_VEHICLES_POWER_UNIT_ID_FK]; | ||
DROP INDEX [permit].[ORBC_LOA_VEHICLES].[IX_ORBC_LOA_VEHICLES_TRAILER_ID_FK]; | ||
DROP INDEX [permit].[ORBC_PERMIT_TRANSACTION].[IX_ORBC_PERMIT_TRANSACTION_PERMIT_ID_FK]; | ||
DROP INDEX [permit].[ORBC_PERMIT_TRANSACTION].[IX_ORBC_PERMIT_TRANSACTION_TRANSACTION_ID_FK]; | ||
DROP INDEX [permit].[ORBC_RECEIPT].[IX_ORBC_RECEIPT_TRANSACTION_ID_FK]; | ||
DROP INDEX [permit].[ORBC_TRANSACTION].[IX_ORBC_TRANSACTION_CARD_TYPE_FK]; | ||
DROP INDEX [permit].[ORBC_TRANSACTION].[IX_ORBC_TRANSACTION_PAYMENT_METHOD_FK]; | ||
DROP INDEX [permit].[ORBC_TRANSACTION].[IX_ORBC_TRANSACTION_TYPE_FK]; | ||
GO | ||
|
||
-- Targeted indexes for permit search and sort | ||
DROP INDEX [permit].[ORBC_PERMIT].[IX_PERMIT_NUMBER]; | ||
DROP INDEX [permit].[ORBC_PERMIT_DATA].[IX_START_DATE]; | ||
DROP INDEX [permit].[ORBC_PERMIT_DATA].[IX_EXPIRY_DATE]; | ||
DROP INDEX [permit].[ORBC_PERMIT_DATA].[IX_UNIT_NUMBER]; | ||
DROP INDEX [permit].[ORBC_PERMIT_DATA].[IX_PLATE]; | ||
DROP INDEX [permit].[ORBC_PERMIT_DATA].[IX_VIN]; | ||
GO | ||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
|
||
DECLARE @VersionDescription VARCHAR(255) | ||
SET @VersionDescription = 'Reverting adding indexes on foreign keys and permit sort columns' | ||
|
||
INSERT [dbo].[ORBC_SYS_VERSION] ([VERSION_ID], [DESCRIPTION], [RELEASE_DATE]) VALUES (49, @VersionDescription, getutcdate()) | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
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 | ||
|
||
-- Foreign key indexes on all tables | ||
CREATE NONCLUSTERED INDEX IX_FK_ETL_PROCESSES_ETL_PROCESS_TYPE ON [tps].[ETL_PROCESSES] ([PROCESS_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_ADDRESS_PROVINCE ON [dbo].[ORBC_ADDRESS] ([PROVINCE_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CASE_ACTIVITY_CASE_ACTIVITY_TYPE ON [case].[ORBC_CASE_ACTIVITY] ([CASE_ACTIVITY_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CASE_ACTIVITY_CASE_EVENT_ID ON [case].[ORBC_CASE_ACTIVITY] ([CASE_EVENT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CASE_ACTIVITY_CASE_ID ON [case].[ORBC_CASE_ACTIVITY] ([CASE_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CASE_CASE_STATUS_TYPE ON [case].[ORBC_CASE] ([CASE_STATUS_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CASE_CASE_TYPE ON [case].[ORBC_CASE] ([CASE_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CASE_DOCUMENT_CASE_EVENT_ID ON [case].[ORBC_CASE_DOCUMENT] ([CASE_EVENT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CASE_DOCUMENT_CASE_ID ON [case].[ORBC_CASE_DOCUMENT] ([CASE_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CASE_EVENT_CASE_EVENT_TYPE ON [case].[ORBC_CASE_EVENT] ([CASE_EVENT_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CASE_NOTES_CASE_EVENT_ID ON [case].[ORBC_CASE_NOTES] ([CASE_EVENT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CASE_NOTES_CASE_ID ON [case].[ORBC_CASE_NOTES] ([CASE_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CASE_ORIGINAL_CASE_ID ON [case].[ORBC_CASE] ([ORIGINAL_CASE_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CASE_PERMIT_ID ON [case].[ORBC_CASE] ([PERMIT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CASE_PREVIOUS_CASE_ID ON [case].[ORBC_CASE] ([PREVIOUS_CASE_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_COMPANY_DIRECTORY ON [dbo].[ORBC_COMPANY] ([COMPANY_DIRECTORY]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_COMPANY_MAILING_ADDRESS ON [dbo].[ORBC_COMPANY] ([MAILING_ADDRESS_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_COMPANY_PRIMARY_CONTACT ON [dbo].[ORBC_COMPANY] ([PRIMARY_CONTACT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_COMPANY_SUSPEND_ACTIVITY_ORBC_COMPANY ON [dbo].[ORBC_COMPANY_SUSPEND_ACTIVITY] ([COMPANY_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_COMPANY_SUSPEND_ACTIVITY_SUSPEND_ACTIVITY_TYPE ON [dbo].[ORBC_COMPANY_SUSPEND_ACTIVITY] ([SUSPEND_ACTIVITY_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_COMPANY_USER_COMPANY ON [dbo].[ORBC_COMPANY_USER] ([COMPANY_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_COMPANY_USER_USER ON [dbo].[ORBC_COMPANY_USER] ([USER_GUID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_COMPANY_USER_USER_AUTH_GROUP ON [dbo].[ORBC_COMPANY_USER] ([USER_AUTH_GROUP_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_COMPANY_USER_USER_STATUS ON [dbo].[ORBC_COMPANY_USER] ([USER_STATUS_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CONTACT_PROVINCE ON [dbo].[ORBC_CONTACT] ([PROVINCE_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CREDIT_ACCOUNT_ACTIVITY_CREDIT_ACCOUNT_ACTIVITY_TYPE ON [permit].[ORBC_CREDIT_ACCOUNT_ACTIVITY] ([CREDIT_ACCOUNT_ACTIVITY_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CREDIT_ACCOUNT_ACTIVITY_CREDIT_ACCOUNT_ID ON [permit].[ORBC_CREDIT_ACCOUNT_ACTIVITY] ([CREDIT_ACCOUNT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CREDIT_ACCOUNT_COMPANY_ID ON [permit].[ORBC_CREDIT_ACCOUNT] ([COMPANY_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CREDIT_ACCOUNT_CREDIT_ACCOUNT_STATUS_TYPE ON [permit].[ORBC_CREDIT_ACCOUNT] ([CREDIT_ACCOUNT_STATUS_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CREDIT_ACCOUNT_CREDIT_ACCOUNT_TYPE ON [permit].[ORBC_CREDIT_ACCOUNT] ([CREDIT_ACCOUNT_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CREDIT_ACCOUNT_USER_COMPANY_ID ON [permit].[ORBC_CREDIT_ACCOUNT_USER] ([COMPANY_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_CREDIT_ACCOUNT_USER_CREDIT_ACCOUNT_ID ON [permit].[ORBC_CREDIT_ACCOUNT_USER] ([CREDIT_ACCOUNT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_GL_CODE_TYPE_GL_TYPE ON [permit].[ORBC_GL_CODE_TYPE] ([GL_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_GL_CODE_TYPE_PAYMENT_CARD_TYPE ON [permit].[ORBC_GL_CODE_TYPE] ([PAYMENT_CARD_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_GL_CODE_TYPE_PAYMENT_METHOD_TYPE ON [permit].[ORBC_GL_CODE_TYPE] ([PAYMENT_METHOD_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_GL_CODE_TYPE_PERMIT_TYPE ON [permit].[ORBC_GL_CODE_TYPE] ([PERMIT_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_GROUP_ROLE_ROLE ON [access].[ORBC_GROUP_ROLE] ([ROLE_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_GROUP_ROLE_USER_AUTH_GROUP ON [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_LOA_DETAILS_COMPANY ON [permit].[ORBC_LOA_DETAILS] ([COMPANY_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_LOA_DETAILS_ORIGINAL_LOA_ID ON [permit].[ORBC_LOA_DETAILS] ([ORIGINAL_LOA_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_LOA_DETAILS_PREVIOUS_LOA_ID ON [permit].[ORBC_LOA_DETAILS] ([PREVIOUS_LOA_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_LOA_PERMIT_TYPE_LOA_ID ON [permit].[ORBC_LOA_PERMIT_TYPE_DETAILS] ([LOA_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_LOA_PERMIT_TYPES_PERMIT_TYPE ON [permit].[ORBC_LOA_PERMIT_TYPE_DETAILS] ([PERMIT_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_LOA_VEHICLES_LOA_ID ON [permit].[ORBC_LOA_VEHICLES] ([LOA_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_PENDING_IDIR_USER_AUTH_GROUP ON [dbo].[ORBC_PENDING_IDIR_USER] ([USER_AUTH_GROUP_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_PENDING_USER_AUTH_GROUP ON [dbo].[ORBC_PENDING_USER] ([USER_AUTH_GROUP_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_PENDING_USER_COMPANY ON [dbo].[ORBC_PENDING_USER] ([COMPANY_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_PERMIT_COMMENTS_PERMIT ON [permit].[ORBC_PERMIT_COMMENTS] ([PERMIT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_PERMIT_ID ON [permit].[ORBC_PERMIT_DATA] ([PERMIT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_PERMIT_PARENT_PERMIT ON [permit].[ORBC_PERMIT] ([PREVIOUS_REV_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_PERMIT_PERMIT_APPLICATION_ORIGIN ON [permit].[ORBC_PERMIT] ([PERMIT_APPLICATION_ORIGIN_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_PERMIT_PERMIT_APPROVAL_SOURCE ON [permit].[ORBC_PERMIT] ([PERMIT_APPROVAL_SOURCE_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_PERMIT_PERMIT_ISSUED_BY ON [permit].[ORBC_PERMIT] ([PERMIT_ISSUED_BY_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_PERMIT_PERMIT_STATUS_TYPE ON [permit].[ORBC_PERMIT] ([PERMIT_STATUS_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_PERMIT_PERMIT_TYPE ON [permit].[ORBC_PERMIT] ([PERMIT_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_PERMIT_STATE_PERMIT ON [permit].[ORBC_PERMIT_STATE] ([PERMIT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_PERMIT_STATE_PERMIT_STATUS ON [permit].[ORBC_PERMIT_STATE] ([PERMIT_STATUS_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_POWER_UNIT_COMPANY ON [dbo].[ORBC_POWER_UNIT] ([COMPANY_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_POWER_UNIT_POWER_UNIT_TYPE ON [dbo].[ORBC_POWER_UNIT] ([POWER_UNIT_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_POWER_UNIT_PROVINCE ON [dbo].[ORBC_POWER_UNIT] ([PROVINCE_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_SPECIAL_AUTH_COMPANY_ID ON [permit].[ORBC_SPECIAL_AUTH] ([COMPANY_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_SPECIAL_AUTH_NO_FEE_TYPE ON [permit].[ORBC_SPECIAL_AUTH] ([NO_FEE_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_TRAILER_COMPANY ON [dbo].[ORBC_TRAILER] ([COMPANY_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_TRAILER_PROVINCE ON [dbo].[ORBC_TRAILER] ([PROVINCE_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_TRAILER_TRAILER_TYPE ON [dbo].[ORBC_TRAILER] ([TRAILER_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_USER_CONTACT ON [dbo].[ORBC_USER] ([CONTACT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_USER_DIRECTORY ON [dbo].[ORBC_USER] ([USER_DIRECTORY]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_USER_USER_AUTH_GROUP ON [dbo].[ORBC_USER] ([USER_AUTH_GROUP_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_FK_ORBC_USER_USER_STATUS ON [dbo].[ORBC_USER] ([USER_STATUS_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_ORBC_CFS_DETAILS_TRANSACTION_ID_FK ON [permit].[ORBC_CFS_TRANSACTION_DETAIL] ([TRANSACTION_ID]); | ||
CREATE NONCLUSTERED INDEX IX_ORBC_CFS_TRANSACTION_DETAIL_FILE_STATUS_FK ON [permit].[ORBC_CFS_TRANSACTION_DETAIL] ([CFS_FILE_STATUS_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_ORBC_DOCUMENT_COMPANY_ID_FK ON [dops].[ORBC_DOCUMENT] ([COMPANY_ID]); | ||
CREATE NONCLUSTERED INDEX IX_ORBC_LOA_DETAILS_DOCUMENT_ID_FK ON [permit].[ORBC_LOA_DETAILS] ([DOCUMENT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_ORBC_LOA_VEHICLES_POWER_UNIT_ID_FK ON [permit].[ORBC_LOA_VEHICLES] ([POWER_UNIT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_ORBC_LOA_VEHICLES_TRAILER_ID_FK ON [permit].[ORBC_LOA_VEHICLES] ([TRAILER_ID]); | ||
CREATE NONCLUSTERED INDEX IX_ORBC_PERMIT_TRANSACTION_PERMIT_ID_FK ON [permit].[ORBC_PERMIT_TRANSACTION] ([PERMIT_ID]); | ||
CREATE NONCLUSTERED INDEX IX_ORBC_PERMIT_TRANSACTION_TRANSACTION_ID_FK ON [permit].[ORBC_PERMIT_TRANSACTION] ([TRANSACTION_ID]); | ||
CREATE NONCLUSTERED INDEX IX_ORBC_RECEIPT_TRANSACTION_ID_FK ON [permit].[ORBC_RECEIPT] ([TRANSACTION_ID]); | ||
CREATE NONCLUSTERED INDEX IX_ORBC_TRANSACTION_CARD_TYPE_FK ON [permit].[ORBC_TRANSACTION] ([PAYMENT_CARD_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_ORBC_TRANSACTION_PAYMENT_METHOD_FK ON [permit].[ORBC_TRANSACTION] ([PAYMENT_METHOD_TYPE]); | ||
CREATE NONCLUSTERED INDEX IX_ORBC_TRANSACTION_TYPE_FK ON [permit].[ORBC_TRANSACTION] ([TRANSACTION_TYPE]); | ||
GO | ||
|
||
-- Targeted indexes for permit search and sort | ||
CREATE NONCLUSTERED INDEX [IX_PERMIT_NUMBER] ON [permit].[ORBC_PERMIT] ([PERMIT_NUMBER] ASC); | ||
CREATE NONCLUSTERED INDEX [IX_START_DATE] ON [permit].[ORBC_PERMIT_DATA] ([START_DATE] ASC); | ||
CREATE NONCLUSTERED INDEX [IX_EXPIRY_DATE] ON [permit].[ORBC_PERMIT_DATA] ([EXPIRY_DATE] ASC); | ||
CREATE NONCLUSTERED INDEX [IX_UNIT_NUMBER] ON [permit].[ORBC_PERMIT_DATA] ([UNIT_NUMBER] ASC); | ||
CREATE NONCLUSTERED INDEX [IX_PLATE] ON [permit].[ORBC_PERMIT_DATA] ([PLATE] ASC); | ||
CREATE NONCLUSTERED INDEX [IX_VIN] ON [permit].[ORBC_PERMIT_DATA] ([VIN] ASC); | ||
GO | ||
|
||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
|
||
DECLARE @VersionDescription VARCHAR(255) | ||
SET @VersionDescription = 'Add indexes to all foreign key columns and permit sort columns' | ||
|
||
INSERT [dbo].[ORBC_SYS_VERSION] ([VERSION_ID], [DESCRIPTION], [UPDATE_SCRIPT], [REVERT_SCRIPT], [RELEASE_DATE]) VALUES (50, @VersionDescription, '$(UPDATE_SCRIPT)', '$(REVERT_SCRIPT)', getutcdate()) | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.