UPDATE [dbo].[Options] SET [OptionValue] = '4.0.0' WHERE [OptionID] = 14

INSERT INTO SharePointObjectTypes (ID, Name) VALUES (5, 'Web Application')
INSERT INTO SharePointObjectTypes (ID, Name) VALUES (6, 'Folder')

UPDATE FeatureScopes SET Name='Site Collection' WHERE ID=2
UPDATE FeatureScopes SET Name='Subsite' WHERE ID=3

/****** Object:  Table [dbo].[MonitoringServers]    Script Date: 8.1.2014. 11:51:05 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[MonitoringServers](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
 CONSTRAINT [PK_MonitoringServers] 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]
GO

/****** Object:  Table [dbo].[MonitoringUlsEvents]    Script Date: 8.1.2014. 11:57:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringUlsEvents](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[TimeGenerated] [datetime] NOT NULL,
	[MonitoringServerID] [int] NOT NULL,
	[Process] [nvarchar](100) NOT NULL,
	[Thread] [nvarchar](20) NOT NULL,
	[Product] [nvarchar](100) NOT NULL,
	[Category] [nvarchar](50) NOT NULL,
	[EventID] [nvarchar](15) NOT NULL,
	[Level] [int] NOT NULL,
	[Message] [nvarchar](2048) NULL,
	[Correlation] [nvarchar](50) NULL,
 CONSTRAINT [PK_MonitoringUlsEvents] 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]
GO
ALTER TABLE [dbo].[MonitoringUlsEvents]  WITH CHECK ADD  CONSTRAINT [FK_MonitoringUlsEvents_MonitoringServers] FOREIGN KEY([MonitoringServerID])
REFERENCES [dbo].[MonitoringServers] ([ID])
GO
ALTER TABLE [dbo].[MonitoringUlsEvents] CHECK CONSTRAINT [FK_MonitoringUlsEvents_MonitoringServers]
GO

/****** Object:  Table [dbo].[MonitoringEventLogs]    Script Date: 8.1.2014. 11:51:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringEventLogs](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[MonitoringServerID] [int] NOT NULL,
	[InstanceId] [bigint] NOT NULL,
	[Source] [nvarchar](255) NOT NULL,
	[Message] [nvarchar](2048) NULL,
	[TimeGenerated] [datetime] NOT NULL,
	[Type] [nvarchar](50) NOT NULL,
	[Level] [int] NOT NULL,
	[Category] [nvarchar](100) NOT NULL,
	[User] [nvarchar](255) NULL,
	[Keywords] [nvarchar](100) NOT NULL,
 CONSTRAINT [PK_MonitoringEventLogs] 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]

GO

ALTER TABLE [dbo].[MonitoringEventLogs]  WITH CHECK ADD  CONSTRAINT [FK_MonitoringEventLogs_MonitoringServers] FOREIGN KEY([MonitoringServerID])
REFERENCES [dbo].[MonitoringServers] ([ID])
GO

ALTER TABLE [dbo].[MonitoringEventLogs] CHECK CONSTRAINT [FK_MonitoringEventLogs_MonitoringServers]
GO

GO
CREATE NONCLUSTERED INDEX NonClusteredIndex_LoadingInfoID_ScopeAssignments ON [dbo].[ScopeAssignments] ([LoadingInfoID]) INCLUDE ([ScopeID],[SPObjectID])

GO
CREATE NONCLUSTERED INDEX NonClusteredIndex_LoadingInfoID_SharePointObjectMemberships ON [dbo].[SharePointObjectMemberships] ([LoadingInfoID]) INCLUDE ([ParentID],[ChildID])

GO
CREATE NONCLUSTERED INDEX NonClusteredIndex_LoadingInfoID_PrincipalMemberships ON [dbo].[PrincipalMemberships] ([LoadingInfoID]) INCLUDE ([GroupID],[UserID])