IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[sysdiagrams]') AND type = 'U')
CREATE TABLE [dbo].[sysdiagrams]
(
    [name] sysname COLLATE Chinese_PRC_CI_AS NOT NULL,
    [principal_id] int NOT NULL,
    [diagram_id] int NOT NULL IDENTITY(1, 1),
    [version] int NULL,
    [definition] varbinary(max) NULL,
    CONSTRAINT [PK__sysdiagr__C2B05B610CF815D1] PRIMARY KEY ([diagram_id] ASC)
)


IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID('[dbo].[sysdiagrams]') AND name = 'UK_principal_name')
CREATE UNIQUE NONCLUSTERED INDEX [UK_principal_name] ON [dbo].[sysdiagrams]([principal_id] ASC,[name] ASC)