ALTER TABLE [dbo].[SiteRepositoryRoleAssignments] DROP CONSTRAINT [FK_SiteRepositoryConfigRoleSiteRepositoryRoleAssignment];
GO

ALTER TABLE [dbo].[SiteRepositoryRoleAssignments] ALTER COLUMN [SiteRepositoryConfigRole_Id] INT NULL;
GO

CREATE NONCLUSTERED INDEX [IX_FK_SiteRepositoryConfigRoleSiteRepositoryRoleAssignment]
    ON [dbo].[SiteRepositoryRoleAssignments]([SiteRepositoryConfigRole_Id] ASC);
GO

CREATE NONCLUSTERED INDEX [IX_FK_SiteRepositorySiteRepositoryRoleAssignment]
    ON [dbo].[SiteRepositoryRoleAssignments]([SiteRepository_Id] ASC);
GO

ALTER TABLE [dbo].[SiteRepositoryRoleAssignments] WITH NOCHECK
    ADD CONSTRAINT [FK_SiteRepositoryConfigRoleSiteRepositoryRoleAssignment] FOREIGN KEY ([SiteRepositoryConfigRole_Id]) REFERENCES [dbo].[SiteRepositoryConfigRoles] ([Id]);
GO

ALTER TABLE [dbo].[SiteRepositoryRoleAssignments] WITH CHECK CHECK CONSTRAINT [FK_SiteRepositoryConfigRoleSiteRepositoryRoleAssignment];
GO