/****** Object:  UserDefinedDataType [dbo].[Description]    Script Date: 2017/1/5 15:14:17 ******/
IF NOT EXISTS (SELECT * FROM sys.types st JOIN sys.schemas ss ON st.schema_id = ss.schema_id WHERE st.name = N'Description' AND ss.name = N'dbo')
CREATE TYPE [dbo].[Description] FROM [nvarchar](200) NULL

/****** Object:  UserDefinedDataType [dbo].[GUID]    Script Date: 2017/1/5 15:14:17 ******/
IF NOT EXISTS (SELECT * FROM sys.types st JOIN sys.schemas ss ON st.schema_id = ss.schema_id WHERE st.name = N'GUID' AND ss.name = N'dbo')
CREATE TYPE [dbo].[GUID] FROM [uniqueidentifier] NULL

/****** Object:  UserDefinedDataType [dbo].[Name]    Script Date: 2017/1/5 15:14:17 ******/
IF NOT EXISTS (SELECT * FROM sys.types st JOIN sys.schemas ss ON st.schema_id = ss.schema_id WHERE st.name = N'Name' AND ss.name = N'dbo')
CREATE TYPE [dbo].[Name] FROM [nvarchar](100) NULL

/****** Object:  UserDefinedDataType [dbo].[PWD]    Script Date: 2017/1/5 15:14:17 ******/
IF NOT EXISTS (SELECT * FROM sys.types st JOIN sys.schemas ss ON st.schema_id = ss.schema_id WHERE st.name = N'PWD' AND ss.name = N'dbo')
CREATE TYPE [dbo].[PWD] FROM [varchar](50) NULL

/****** Object:  Table [dbo].[Board]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Board]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Board](
	[IID] [uniqueidentifier] NOT NULL,
	[CategoryID] [dbo].[GUID] NOT NULL,
	[BoardName] [dbo].[Name] NOT NULL,
	[BoardDescription] [dbo].[Description] NOT NULL,
	[IsPublic] [int] NOT NULL,
	[Creater] [dbo].[GUID] NOT NULL,
	[CreateTime] [datetime] NULL,
	[ModifyTime] [datetime] NULL,
	[ModifyUser] [dbo].[Name] NULL,
	[SecretType] [int] NULL,
	[PublishType] [int] NULL,
	[IsShare] [int] NULL,
 CONSTRAINT [PK_BOARD] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[BoardChartPivot]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BoardChartPivot]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[BoardChartPivot](
	[IID] [uniqueidentifier] NOT NULL,
	[BoardPivotIID] [uniqueidentifier] NULL,
	[ChartIID] [uniqueidentifier] NULL,
	[FieldName] [nvarchar](100) NULL,
	[UserIID] [uniqueidentifier] NULL,
	[ChartPivotIID] [uniqueidentifier] NULL,
 CONSTRAINT [PK_BOARDCHARTPIVOT] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[BoardLanguage]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BoardLanguage]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[BoardLanguage](
	[IID] [uniqueidentifier] NOT NULL,
	[BoardIID] [uniqueidentifier] NULL,
	[LanguageCode] [nvarchar](10) NULL,
	[BoardName] [nvarchar](100) NULL,
	[BoardDescription] [nvarchar](200) NULL,
 CONSTRAINT [PK_BOARDLANGUAGE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[BoardPivot]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BoardPivot]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[BoardPivot](
	[IID] [uniqueidentifier] NOT NULL,
	[BoardIID] [uniqueidentifier] NULL,
	[Caption] [nvarchar](100) NULL,
	[DefaultValue] [nvarchar](254) NULL,
	[Flags] [int] NULL,
	[OrderIndex] [int] NULL,
	[ValueMode] [int] NULL,
 CONSTRAINT [PK_BOARDPIVOT] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[BoardPivotLanguage]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BoardPivotLanguage]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[BoardPivotLanguage](
	[IID] [uniqueidentifier] NOT NULL,
	[BoardPivotIID] [uniqueidentifier] NULL,
	[LanguageCode] [nvarchar](10) NULL,
	[BoardPivotCaption] [nvarchar](100) NULL,
	[BoardIID] [uniqueidentifier] NULL,
 CONSTRAINT [PK_BOARDPIVOTLANGUAGE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[Chart]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Chart]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Chart](
	[IID] [uniqueidentifier] NOT NULL,
	[CategoryID] [dbo].[GUID] NOT NULL,
	[ChartName] [dbo].[Name] NOT NULL,
	[ChartDescription] [dbo].[Description] NOT NULL,
	[IsPublic] [int] NOT NULL,
	[ChartClassIID] [dbo].[GUID] NOT NULL,
	[ModifyTime] [datetime] NOT NULL,
	[CreateTime] [datetime] NOT NULL,
	[Creater] [dbo].[GUID] NOT NULL,
	[ModifyUser] [dbo].[Name] NOT NULL,
	[ChartNotes] [nvarchar](max) NULL,
	[SecretType] [int] NULL,
	[PublishType] [int] NULL,
	[IsShare] [int] NULL,
 CONSTRAINT [PK_CHART] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartAggregateLanguage]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartAggregateLanguage]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartAggregateLanguage](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartAggregateIID] [uniqueidentifier] NULL,
	[LanguageCode] [nvarchar](10) NULL,
	[ChartAggregateName] [nvarchar](200) NULL,
	[ChartIID] [uniqueidentifier] NULL,
 CONSTRAINT [PK_CHARTAGGREGATELANGUAGE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartClass]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartClass]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartClass](
	[IID] [dbo].[GUID] NOT NULL,
	[ChartClassName] [dbo].[Name] NOT NULL,
	[ChartClassDescription] [dbo].[Description] NOT NULL,
	[FullClassName] [dbo].[Name] NOT NULL,
	[AssemblyName] [dbo].[Name] NOT NULL,
	[ClientUIClassName] [varchar](100) NULL,
	[ClientUIAssemblyName] [varchar](100) NULL,
	[ClientDMClassName] [varchar](100) NULL,
	[ClientDMAssemblyName] [varchar](100) NULL,
	[Catalog] [varchar](100) NULL,
	[DisplayName] [varchar](100) NULL,
	[PhotoURL] [varchar](300) NULL,
 CONSTRAINT [PK_CHARTCLASS] PRIMARY KEY CLUSTERED 
(
	[ChartClassName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [AK_KEY_2_CHARTCLA] UNIQUE NONCLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[ChartContainer]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartContainer]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartContainer](
	[IID] [uniqueidentifier] NOT NULL,
	[BoardID] [dbo].[GUID] NOT NULL,
	[Caption] [dbo].[Name] NOT NULL,
	[ContainerTop] [int] NOT NULL,
	[ContainerLeft] [int] NOT NULL,
	[ContainerWidth] [int] NOT NULL,
	[ContainerHeight] [int] NOT NULL,
	[ChartIID] [uniqueidentifier] NOT NULL,
	[ContainerZIndex] [int] NOT NULL,
	[UserIID] [uniqueidentifier] NULL,
 CONSTRAINT [PK_CHARTCONTAINER] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartContainerPosition]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartContainerPosition]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartContainerPosition](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartContainerIID] [uniqueidentifier] NOT NULL,
	[UserIID] [varchar](100) NOT NULL,
	[ContainerTop] [int] NOT NULL,
	[ContainerLeft] [int] NOT NULL,
	[ContainerWidth] [int] NOT NULL,
	[ContainerHeight] [int] NOT NULL,
	[ContainerZIndex] [int] NOT NULL,
 CONSTRAINT [PK_CHARTCONTAINERPOSITION] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[ChartDynamicYColor]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartDynamicYColor]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartDynamicYColor](
	[IID] [uniqueidentifier] NOT NULL,
	[ProportionIID] [uniqueidentifier] NULL,
	[MinValue] [numeric](18, 2) NULL,
	[MaxValue] [numeric](18, 2) NULL,
	[BackColor] [varchar](100) NULL,
	[ForeColor] [varchar](100) NULL,
	[OrderIndex] [int] NULL,
 CONSTRAINT [PK_CHARTDYNAMICYCOLOR] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[ChartDynamicYData]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartDynamicYData]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartDynamicYData](
	[IID] [varchar](50) NOT NULL,
	[ChartIID] [uniqueidentifier] NOT NULL,
	[XValue] [nvarchar](500) NOT NULL,
	[YField] [nvarchar](50) NOT NULL,
	[YValue] [numeric](18, 4) NULL,
	[RowIndex] [int] NULL,
	[ColIndex] [int] NULL,
 CONSTRAINT [PK_CHARTDYNAMICYDATA] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[ChartDynamicYDataComposition]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartDynamicYDataComposition]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartDynamicYDataComposition](
	[IID] [uniqueidentifier] NULL,
	[ChartIID] [uniqueidentifier] NOT NULL,
	[XStructure] [nvarchar](1000) NULL,
 CONSTRAINT [PK_CHARTDYNAMICYDATACOMPOSITIO] PRIMARY KEY CLUSTERED 
(
	[ChartIID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartDynamicYProportion]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartDynamicYProportion]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartDynamicYProportion](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NULL,
	[SourceYCaption] [nvarchar](200) NULL,
	[TargetYCaption] [nvarchar](200) NULL,
	[Visible] [bit] NULL,
	[OrderIndex] [int] NULL,
 CONSTRAINT [PK_CHARTDYNAMICYPROPORTION] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartExtensionColumn]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartExtensionColumn]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartExtensionColumn](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NULL,
	[ColumnURL] [nvarchar](2000) NULL,
	[OrderIndex] [int] NULL,
	[SendAuthentication] [int] NULL,
	[ColumnHeader] [nvarchar](200) NULL,
	[ColumnTitle] [nvarchar](200) NULL,
	[DestChartIID] [uniqueidentifier] NULL,
	[Type] [int] NULL,
 CONSTRAINT [PK_CHARTEXTENSIONCOLUMN] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartExtensionColumnLanguage]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartExtensionColumnLanguage]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartExtensionColumnLanguage](
	[IID] [uniqueidentifier] NULL,
	[LanguageCode] [nvarchar](40) NULL,
	[ColumnHeader] [nvarchar](200) NULL,
	[ColumnTitle] [nvarchar](200) NULL
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartExtensionColumnParamValue]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartExtensionColumnParamValue]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartExtensionColumnParamValue](
	[IID] [uniqueidentifier] NULL,
	[ParamName] [nvarchar](200) NULL,
	[ParamExpression] [nvarchar](1000) NULL,
	[OrderIndex] [int] NULL
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartExtensionDetail]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartExtensionDetail]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartExtensionDetail](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartExtensionIID] [uniqueidentifier] NULL,
	[PivotIID] [uniqueidentifier] NULL,
	[PivotCaption] [nvarchar](100) NULL,
	[DrilldownValueMode] [int] NOT NULL,
	[DrilldownValue] [nvarchar](2000) NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[ChartIID] [uniqueidentifier] NULL,
 CONSTRAINT [PK_CHARTEXTENSIONDETAIL] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartExtensionFilter]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartExtensionFilter]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartExtensionFilter](
	[IID] [dbo].[GUID] NOT NULL,
	[ChartExtensionIID] [dbo].[GUID] NOT NULL,
	[ColumnName] [dbo].[Name] NOT NULL,
	[OperationString] [dbo].[Name] NOT NULL,
	[FilterValue] [nvarchar](254) NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[Expresion] [nvarchar](254) NULL,
	[FilterType] [int] NULL,
	[ChartIID] [uniqueidentifier] NULL,
 CONSTRAINT [PK_CHARTEXTENSIONFILTER] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartExtensionY]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartExtensionY]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartExtensionY](
	[IID] [dbo].[GUID] NOT NULL,
	[ChartExtensionIID] [dbo].[GUID] NOT NULL,
	[IsFixedString] [bit] NOT NULL,
	[DestYCaption] [dbo].[Name] NOT NULL,
	[Map] [nvarchar](2000) NULL,
	[ChartIID] [uniqueidentifier] NULL,
 CONSTRAINT [PK_CHARTEXTENSIONY] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartFilter]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartFilter]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartFilter](
	[IID] [dbo].[GUID] NOT NULL,
	[ChartIID] [dbo].[GUID] NOT NULL,
	[ColumnName] [dbo].[Name] NOT NULL,
	[OperationString] [dbo].[Name] NOT NULL,
	[FilterValue] [nvarchar](4000) NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[LeftChar] [nvarchar](50) NULL,
	[RightChar] [nvarchar](50) NULL,
	[JoinChar] [nvarchar](50) NULL,
	[FilterType] [int] NULL,
 CONSTRAINT [PK_CHARTFILTER] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartGaugeDynamicData]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartGaugeDynamicData]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartGaugeDynamicData](
	[IID] [varchar](50) NOT NULL,
	[ChartIID] [uniqueidentifier] NOT NULL,
	[YIID] [uniqueidentifier] NOT NULL,
	[XValue] [nvarchar](500) NOT NULL,
	[YField] [nvarchar](50) NOT NULL,
	[YValue] [varchar](50) NOT NULL,
	[RowIndex] [int] NULL,
 CONSTRAINT [PK_CHARTGAUGEDYNAMICDATA] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[ChartGaugeDynamicY]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartGaugeDynamicY]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartGaugeDynamicY](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NOT NULL,
	[YIID] [uniqueidentifier] NOT NULL,
	[ColorsSegment] [int] NOT NULL,
	[ColorsString] [varchar](500) NOT NULL,
	[ComputeType] [int] NOT NULL,
	[MeasuringUnit] [nvarchar](100) NULL,
	[OrderIndex] [int] NOT NULL,
	[GuageValueType] [int] NOT NULL,
 CONSTRAINT [PK_CHARTGAUGEDYNAMICY] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[ChartLanguage]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartLanguage]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartLanguage](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NULL,
	[LanguageCode] [nvarchar](10) NULL,
	[ChartName] [nvarchar](100) NULL,
	[ChartDescription] [nvarchar](200) NULL,
	[ChartTitle] [nvarchar](254) NULL,
	[ChartNote] [nvarchar](max) NULL,
	[ChartYLable] [nvarchar](100) NULL,
	[ChartSecondYLable] [nvarchar](100) NULL,
 CONSTRAINT [PK_CHARTLANGUAGE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartParamValue]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartParamValue]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartParamValue](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NULL,
	[ParaCaption] [nvarchar](2000) NULL,
	[ParaValue] [nvarchar](2000) NULL,
	[OrderIndex] [int] NULL,
	[DataTableIID] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_CHARTPARAMVALUE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartPivot]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartPivot]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartPivot](
	[IID] [dbo].[GUID] NOT NULL,
	[ChartIID] [dbo].[GUID] NOT NULL,
	[Caption] [dbo].[Name] NOT NULL,
	[ValueMode] [int] NOT NULL,
	[DefaultValue] [nvarchar](254) NOT NULL,
	[FieldName] [dbo].[Name] NOT NULL,
	[DataType] [int] NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[NotShowALL] [int] NOT NULL,
	[Flags] [int] NOT NULL,
	[DisplayFieldName] [dbo].[Name] NULL,
	[Position] [int] NULL,
	[CaptionVisible] [int] NULL,
	[Format] [nvarchar](256) NULL,
	[IsFieldPivot] [int] NULL,
	[ShowIDValue] [bit] NULL,
	[UseDataSource] [int] NULL,
	[Description] [nvarchar](2000) NULL,
	[PivotRelation] [uniqueidentifier] NOT NULL,
	[PivotVisible] [int] NOT NULL,
	[ParamDTIID] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_CHARTPIVOT] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartPivotData]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartPivotData]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartPivotData](
	[IID] [uniqueidentifier] NOT NULL,
	[PivotIID] [uniqueidentifier] NULL,
	[PValue] [varchar](300) NULL,
	[LogicOperator] [varchar](50) NULL,
 CONSTRAINT [PK_CHARTPIVOTDATA] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[ChartPivotLanguage]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartPivotLanguage]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartPivotLanguage](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartPivotIID] [uniqueidentifier] NULL,
	[LanguageCode] [nvarchar](10) NULL,
	[ChartPivotCaption] [nvarchar](100) NULL,
	[ChartPivotDescription] [nvarchar](2000) NULL,
	[ChartIID] [uniqueidentifier] NULL,
 CONSTRAINT [PK_CHARTPIVOTLANGUAGE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartPropertyValue]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartPropertyValue]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartPropertyValue](
	[IID] [dbo].[GUID] NOT NULL,
	[ChartIID] [dbo].[GUID] NOT NULL,
	[PropertyName] [varchar](100) NOT NULL,
	[StringValue] [nvarchar](max) NULL,
	[IntValue] [int] NULL,
	[BoolValue] [bit] NULL,
	[DateTimeValue] [datetime] NULL,
	[DecimalValue] [float] NULL,
	[LongStringValue] [varchar](max) NULL,
 CONSTRAINT [PK_CHARTPROPERTYVALUE] PRIMARY KEY CLUSTERED 
(
	[ChartIID] ASC,
	[PropertyName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [AK_KEY_2_CHARTPRO] UNIQUE NONCLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[ChartSort]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartSort]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartSort](
	[IID] [dbo].[GUID] NOT NULL,
	[ChartIID] [dbo].[GUID] NOT NULL,
	[SortField] [dbo].[Name] NOT NULL,
	[SortDirection] [dbo].[Name] NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[SortType] [int] NOT NULL,
	[ObjectIID] [dbo].[GUID] NULL,
 CONSTRAINT [PK_CHARTSORT] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartTotalRow]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartTotalRow]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartTotalRow](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NOT NULL,
	[Visible] [bit] NOT NULL,
	[Description] [varchar](100) NULL,
 CONSTRAINT [PK_CHARTTOTALROW] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[ChartTotalRowColumn]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartTotalRowColumn]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartTotalRowColumn](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NOT NULL,
	[RowIID] [uniqueidentifier] NOT NULL,
	[GridCaption] [nvarchar](200) NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[TotalType] [int] NULL,
 CONSTRAINT [PK_CHARTTOTALROWCOLUMN] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartTotalRowColumnObject]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartTotalRowColumnObject]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartTotalRowColumnObject](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NOT NULL,
	[ColumnIID] [uniqueidentifier] NOT NULL,
	[FixValue] [nvarchar](200) NULL,
	[Expression] [nvarchar](500) NULL,
	[OrderIndex] [int] NULL,
 CONSTRAINT [PK_CHARTTOTALROWCOLUMNOBJECT] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartXYLanguage]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartXYLanguage]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartXYLanguage](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartXYIID] [uniqueidentifier] NULL,
	[LanguageCode] [nvarchar](10) NULL,
	[ChartXYCaption] [nvarchar](100) NULL,
	[ChartXYDescription] [nvarchar](2000) NULL,
	[ChartIID] [uniqueidentifier] NULL,
	[HyperlinkDisplayText] [nvarchar](100) NULL,
 CONSTRAINT [PK_CHARTXYLANGUAGE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ChartXYZ]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChartXYZ]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ChartXYZ](
	[IID] [dbo].[GUID] NOT NULL,
	[ChartIID] [dbo].[GUID] NOT NULL,
	[Caption] [dbo].[Name] NOT NULL,
	[FieldName] [dbo].[Name] NOT NULL,
	[CellExpression] [nvarchar](254) NOT NULL,
	[Unit] [int] NOT NULL,
	[DecimalPoint] [int] NOT NULL,
	[XYZFlag] [int] NOT NULL,
	[RowExpression] [nvarchar](254) NOT NULL,
	[FieldType] [int] NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[IsManualFill] [int] NOT NULL,
	[ThousandsSeparator] [int] NULL,
	[Alignment] [int] NULL,
	[ColumnWidth] [numeric](18, 2) NULL,
	[Visible] [bit] NULL,
	[Flags] [int] NOT NULL,
	[DisplayFieldName] [dbo].[Name] NULL,
	[KeyCaption] [dbo].[Name] NULL,
	[Format] [nvarchar](256) NULL,
	[AxisFormat] [nvarchar](256) NULL,
	[UseDataSource] [int] NULL,
	[Description] [nvarchar](2000) NULL,
	[CalcYType] [int] NULL,
	[YAxisType] [int] NOT NULL,
	[ColumnOrLine] [int] NOT NULL,
	[MultipleColors] [int] NULL,
	[IsURL] [int] NULL,
	[HyperlinkDisplayText] [nvarchar](100) NULL,
 CONSTRAINT [PK_CHARTXYZ] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ColorScheme]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ColorScheme]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ColorScheme](
	[IID] [uniqueidentifier] NOT NULL,
	[ColorName] [nvarchar](50) NULL,
	[ColorValue] [nvarchar](50) NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[SchemeIID] [uniqueidentifier] NULL,
	[Scheme] [nvarchar](50) NULL,
 CONSTRAINT [PK_COLORSCHEME] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[DataConnection]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DataConnection]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DataConnection](
	[IID] [uniqueidentifier] NOT NULL,
	[ConnectionName] [dbo].[Name] NOT NULL,
	[Description] [dbo].[Description] NOT NULL,
	[ConnectionString] [nvarchar](3000) NOT NULL,
	[Creater] [dbo].[GUID] NOT NULL,
	[CreateTime] [datetime] NOT NULL,
	[ModifyTime] [datetime] NULL,
	[ModifyUser] [dbo].[Name] NULL,
	[ConnectionType] [int] NOT NULL,
	[EmbedExtendedIID] [uniqueidentifier] NULL,
 CONSTRAINT [PK_DATACONNECTION] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[DataTable]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DataTable]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DataTable](
	[IID] [uniqueidentifier] NOT NULL,
	[TableTypeID] [dbo].[GUID] NULL,
	[DataTableName] [dbo].[Name] NOT NULL,
	[ConnectionID] [dbo].[GUID] NOT NULL,
	[DataTableSQL] [nvarchar](max) NOT NULL,
	[Description] [dbo].[Description] NOT NULL,
	[Creater] [dbo].[GUID] NOT NULL,
	[CreateTime] [datetime] NOT NULL,
	[ModifyTime] [datetime] NOT NULL,
	[ModifyUser] [dbo].[Name] NOT NULL,
	[FetchOnDemand] [bit] NULL,
	[RefreshTimeSpan] [numeric](18, 0) NULL,
	[AutoRefreshTime] [datetime] NOT NULL,
	[TableNotes] [nvarchar](max) NULL,
	[ConfigType] [int] NULL,
	[Type] [int] NULL,
	[DTTypeIID] [uniqueidentifier] NULL,
	[DTClassRelationIID] [uniqueidentifier] NULL,
	[QueryTimeout] [int] NOT NULL,
	[IsAdvancedSql] [int] NULL,
	[TwoPhasesExecute] [bit] NULL,
	[DTInfo] [varchar](500) NULL,
 CONSTRAINT [PK_DATATABLE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[DataTableClass]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DataTableClass]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DataTableClass](
	[IID] [uniqueidentifier] NOT NULL,
	[DTClassName] [nvarchar](100) NULL,
	[Description] [nvarchar](200) NULL,
 CONSTRAINT [PK_DATATABLECLASS] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[DataTableClassRelation]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DataTableClassRelation]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DataTableClassRelation](
	[IID] [uniqueidentifier] NOT NULL,
	[DataTableIID] [uniqueidentifier] NULL,
	[DTClassIID] [uniqueidentifier] NULL,
 CONSTRAINT [PK_DATATABLECLASSRELATION] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[DrillDown]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DrillDown]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DrillDown](
	[IID] [dbo].[GUID] NOT NULL,
	[ChartIID] [dbo].[GUID] NULL,
	[DestChartIID] [dbo].[GUID] NULL,
	[Type] [int] NULL,
 CONSTRAINT [PK_DRILLDOWN] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[DrillDownDetail]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DrillDownDetail]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DrillDownDetail](
	[IID] [dbo].[GUID] NOT NULL,
	[DrillDownIID] [dbo].[GUID] NOT NULL,
	[PivotIID] [dbo].[GUID] NOT NULL,
	[PivotCaption] [dbo].[Name] NOT NULL,
	[DrilldownValueMode] [int] NOT NULL,
	[DrilldownValue] [nvarchar](2000) NOT NULL,
	[OrderIndex] [int] NOT NULL,
 CONSTRAINT [PK_DRILLDOWNDETAIL] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[DrillDownFilter]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DrillDownFilter]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DrillDownFilter](
	[IID] [dbo].[GUID] NOT NULL,
	[DrillDownIID] [dbo].[GUID] NOT NULL,
	[ColumnName] [dbo].[Name] NOT NULL,
	[OperationString] [dbo].[Name] NOT NULL,
	[FilterValue] [nvarchar](254) NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[Expresion] [nvarchar](254) NULL,
	[FilterType] [int] NULL,
 CONSTRAINT [PK_DRILLDOWNFILTER] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[DrilldownForUrl]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DrilldownForUrl]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DrilldownForUrl](
	[IID] [varchar](50) NOT NULL,
	[UrlGeneratorID] [varchar](50) NULL,
	[BaseAddress] [nvarchar](1000) NULL,
	[DrilldownIID] [uniqueidentifier] NULL,
	[Type] [int] NULL,
	[OrderIndex] [int] NULL,
 CONSTRAINT [PK_DRILLDOWNFORURL] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[DrilldownUrlParamValues]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DrilldownUrlParamValues]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DrilldownUrlParamValues](
	[IID] [varchar](50) NOT NULL,
	[ParamName] [nvarchar](200) NULL,
	[ParamExpression] [nvarchar](500) NULL,
	[OrderIndex] [int] NULL
) ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[DrillDownY]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DrillDownY]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DrillDownY](
	[IID] [dbo].[GUID] NOT NULL,
	[DrillDownIID] [dbo].[GUID] NOT NULL,
	[IsFixedString] [bit] NOT NULL,
	[DestYCaption] [dbo].[Name] NOT NULL,
	[Map] [nvarchar](2000) NULL,
 CONSTRAINT [PK_DRILLDOWNY] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[FavoriteContent]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FavoriteContent]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[FavoriteContent](
	[IID] [dbo].[GUID] NOT NULL,
	[FavoritesName] [dbo].[Name] NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[IcoURL] [nvarchar](200) NULL,
	[URL] [nvarchar](500) NULL,
	[ParamString] [nvarchar](500) NULL,
	[FavoriteClass] [nvarchar](500) NULL,
	[FavoritesTypeIID] [dbo].[GUID] NOT NULL,
 CONSTRAINT [PK_FAVORITECONTENT] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[FavoriteItem]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FavoriteItem]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[FavoriteItem](
	[IID] [dbo].[GUID] NOT NULL,
	[FavoritesTypeName] [dbo].[Name] NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[ChartIID] [dbo].[GUID] NOT NULL,
 CONSTRAINT [PK_FAVORITEITEM] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[FreeChartCell]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FreeChartCell]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[FreeChartCell](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NOT NULL,
	[ColumnIndex] [int] NOT NULL,
	[RowIndex] [int] NOT NULL,
	[FontSize] [int] NULL,
	[FontColor] [nvarchar](12) NULL,
	[BackColor] [nvarchar](12) NULL,
	[HAlign] [int] NULL,
	[VAlign] [int] NULL,
	[Border] [nvarchar](20) NULL,
	[BorderColor] [nvarchar](12) NULL,
	[Bold] [int] NULL,
	[Italic] [int] NULL,
	[Indent] [int] NULL,
	[Format] [nvarchar](256) NULL,
	[UnderLine] [int] NULL,
	[CellType] [int] NULL,
	[CellValue] [nvarchar](2000) NULL,
	[ColSpan] [int] NULL,
	[RowSpan] [int] NULL,
	[ValueType] [nvarchar](20) NULL,
	[CellCalcType] [int] NULL,
 CONSTRAINT [PK_FREECHARTCELL] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[FreeChartCellColorFilter]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FreeChartCellColorFilter]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[FreeChartCellColorFilter](
	[IID] [uniqueidentifier] NOT NULL,
	[CellIID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NOT NULL,
	[OperationString] [nvarchar](100) NULL,
	[FilterValue] [nvarchar](4000) NULL,
	[OrderIndex] [int] NULL,
	[FilterType] [int] NULL,
	[FilterCellIID] [uniqueidentifier] NULL,
	[FontColor] [nvarchar](12) NULL,
	[BorderColor] [nvarchar](12) NULL,
	[BackColor] [nvarchar](12) NULL,
 CONSTRAINT [PK_FREECHARTCELLCOLORFILTER] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[FreeChartCellDataFilter]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FreeChartCellDataFilter]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[FreeChartCellDataFilter](
	[IID] [dbo].[GUID] NOT NULL,
	[ChartIID] [dbo].[GUID] NOT NULL,
	[CellIID] [uniqueidentifier] NOT NULL,
	[ColumnName] [dbo].[Name] NOT NULL,
	[OperationString] [dbo].[Name] NOT NULL,
	[FilterValue] [nvarchar](4000) NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[LeftChar] [nvarchar](50) NULL,
	[RightChar] [nvarchar](50) NULL,
	[JoinChar] [nvarchar](50) NULL,
	[FilterType] [int] NULL,
 CONSTRAINT [PK_FREECHARTCELLDATAFILTER] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[FreeChartCellLanguage]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FreeChartCellLanguage]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[FreeChartCellLanguage](
	[IID] [uniqueidentifier] NOT NULL,
	[CellIID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NOT NULL,
	[LanguageCode] [nvarchar](20) NOT NULL,
	[CellValue] [nvarchar](2000) NULL,
 CONSTRAINT [PK_FREECHARTCELLLANGUAGE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[FreeChartColumn]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FreeChartColumn]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[FreeChartColumn](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NOT NULL,
	[FontSize] [int] NULL,
	[FontColor] [nvarchar](12) NULL,
	[BackColor] [nvarchar](12) NULL,
	[HAlign] [int] NULL,
	[VAlign] [int] NULL,
	[OrderIndex] [int] NOT NULL,
	[Visible] [int] NULL,
	[ColumnWidth] [int] NULL,
	[Border] [nvarchar](20) NULL,
	[BorderColor] [nvarchar](12) NULL,
	[Bold] [int] NULL,
	[Italic] [int] NULL,
	[Indent] [int] NULL,
	[Format] [nvarchar](256) NULL,
	[UnderLine] [int] NULL,
	[LinkPath] [int] NULL,
 CONSTRAINT [PK_FREECHARTCOLUMN] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[FreeChartRow]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FreeChartRow]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[FreeChartRow](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NOT NULL,
	[FontSize] [int] NULL,
	[FontColor] [nvarchar](12) NULL,
	[BackColor] [nvarchar](12) NULL,
	[HAlign] [int] NULL,
	[VAlign] [int] NULL,
	[OrderIndex] [int] NOT NULL,
	[Visible] [int] NULL,
	[RowHight] [int] NULL,
	[Border] [nvarchar](20) NULL,
	[BorderColor] [nvarchar](12) NULL,
	[Bold] [int] NULL,
	[Italic] [int] NULL,
	[Indent] [int] NULL,
	[Format] [nvarchar](256) NULL,
	[UnderLine] [int] NULL,
 CONSTRAINT [PK_FREECHARTROW] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[GlobalFilter]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GlobalFilter]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[GlobalFilter](
	[IID] [uniqueidentifier] NOT NULL,
	[FilterName] [dbo].[Name] NOT NULL,
	[FilterType] [int] NOT NULL,
	[FilterDataType] [int] NOT NULL,
	[Description] [dbo].[Description] NOT NULL,
	[PluginID] [dbo].[GUID] NULL,
	[PIID] [uniqueidentifier] NULL,
	[FKField] [nvarchar](200) NULL,
	[Creater] [uniqueidentifier] NULL,
	[PublishType] [int] NULL,
	[SecretType] [int] NULL,
 CONSTRAINT [PK_GLOBALFILTER] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[GlobalVariable]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GlobalVariable]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[GlobalVariable](
	[Name] [nvarchar](100) NOT NULL,
	[SqlStatement] [nvarchar](max) NULL,
	[DCIID] [uniqueidentifier] NULL,
	[DefaultValue] [nvarchar](2000) NULL,
	[OrderIndex] [int] NULL,
 CONSTRAINT [PK_GLOBALVARIABLE] PRIMARY KEY CLUSTERED 
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

/****** Object:  Table [dbo].[GridWidth]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GridWidth]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[GridWidth](
	[IID] [uniqueidentifier] NOT NULL,
	[ObjectType] [nvarchar](50) NOT NULL,
	[ObjectID] [nvarchar](100) NOT NULL,
	[ColumnKey] [nvarchar](100) NULL,
	[UserIID] [uniqueidentifier] NOT NULL,
	[Width] [numeric](18, 2) NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[Sort] [int] NOT NULL,
 CONSTRAINT [PK_GRIDWIDTH] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[Levels]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Levels]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Levels](
	[ID] [int] NOT NULL,
	[GradeName] [dbo].[Name] NOT NULL,
 CONSTRAINT [PK_LEVELS] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[LookupData]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LookupData]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[LookupData](
	[LDSID] [uniqueidentifier] NOT NULL,
	[ID] [nvarchar](100) NOT NULL,
	[Description] [nvarchar](500) NULL,
	[PID] [nvarchar](100) NULL,
	[SortOrder] [int] NULL,
 CONSTRAINT [PK_LOOKUPDATA] PRIMARY KEY CLUSTERED 
(
	[LDSID] ASC,
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[MultiLevelField]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MultiLevelField]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[MultiLevelField](
	[IID] [uniqueidentifier] NOT NULL,
	[TableFieldIID] [uniqueidentifier] NULL,
	[TableFieldCode] [nvarchar](100) NULL,
	[TableFieldName] [nvarchar](100) NULL,
	[Level] [int] NULL,
 CONSTRAINT [PK_MULTILEVELFIELD] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[OperationRight]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OperationRight]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[OperationRight](
	[IID] [uniqueidentifier] NOT NULL,
	[ObjectID] [dbo].[GUID] NOT NULL,
	[ObjectType] [int] NOT NULL,
	[RightValue] [int] NOT NULL,
	[FunctionID] [dbo].[GUID] NULL,
 CONSTRAINT [PK_OPERATIONRIGHT] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[Plugin]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Plugin]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Plugin](
	[IID] [uniqueidentifier] NOT NULL,
	[PluginName] [dbo].[Name] NOT NULL,
	[Description] [dbo].[Description] NOT NULL,
	[PluginCode] [dbo].[Name] NULL,
	[DataTableIID] [uniqueidentifier] NULL,
	[PKField] [nvarchar](200) NULL,
	[Flags] [int] NOT NULL,
	[IsInnerDataSource] [int] NULL,
	[IsFlat] [int] NULL,
	[DSIDDataType] [int] NULL,
	[Creater] [uniqueidentifier] NULL,
	[PublishType] [int] NULL,
	[SecretType] [int] NULL,
 CONSTRAINT [PK_PLUGIN] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[PlugInCaption]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PlugInCaption]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[PlugInCaption](
	[IID] [uniqueidentifier] NOT NULL,
	[PluginIID] [uniqueidentifier] NOT NULL,
	[FieldName] [nvarchar](100) NULL,
	[FieldCaption] [nvarchar](100) NULL,
	[FieldDataType] [int] NULL,
 CONSTRAINT [PK_PLUGINCAPTION] PRIMARY KEY NONCLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[PluginDataImport]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PluginDataImport]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[PluginDataImport](
	[IID] [uniqueidentifier] NOT NULL,
	[PluginIID] [uniqueidentifier] NULL,
	[ValueField] [dbo].[Name] NULL,
	[DisplayField] [dbo].[Name] NULL,
	[ParentField] [dbo].[Name] NULL,
	[FirstNodeCondition] [nvarchar](1000) NULL,
	[SortStr] [nvarchar](500) NULL,
 CONSTRAINT [PK_PLUGINDATAIMPORT] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[PluginDataTable]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PluginDataTable]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[PluginDataTable](
	[IID] [uniqueidentifier] NOT NULL,
	[ConnectionIID] [dbo].[GUID] NOT NULL,
	[DataTableSQL] [nvarchar](max) NOT NULL,
 CONSTRAINT [PK_PLUGINDATATABLE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

/****** Object:  Table [dbo].[ScatterPlotFilter]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ScatterPlotFilter]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ScatterPlotFilter](
	[IID] [uniqueidentifier] NOT NULL,
	[ScatterStyleIID] [uniqueidentifier] NULL,
	[FieldName] [nvarchar](100) NULL,
	[FilterValue] [nvarchar](100) NULL,
	[OperatorString] [nvarchar](100) NULL,
	[LeftMark] [nvarchar](100) NULL,
	[RightMark] [nvarchar](100) NULL,
	[LogicMark] [nvarchar](100) NULL,
	[OrderIndex] [int] NULL,
 CONSTRAINT [PK_SCATTERPLOTFILTER] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ScatterPlotStyle]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ScatterPlotStyle]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ScatterPlotStyle](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NULL,
	[Name] [nvarchar](100) NULL,
	[Color] [int] NULL,
	[Shape] [int] NULL,
	[OrderIndex] [int] NULL,
 CONSTRAINT [PK_SCATTERPLOTSTYLE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[ScatterTargetStructure]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ScatterTargetStructure]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ScatterTargetStructure](
	[ChartIID] [uniqueidentifier] NULL,
	[TargetYIID] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](100) NULL,
	[XYType] [int] NULL,
	[Color] [int] NULL,
	[Visible] [bit] NULL,
	[Weight] [decimal](18, 0) NULL,
	[LineStyle] [int] NULL,
	[OrderIndex] [int] NULL,
 CONSTRAINT [PK_SCATTERTARGETSTRUCTURE] PRIMARY KEY CLUSTERED 
(
	[TargetYIID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[SystemParams]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SystemParams]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[SystemParams](
	[IID] [uniqueidentifier] NOT NULL,
	[ParamType] [int] NOT NULL,
	[ParamCode] [dbo].[Name] NOT NULL,
	[ParamName] [dbo].[Name] NOT NULL,
	[ParamValue] [nvarchar](max) NOT NULL,
	[ParamMemo] [dbo].[Description] NOT NULL,
 CONSTRAINT [PK_SYSTEMPARAMS] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

/****** Object:  Table [dbo].[TableField]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TableField]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[TableField](
	[IID] [uniqueidentifier] NOT NULL,
	[DataTableID] [dbo].[GUID] NOT NULL,
	[FieldName] [dbo].[Name] NOT NULL,
	[FieldDataType] [int] NULL,
	[OrderIndex] [int] NOT NULL,
	[PluginIID] [uniqueidentifier] NULL,
	[AppType] [int] NULL,
 CONSTRAINT [PK_TABLEFIELD] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[TableFilter]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TableFilter]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[TableFilter](
	[IID] [dbo].[GUID] NOT NULL,
	[DataTableID] [dbo].[GUID] NOT NULL,
	[FilterName] [dbo].[Name] NOT NULL,
	[FilterType] [int] NOT NULL,
	[FilterDataType] [int] NOT NULL,
	[FieldName] [dbo].[Name] NOT NULL,
	[Description] [dbo].[Description] NOT NULL,
	[IsGlobal] [bit] NOT NULL,
	[PluginID] [dbo].[GUID] NULL,
	[GlobalFilterID] [dbo].[GUID] NULL,
	[PIID] [uniqueidentifier] NULL,
	[FKField] [nvarchar](200) NULL,
 CONSTRAINT [PK_TABLEFILTER] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[TableParams]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TableParams]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[TableParams](
	[IID] [uniqueidentifier] NOT NULL,
	[DTIID] [uniqueidentifier] NULL,
	[Name] [nvarchar](100) NULL,
	[Caption] [nvarchar](200) NULL,
	[DataType] [int] NULL,
	[ParentParamIID] [uniqueidentifier] NULL,
	[ParentDTIID] [uniqueidentifier] NULL,
	[DataSourceID] [uniqueidentifier] NULL,
	[OrderIndex] [int] NULL,
	[IsMutilLevelSupported] [bit] NULL,
	[ParaDefValue] [nvarchar](max) NULL,
	[ParamRelation] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_TABLEPARAMS] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

/****** Object:  Table [dbo].[TableRelation]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TableRelation]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[TableRelation](
	[IID] [uniqueidentifier] NOT NULL,
	[MasterTableIID] [uniqueidentifier] NULL,
	[RelationTableIID] [uniqueidentifier] NULL,
 CONSTRAINT [PK_TABLERELATION] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[UrlGenerator]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UrlGenerator]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UrlGenerator](
	[UrlGeneratorID] [varchar](50) NULL,
	[Name] [nvarchar](100) NULL,
	[Description] [nvarchar](500) NULL,
	[RunDLL] [nvarchar](100) NULL,
	[FullClassName] [nvarchar](200) NULL,
	[Version] [nvarchar](50) NULL,
	[OrderIndex] [int] NULL,
	[AssemblyID] [varchar](50) NULL
) ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[UrlGeneratorFile]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UrlGeneratorFile]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UrlGeneratorFile](
	[IID] [varchar](50) NULL,
	[Content] [varbinary](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[UserChartInfo]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UserChartInfo]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UserChartInfo](
	[IID] [uniqueidentifier] NOT NULL,
	[ChartIID] [uniqueidentifier] NULL,
	[UserIID] [uniqueidentifier] NULL,
	[InfoType] [int] NULL,
	[ObjectInfo] [image] NULL,
 CONSTRAINT [PK_USERCHARTINFO] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

/****** Object:  Table [dbo].[UserDefaultInfo]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

SET ANSI_PADDING ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UserDefaultInfo]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UserDefaultInfo](
	[IID] [dbo].[GUID] NOT NULL,
	[UserDefaultType] [int] NOT NULL,
	[UserID] [dbo].[GUID] NULL,
	[ObjectClassIID] [varchar](200) NULL,
	[ObjectIID] [varchar](200) NULL,
	[ObjectValue] [varchar](200) NULL,
 CONSTRAINT [PK_USERDEFAULTINFO] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

SET ANSI_PADDING OFF

/****** Object:  Table [dbo].[UserGroupRelation]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UserGroupRelation]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UserGroupRelation](
	[IID] [uniqueidentifier] NOT NULL,
	[GroupID] [dbo].[GUID] NOT NULL,
	[UserID] [dbo].[GUID] NOT NULL,
 CONSTRAINT [PK_USERGROUPRELATION] PRIMARY KEY NONCLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[UserObjectXML]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UserObjectXML]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UserObjectXML](
	[IID] [uniqueidentifier] NOT NULL,
	[UserIID] [uniqueidentifier] NULL,
	[ObjectIID] [uniqueidentifier] NULL,
	[ObjectType] [int] NULL,
	[ObjectXMLData] [nvarchar](max) NULL,
 CONSTRAINT [PK_UserObjectXML] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

/****** Object:  Table [dbo].[WorkSpace]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WorkSpace]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[WorkSpace](
	[IID] [uniqueidentifier] NOT NULL,
	[CategoryID] [dbo].[GUID] NOT NULL,
	[WSPName] [dbo].[Name] NOT NULL,
	[WSPDescription] [dbo].[Description] NOT NULL,
	[IsPublic] [int] NOT NULL,
	[Creater] [dbo].[GUID] NOT NULL,
	[CreateTime] [datetime] NULL,
	[ModifyTime] [datetime] NULL,
	[ModifyUser] [dbo].[Name] NULL,
	[SecretType] [int] NULL,
	[PublishType] [int] NULL,
	[IsShare] [int] NULL,
 CONSTRAINT [PK_WORKSPACE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[WorkSpaceLanguage]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WorkSpaceLanguage]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[WorkSpaceLanguage](
	[IID] [uniqueidentifier] NOT NULL,
	[WorkSpaceIID] [uniqueidentifier] NULL,
	[LanguageCode] [nvarchar](10) NULL,
	[WorkSpaceName] [nvarchar](100) NULL,
	[WorkSpaceDescription] [nvarchar](200) NULL,
 CONSTRAINT [PK_WORKSPACELANGUAGE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[WorkspacePivot]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WorkspacePivot]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[WorkspacePivot](
	[IID] [uniqueidentifier] NOT NULL,
	[WorkspaceIID] [uniqueidentifier] NULL,
	[Caption] [nvarchar](100) NULL,
	[DefaultValue] [nvarchar](254) NULL,
	[Flags] [int] NULL,
	[OrderIndex] [int] NULL,
	[ShowIDValue] [int] NULL,
	[ValueMode] [int] NULL,
	[DataSoruceIID] [uniqueidentifier] NULL,
	[InputType] [int] NULL,
	[IsMutiSelect] [int] NULL,
	[IsALL] [int] NULL,
	[UseGlobalFilter] [int] NULL,
 CONSTRAINT [PK_WORKSPACEPIVOT] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[WorkspacePivotLanguage]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WorkspacePivotLanguage]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[WorkspacePivotLanguage](
	[IID] [uniqueidentifier] NOT NULL,
	[WorkspacePivotIID] [uniqueidentifier] NULL,
	[LanguageCode] [nvarchar](10) NULL,
	[WorkspacePivotCaption] [nvarchar](100) NULL,
 CONSTRAINT [PK_WORKSPACEPIVOTLANGUAGE] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[WorkspacePivotRelation]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WorkspacePivotRelation]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[WorkspacePivotRelation](
	[IID] [uniqueidentifier] NOT NULL,
	[WorkspacePivotIID] [uniqueidentifier] NULL,
	[BoardIID] [uniqueidentifier] NULL,
	[ChartIID] [uniqueidentifier] NULL,
	[FieldName] [nvarchar](100) NULL,
	[UserIID] [uniqueidentifier] NULL,
	[BoardPivotIID] [uniqueidentifier] NULL,
	[ChartPivotIID] [uniqueidentifier] NULL,
 CONSTRAINT [PK_WORKSPACEPIVOTRELATION] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

/****** Object:  Table [dbo].[WSPBoard]    Script Date: 2017/1/5 15:14:17 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WSPBoard]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[WSPBoard](
	[IID] [uniqueidentifier] NOT NULL,
	[WSPID] [dbo].[GUID] NOT NULL,
	[BoardID] [dbo].[GUID] NOT NULL,
	[BoardIndex] [int] NOT NULL,
	[Selected] [bit] NOT NULL,
	[UserIID] [uniqueidentifier] NULL,
 CONSTRAINT [PK_WSPBOARD] PRIMARY KEY CLUSTERED 
(
	[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

