USE [envisage]
GO

ALTER TABLE [dbo].[SystemAttributes]
ADD CONSTRAINT PK_SystemAttributesID PRIMARY KEY (Id)
go

ALTER TABLE [dbo].[Rate]
ADD CONSTRAINT PK_RateID PRIMARY KEY (Id)
go

ALTER TABLE [dbo].[Fee_Calculation]
ADD CONSTRAINT PK_FeeCalculationID PRIMARY KEY (Id)
go

ALTER TABLE [dbo].[Expenditure2Expenditure]
ADD CONSTRAINT PK_Expenditure2ExpenditureID PRIMARY KEY (Id)
go


ALTER TABLE [dbo].[Rate]
ADD CONSTRAINT FK_Rate_ExpenditureCategory FOREIGN KEY (ExpenditureCategoryId) REFERENCES [dbo].[Expenditure_Category] (Id)
go

ALTER TABLE [dbo].[Fee_Calculation]
ADD CONSTRAINT FK_FeeCalculation_ExpenditureCategory FOREIGN KEY (ExpenditureCategoryId) REFERENCES [dbo].[Expenditure_Category] (Id)
go

ALTER TABLE [dbo].[Expenditure2Expenditure]
ADD CONSTRAINT FK_Expenditure2Expenditure_ExpenditureCategory FOREIGN KEY (ParentId) REFERENCES [dbo].[Expenditure_Category] (Id)
go