IF NOT EXISTS (SELECT 1 FROM [sys].[check_constraints] WHERE [parent_object_id] = OBJECT_ID(N'[dbo].[Repository]') AND [name] = N'CH_Repository_RepositoryType') BEGIN
    ALTER TABLE [dbo].[Repository] WITH CHECK ADD CONSTRAINT [CH_Repository_RepositoryType]
    CHECK ([RepositoryType] IN (0, 1));
    ALTER TABLE [dbo].[Repository] CHECK CONSTRAINT [CH_Repository_RepositoryType];
END;