GO
/****** Object:  Table [dbo].[mcub_templates]    Script Date: 02/21/2011 16:33:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mcub_templates]'))
drop table [dbo].[mcub_templates]
GO
CREATE TABLE [dbo].[mcub_templates](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[name] [varchar](1000) NOT NULL,
 CONSTRAINT [PK_mcub_templates] PRIMARY KEY CLUSTERED 
(
	[id] ASC
) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

GO
/****** Object:  Table [dbo].[mcub_menu]    Script Date: 02/21/2011 16:31:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mcub_menu]'))
drop table [dbo].[mcub_menu]
GO
CREATE TABLE [dbo].[mcub_menu](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[title] [varchar](1000) NOT NULL,
	[orders] [int] NOT NULL,
	[is_folder] [bit] NOT NULL,
	[parent] [int] NOT NULL,
	[img] [varchar](128) NULL,
	[template_id] [int] NULL,
 CONSTRAINT [PK_mcub_menu] PRIMARY KEY CLUSTERED 
(
	[id] ASC
) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[mcub_menu]  WITH CHECK ADD  CONSTRAINT [FK_mcub_menu_mcub_templates] FOREIGN KEY([template_id])
REFERENCES [dbo].[mcub_templates] ([id])
GO
ALTER TABLE [dbo].[mcub_menu] CHECK CONSTRAINT [FK_mcub_menu_mcub_templates]

/****** Object:  Table [dbo].[mcub_container]    Script Date: 02/21/2011 16:31:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mcub_container]'))
drop table [dbo].[mcub_container]
GO
CREATE TABLE [dbo].[mcub_container](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[template_id] [int] NOT NULL,
	[orders] [int] NOT NULL,
	[width] [int] NOT NULL,
 CONSTRAINT [PK_mcub_container] PRIMARY KEY CLUSTERED 
(
	[id] ASC
) ON [PRIMARY]
) ON [PRIMARY]

GO
ALTER TABLE [dbo].[mcub_container]  WITH CHECK ADD  CONSTRAINT [FK_mcub_container_mcub_templates] FOREIGN KEY([template_id])
REFERENCES [dbo].[mcub_templates] ([id])
GO
ALTER TABLE [dbo].[mcub_container] CHECK CONSTRAINT [FK_mcub_container_mcub_templates]

/****** Object:  Table [dbo].[mcub_favorites]    Script Date: 02/21/2011 16:31:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mcub_favorites]'))
drop table [dbo].[mcub_favorites]
GO
CREATE TABLE [dbo].[mcub_favorites](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[user_id] [int] NOT NULL,
	[menu_id] [int] NOT NULL,
	[orders] [int] NOT NULL,
 CONSTRAINT [PK_mcub_favorites] PRIMARY KEY CLUSTERED 
(
	[id] ASC
) ON [PRIMARY],
 CONSTRAINT [IX_UNIQUE_Table_user_id_menu_id] UNIQUE NONCLUSTERED 
(
	[user_id] ASC,
	[menu_id] ASC
) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[mcub_modules]    Script Date: 02/21/2011 16:32:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mcub_modules]'))
drop table [dbo].[mcub_modules]
GO
CREATE TABLE [dbo].[mcub_modules](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[menu_id] [int] NOT NULL,
	[container_id] [int] NOT NULL,
	[title] [varchar](1000) NULL,
	[orders] [int] NOT NULL,
	[height] [int] NOT NULL,
 CONSTRAINT [PK_mcub_modules] PRIMARY KEY CLUSTERED 
(
	[id] ASC
) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[mcub_modules]  WITH CHECK ADD  CONSTRAINT [FK_mcub_modules_mcub_container] FOREIGN KEY([container_id])
REFERENCES [dbo].[mcub_container] ([id])
GO
ALTER TABLE [dbo].[mcub_modules] CHECK CONSTRAINT [FK_mcub_modules_mcub_container]
GO
ALTER TABLE [dbo].[mcub_modules]  WITH CHECK ADD  CONSTRAINT [FK_mcub_modules_mcub_menu] FOREIGN KEY([menu_id])
REFERENCES [dbo].[mcub_menu] ([id])
GO
ALTER TABLE [dbo].[mcub_modules] CHECK CONSTRAINT [FK_mcub_modules_mcub_menu]


GO
/****** Object:  Table [dbo].[mcub_module_elements]    Script Date: 02/21/2011 16:32:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mcub_module_elements]'))
drop table [dbo].[mcub_module_elements]
GO
CREATE TABLE [dbo].[mcub_module_elements](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[module_id] [int] NOT NULL,
	[orders] [int] NOT NULL,
	[server] [varchar](128) NULL,
	[db] [varchar](128) NULL,
	[value] [text] NULL,
	[type] [int] NOT NULL,
	[height] [int] NOT NULL,
	[width] [int] NOT NULL,
	[title] [varchar](256) NULL,
 CONSTRAINT [PK_mcub_block_elements] PRIMARY KEY CLUSTERED 
(
	[id] ASC
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[mcub_module_elements]  WITH CHECK ADD  CONSTRAINT [FK_mcub_module_elements_mcub_modules] FOREIGN KEY([module_id])
REFERENCES [dbo].[mcub_modules] ([id])
GO
ALTER TABLE [dbo].[mcub_module_elements] CHECK CONSTRAINT [FK_mcub_module_elements_mcub_modules]

GO
/****** Object:  Table [dbo].[mcub_twitter_messages]    Script Date: 02/21/2011 16:33:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mcub_twitter_messages]'))
drop table [dbo].[mcub_twitter_messages]
GO
CREATE TABLE [dbo].[mcub_twitter_messages](
	[id] [bigint] NOT NULL,
	[from_id] [bigint] NOT NULL,
	[to_id] [bigint] NOT NULL,
	[date] [datetime] NOT NULL,
	[text] [varchar](2000) NOT NULL,
 CONSTRAINT [PK_mcub_twitter_messages] PRIMARY KEY CLUSTERED 
(
	[id] ASC
) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

GO
/****** Object:  Table [dbo].[mcub_twitter_statuses]    Script Date: 02/21/2011 16:33:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mcub_twitter_statuses]'))
drop table [dbo].[mcub_twitter_statuses]
GO
CREATE TABLE [dbo].[mcub_twitter_statuses](
	[Id] [bigint] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[InReplyToStatusId] [bigint] NULL,
	[Text] [varchar](500) NOT NULL,
	[UserId] [bigint] NOT NULL,
	[UserName] [varchar](500) NOT NULL,
	[UserScreenName] [varchar](500) NOT NULL,
	[IsFavorited] [bit] NOT NULL,
	[TopStatusId] [bigint] NULL,
	[ProfileImageUrl] [varchar](500) NOT NULL,
	[IsRead] [bit] NOT NULL,
 CONSTRAINT [PK_mcub_twitter_statuses2] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF


GO
/****** Object:  Table [dbo].[mcub_user_params]    Script Date: 02/21/2011 16:34:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mcub_user_params]'))
drop table [dbo].[mcub_user_params]
GO
CREATE TABLE [dbo].[mcub_user_params](
	[user_id] [int] NOT NULL,
	[key] [varchar](100) NOT NULL,
	[value] [varchar](8000) NULL,
 CONSTRAINT [PK_mcub_user_params] PRIMARY KEY CLUSTERED 
(
	[user_id] ASC,
	[key] ASC
) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF


GO
/****** Object:  Table [dbo].[mcubDocFields]    Script Date: 02/21/2011 16:34:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING OFF
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mcubDocFields]'))
drop table [dbo].[mcubDocFields]
GO
CREATE TABLE [dbo].[mcubDocFields](
	[Link] [int] IDENTITY(1,1) NOT NULL,
	[DocCode] [varchar](100) NOT NULL,
	[Field] [varchar](100) NOT NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

GO
/****** Object:  Table [dbo].[McubReportCashe]    Script Date: 02/21/2011 16:34:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[McubReportCashe]'))
drop table [dbo].[McubReportCashe]
GO
CREATE TABLE [dbo].[McubReportCashe](
	[link] [int] IDENTITY(1,1) NOT NULL,
	[LinkRep] [int] NOT NULL,
	[Server] [varchar](100) NOT NULL,
	[Base] [varchar](100) NOT NULL,
	[Date] [varchar](10) NOT NULL,
	[Path] [varchar](500) NOT NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF


/****** Object:  Table [dbo].[mcub_parameters]    Script Date: 02/14/2011 10:34:06 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mcub_parameters]'))
drop table [dbo].[mcub_parameters]
GO
CREATE TABLE [dbo].[mcub_parameters](
	[key] [varchar](100) NOT NULL,
	[value] [varchar](8000) NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

