if exists (select 1 from sys.columns where object_id = object_id(N'dbo.RepositoryHistory') and name = N'RepositoryType' and is_nullable = 0)
begin
    alter table dbo.RepositoryHistory alter column RepositoryType tinyint null;
end;

if not exists (select 1 from dbo.Repository where ID = '00000000-0000-0000-0000-000000000000')
begin
	insert into dbo.Repository (ID, Name, RepositoryType) values ('00000000-0000-0000-0000-000000000000', 'Default', 0);
end;