USE [DD_ECM]
GO
/****** Object:  Table [dbo].[TBMON_PROFILE]    Script Date: 29.06.2022 14:24:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TBMON_PROFILE](
	[GUID] [int] IDENTITY(1,1) NOT NULL,
	[TITLE] [varchar](250) NOT NULL,
	[CAPTION] [varchar](250) NULL,
	[EXEC_SQL] [nvarchar](max) NULL,
	[RETURN_TYPE] [varchar](100) NOT NULL,
	[SEQUENCE] [int] NOT NULL,
	[COMMENT] [varchar](500) NULL,
	[ACTIVE] [bit] NOT NULL,
	[ADDED_WHO] [varchar](100) NOT NULL,
	[ADDED_WHEN] [datetime] NOT NULL,
	[CHANGED_WHO] [varchar](100) NULL,
	[CHANGED_WHEN] [datetime] NULL,
 CONSTRAINT [PK_TBMON_PROFILE] PRIMARY KEY CLUSTERED 
(
	[GUID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [UQ1_TBMON_PROFILE] UNIQUE NONCLUSTERED 
(
	[TITLE] 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]
GO
/****** Object:  Table [dbo].[TBMON_PROFILE_PARAM]    Script Date: 29.06.2022 14:24:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TBMON_PROFILE_PARAM](
	[GUID] [int] IDENTITY(1,1) NOT NULL,
	[PROFILE_ID] [int] NOT NULL,
	[CAPTION] [varchar](250) NOT NULL,
	[DESCRIPTION] [nvarchar](250) NOT NULL,
	[DATA_TYPE] [varchar](50) NOT NULL,
	[PATTERN] [nvarchar](50) NOT NULL,
	[ITEMS] [nvarchar](max) NULL,
	[ITEM_TYPE] [nvarchar](50) NULL,
	[SEQUENCE] [tinyint] NOT NULL,
	[REQUIRED] [bit] NOT NULL,
	[COMMENT] [varchar](500) NULL,
	[ACTIVE] [bit] NOT NULL,
	[ADDED_WHO] [varchar](100) NOT NULL,
	[ADDED_WHEN] [datetime] NOT NULL,
	[CHANGED_WHO] [varchar](100) NULL,
	[CHANGED_WHEN] [datetime] NULL,
 CONSTRAINT [PK_TBMON_PROFILE_PARAM] PRIMARY KEY CLUSTERED 
(
	[GUID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [UQ1_TBMON_PROFILE_PARAM] UNIQUE NONCLUSTERED 
(
	[CAPTION] 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]
GO
ALTER TABLE [dbo].[TBMON_PROFILE] ADD  CONSTRAINT [DF_TBMON_PROFILE_SEQUENCE]  DEFAULT ((0)) FOR [SEQUENCE]
GO
ALTER TABLE [dbo].[TBMON_PROFILE] ADD  CONSTRAINT [DF__TBMON_PRO__ACTIV__4FF1D159]  DEFAULT ((1)) FOR [ACTIVE]
GO
ALTER TABLE [dbo].[TBMON_PROFILE] ADD  CONSTRAINT [DF__TBMON_PRO__ADDED__50E5F592]  DEFAULT ('DEFAULT') FOR [ADDED_WHO]
GO
ALTER TABLE [dbo].[TBMON_PROFILE] ADD  CONSTRAINT [DF__TBMON_PRO__ADDED__51DA19CB]  DEFAULT (getdate()) FOR [ADDED_WHEN]
GO
ALTER TABLE [dbo].[TBMON_PROFILE_PARAM] ADD  CONSTRAINT [DF_TBMON_PROFILE_PARAM_DESCRIPTION]  DEFAULT ('') FOR [DESCRIPTION]
GO
ALTER TABLE [dbo].[TBMON_PROFILE_PARAM] ADD  CONSTRAINT [DF__TBMON_PRO__P_TYP__569ECEE8]  DEFAULT ('VARCHAR') FOR [DATA_TYPE]
GO
ALTER TABLE [dbo].[TBMON_PROFILE_PARAM] ADD  CONSTRAINT [DF_TBMON_PROFILE_PARAM_PATTERN]  DEFAULT ('') FOR [PATTERN]
GO
ALTER TABLE [dbo].[TBMON_PROFILE_PARAM] ADD  CONSTRAINT [DF__TBMON_PRO__SEQUE__5792F321]  DEFAULT ((0)) FOR [SEQUENCE]
GO
ALTER TABLE [dbo].[TBMON_PROFILE_PARAM] ADD  CONSTRAINT [DF__TBMON_PRO__OPTIO__5887175A]  DEFAULT ((0)) FOR [REQUIRED]
GO
ALTER TABLE [dbo].[TBMON_PROFILE_PARAM] ADD  CONSTRAINT [DF__TBMON_PRO__ACTIV__597B3B93]  DEFAULT ((1)) FOR [ACTIVE]
GO
ALTER TABLE [dbo].[TBMON_PROFILE_PARAM] ADD  CONSTRAINT [DF__TBMON_PRO__ADDED__5A6F5FCC]  DEFAULT ('DEFAULT') FOR [ADDED_WHO]
GO
ALTER TABLE [dbo].[TBMON_PROFILE_PARAM] ADD  CONSTRAINT [DF__TBMON_PRO__ADDED__5B638405]  DEFAULT (getdate()) FOR [ADDED_WHEN]
GO
ALTER TABLE [dbo].[TBMON_PROFILE_PARAM]  WITH CHECK ADD  CONSTRAINT [FK_TBMON_PROFILE_PARAM_OID] FOREIGN KEY([PROFILE_ID])
REFERENCES [dbo].[TBMON_PROFILE] ([GUID])
GO
ALTER TABLE [dbo].[TBMON_PROFILE_PARAM] CHECK CONSTRAINT [FK_TBMON_PROFILE_PARAM_OID]
GO
/****** Object:  Table [dbo].[TBMON_CHARTS]    Script Date: 11.04.2023 13:35:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TBMON_CHARTS](
	[GUID] [int] IDENTITY(1,1) NOT NULL,
	[PROFILE_ID] [int] NOT NULL,
	[POS_ID] [int] NOT NULL,
	[CHART_TYPE] [varchar](50) NOT NULL,
	[TITLE] [varchar](50) NOT NULL,
	[SQL_COMMAND] [varchar](max) NOT NULL,
	[ARGUMENT] [varchar](50) NOT NULL,
	[VALUE] [varchar](50) NOT NULL,
	[ACTIVE] [bit] NULL,
	[LABEL_TYPE] [varchar](50) NULL,
	[ADDED_WHO] [varchar](50) NULL,
	[ADDED_WHEN] [datetime] NULL,
	[CHANGED_WHO] [varchar](50) NULL,
	[CHANGED_WHEN] [datetime] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[TBMON_CHARTS] ADD  CONSTRAINT [DF_TBMON_CHARTS_PROFILE_ID]  DEFAULT ((0)) FOR [PROFILE_ID]
GO
ALTER TABLE [dbo].[TBMON_CHARTS] ADD  CONSTRAINT [DF_TBMON_CHARTS_GROUP_ID]  DEFAULT ((0)) FOR [POS_ID]
GO
ALTER TABLE [dbo].[TBMON_CHARTS] ADD  CONSTRAINT [DF_TBMON_CHARTS_ACTIVE]  DEFAULT ((1)) FOR [ACTIVE]
GO
ALTER TABLE [dbo].[TBMON_CHARTS] ADD  CONSTRAINT [DF_TBMON_CHARTS_LABEL_TYPE]  DEFAULT ('DEFAULT') FOR [LABEL_TYPE]
GO
