if not exists (select * from sys.tables where object_id = object_id(N'dbo.TodoHistory'))
    create table dbo.TodoHistory
    (
        ID int identity(1,1) not null,
        HistoryType nchar(1) not null,
        TodoID uniqueidentifier not null,
        ConnectionID uniqueidentifier null,
        CreationDate datetime null,
        DueDate datetime null,
        Name nvarchar(250) null,
        Priority int null,
        Data nvarchar(max) null,
        UserInfoID uniqueidentifier null,
        SecurityGroup uniqueidentifier null,
        PrimaryTodoUsersID uniqueidentifier null,
        ClosedDate datetime null,
        IsPrivate bit not null,
        CustomField1 nvarchar(256) null,
        CustomField2 nvarchar(256) null,
        CustomField3 nvarchar(256) null,
        ModifiedDate datetime not null,
        ModifiedUsername nvarchar(256) null,
        ModifiedLoggedUserName nvarchar(256) null,
        EventProcessed bit not null constraint DF_TodoHistory_EventProcessed default (0)
    )