﻿
---------------------Ali 2021-11-25--------
   INSERT[dbo].[ConfigParameter]  ([ConfigKey], [Name], [Arabic_Name], [ConfigValue], [ConfigCategoryCode], [OrderNo], [ConfigType], [IsVisible], [ModifiedBy], [ModificationDate], [RequestTypeId])
VALUES(N'WFDisplayNationality',N'Display Select Nationality',N'عرض اختيار الجنسية',N'true',2,1,1,1,Null,Null,50)
Go
  ALTER TABLE dbo.WF_TransferRequest ADD
	NewCostCenter nvarchar(50) NULL,
	TransferType tinyint NULL,
	OldLevelCode tinyint NULL,
	NewLevelCode tinyint NULL
GO
---------------------End 2021-11-25--------
---------------------Hammad 2021-11-25--------
UPDATE WF_MasterRequests 
    SET CostCenter = (
        SELECT CostCenter
        FROM WF_MonthlyEffectsRequest where CostCenter is not null
        and WF_MasterRequests.MasterRequestCode = WF_MonthlyEffectsRequest.MasterRequestCode
    ) WHERE WF_MasterRequests.MasterRequestCode in ( SELECT MasterRequestCode
        FROM WF_MonthlyEffectsRequest where CostCenter is not null)

 ALTER TABLE [dbo].[WF_MonthlyEffectsRequest] DROP CONSTRAINT [FK_WF_MonthlyEffectsRequest_CostCenter]
GO
ALTER TABLE WF_MonthlyEffectsRequest
DROP COLUMN CostCenter;
GO


/****** Object:  Index [PK_CostCenter]    Script Date: 25/11/2021 11:16:50 AM ******/
begin transaction
ALTER TABLE [dbo].[CostCenter] DROP CONSTRAINT [PK_CostCenter] WITH ( ONLINE = OFF )
GO

ALTER TABLE [CostCenter]
ALTER COLUMN [CostCenter] nvarchar(150) not null;
Go

/****** Object:  Index [PK_CostCenter]    Script Date: 25/11/2021 11:16:50 AM ******/
ALTER TABLE [dbo].[CostCenter] ADD  CONSTRAINT [PK_CostCenter] PRIMARY KEY CLUSTERED 
(
	[CostCenter] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
commit

ALTER TABLE [dbo].[WF_MasterRequests]  WITH CHECK ADD  CONSTRAINT [FK_WF_MasterRequests_CostCenter] FOREIGN KEY([CostCenter])
REFERENCES [dbo].[CostCenter] ([CostCenter])
GO

ALTER TABLE [dbo].[WF_MasterRequests] CHECK CONSTRAINT [FK_WF_MasterRequests_CostCenter]
GO

---------------------End 2021-11-25--------
