IF NOT EXISTS (SELECT 1 FROM [sys].[columns] WHERE [object_id] = OBJECT_ID(N'[dbo].[RepositoryHistory]') AND [name] = N'RepositoryType' AND [is_nullable] = 0) BEGIN
    UPDATE [dbo].[RepositoryHistory] SET [RepositoryType] = ISNULL([RepositoryType], 0);
END;