/****** Object:  Table [dbo].[Portals]    Script Date: 08/17/2007 15:24:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Portals](
	[PortalId] [int] IDENTITY(1,1) NOT NULL,
	[XmlUrl] [nvarchar](255) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Description] [ntext] NULL,
	[Url] [nvarchar](255) NOT NULL,
	[LastUpdate] [datetime] NULL,
 CONSTRAINT [PK_Portals] PRIMARY KEY CLUSTERED 
(
	[PortalId] 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].[News]    Script Date: 08/17/2007 15:24:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[News](
	[NewsId] [int] IDENTITY(1,1) NOT NULL,
	[Url] [nvarchar](255) NOT NULL,
	[PublishDate] [datetime] NOT NULL,
	[AuthorName] [nvarchar](50) NULL,
	[AuthorUrl] [nvarchar](50) NULL,
	[Title] [nvarchar](50) NOT NULL,
	[Intro] [nvarchar](255) NULL,
	[Content] [ntext] NOT NULL,
	[PictureUrl] [nvarchar](255) NULL,
	[PictureSubtitle] [nvarchar](50) NULL,
	[PortalId] [int] NULL,
 CONSTRAINT [PK_News] PRIMARY KEY CLUSTERED 
(
	[NewsId] 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].[Categories]    Script Date: 08/17/2007 15:23:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Categories](
	[CategoryId] [int] IDENTITY(1,1) NOT NULL,
	[PortalId] [int] NULL,
	[Url] [nvarchar](255) NOT NULL,
	[Name] [nvarchar](255) NULL,
 CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED 
(
	[CategoryId] 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].[Announcements]    Script Date: 08/17/2007 15:23:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Announcements](
	[AnnouncementId] [int] NOT NULL,
	[Url] [nvarchar](250) NOT NULL,
	[PublishDate] [datetime] NOT NULL,
	[ExpireDate] [datetime] NULL,
	[AutorName] [nvarchar](50) NOT NULL,
	[AutorUrl] [nvarchar](250) NULL,
	[Title] [nvarchar](50) NOT NULL,
	[Text] [ntext] NULL,
	[PortalId] [int] NOT NULL,
 CONSTRAINT [PK_Announcements] PRIMARY KEY CLUSTERED 
(
	[AnnouncementId] 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].[ExchangeSources]    Script Date: 08/17/2007 15:23:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ExchangeSources](
	[SourceId] [int] NOT NULL,
	[PortalId] [int] NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[Url] [nvarchar](255) NULL,
	[LastUpdate] [datetime] NOT NULL,
 CONSTRAINT [PK_RateSources] PRIMARY KEY CLUSTERED 
(
	[SourceId] 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].[WeatherSources]    Script Date: 08/17/2007 15:24:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WeatherSources](
	[SourceId] [int] IDENTITY(1,1) NOT NULL,
	[PortalId] [int] NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[Url] [nvarchar](50) NULL,
	[LastUpdate] [datetime] NOT NULL,
 CONSTRAINT [PK_WeatherSources] PRIMARY KEY CLUSTERED 
(
	[SourceId] 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].[NewsComments]    Script Date: 08/17/2007 15:24:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NewsComments](
	[CommentId] [int] IDENTITY(1,1) NOT NULL,
	[PublishDate] [datetime] NOT NULL,
	[AuthorName] [nvarchar](50) NOT NULL,
	[AuthorUrl] [nvarchar](50) NULL,
	[Title] [nvarchar](50) NOT NULL,
	[Content] [ntext] NOT NULL,
	[NewsId] [int] NULL,
 CONSTRAINT [PK_Comments] PRIMARY KEY CLUSTERED 
(
	[CommentId] 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].[NewsCategory]    Script Date: 08/17/2007 15:24:02 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NewsCategory](
	[NewsId] [int] NOT NULL,
	[CategoryId] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnnouncementPictures]    Script Date: 08/17/2007 15:23:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnnouncementPictures](
	[AnnouncementId] [int] NOT NULL,
	[Url] [nvarchar](250) NOT NULL,
	[Subtitle] [nvarchar](50) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ExchangeRates]    Script Date: 08/17/2007 15:23:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ExchangeRates](
	[RateId] [int] NOT NULL,
	[SourceId] [int] NOT NULL,
	[FromCurrency] [nchar](3) NOT NULL,
	[ToCurrency] [nchar](3) NOT NULL,
	[Sells] [decimal](18, 0) NOT NULL,
	[Buys] [decimal](18, 0) NOT NULL,
 CONSTRAINT [PK_CurrencyRates] PRIMARY KEY CLUSTERED 
(
	[RateId] 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].[WeatherForecasts]    Script Date: 08/17/2007 15:24:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WeatherForecasts](
	[ForecastId] [int] IDENTITY(1,1) NOT NULL,
	[SourceId] [int] NOT NULL,
	[Location] [nvarchar](50) NOT NULL,
	[fromDate] [datetime] NOT NULL,
	[toDate] [datetime] NOT NULL,
	[minTempCelsius] [decimal](5, 2) NOT NULL,
	[maxTempCelsius] [decimal](5, 2) NOT NULL,
	[humidity] [decimal](5, 2) NOT NULL,
	[pressure] [decimal](5, 2) NOT NULL,
	[description] [ntext] NULL,
 CONSTRAINT [PK_WeatherForecasts] PRIMARY KEY CLUSTERED 
(
	[ForecastId] 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:  ForeignKey [FK_Pictures_Announcements]    Script Date: 08/17/2007 15:23:47 ******/
ALTER TABLE [dbo].[AnnouncementPictures]  WITH CHECK ADD  CONSTRAINT [FK_Pictures_Announcements] FOREIGN KEY([AnnouncementId])
REFERENCES [dbo].[Announcements] ([AnnouncementId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AnnouncementPictures] CHECK CONSTRAINT [FK_Pictures_Announcements]
GO
/****** Object:  ForeignKey [FK_Announcements_Portals]    Script Date: 08/17/2007 15:23:50 ******/
ALTER TABLE [dbo].[Announcements]  WITH CHECK ADD  CONSTRAINT [FK_Announcements_Portals] FOREIGN KEY([PortalId])
REFERENCES [dbo].[Portals] ([PortalId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Announcements] CHECK CONSTRAINT [FK_Announcements_Portals]
GO
/****** Object:  ForeignKey [FK_Categories_Portals]    Script Date: 08/17/2007 15:23:52 ******/
ALTER TABLE [dbo].[Categories]  WITH CHECK ADD  CONSTRAINT [FK_Categories_Portals] FOREIGN KEY([PortalId])
REFERENCES [dbo].[Portals] ([PortalId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Categories] CHECK CONSTRAINT [FK_Categories_Portals]
GO
/****** Object:  ForeignKey [FK_Rates_RateSources]    Script Date: 08/17/2007 15:23:55 ******/
ALTER TABLE [dbo].[ExchangeRates]  WITH CHECK ADD  CONSTRAINT [FK_Rates_RateSources] FOREIGN KEY([SourceId])
REFERENCES [dbo].[ExchangeSources] ([SourceId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ExchangeRates] CHECK CONSTRAINT [FK_Rates_RateSources]
GO
/****** Object:  ForeignKey [FK_RateSources_Portals]    Script Date: 08/17/2007 15:23:57 ******/
ALTER TABLE [dbo].[ExchangeSources]  WITH CHECK ADD  CONSTRAINT [FK_RateSources_Portals] FOREIGN KEY([PortalId])
REFERENCES [dbo].[Portals] ([PortalId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ExchangeSources] CHECK CONSTRAINT [FK_RateSources_Portals]
GO
/****** Object:  ForeignKey [FK_News_Portals]    Script Date: 08/17/2007 15:24:01 ******/
ALTER TABLE [dbo].[News]  WITH CHECK ADD  CONSTRAINT [FK_News_Portals] FOREIGN KEY([PortalId])
REFERENCES [dbo].[Portals] ([PortalId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[News] CHECK CONSTRAINT [FK_News_Portals]
GO
/****** Object:  ForeignKey [FK_NewsCategory_Categories]    Script Date: 08/17/2007 15:24:02 ******/
ALTER TABLE [dbo].[NewsCategory]  WITH CHECK ADD  CONSTRAINT [FK_NewsCategory_Categories] FOREIGN KEY([CategoryId])
REFERENCES [dbo].[Categories] ([CategoryId])
GO
ALTER TABLE [dbo].[NewsCategory] CHECK CONSTRAINT [FK_NewsCategory_Categories]
GO
/****** Object:  ForeignKey [FK_NewsCategory_News]    Script Date: 08/17/2007 15:24:02 ******/
ALTER TABLE [dbo].[NewsCategory]  WITH CHECK ADD  CONSTRAINT [FK_NewsCategory_News] FOREIGN KEY([NewsId])
REFERENCES [dbo].[News] ([NewsId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[NewsCategory] CHECK CONSTRAINT [FK_NewsCategory_News]
GO
/****** Object:  ForeignKey [FK_Comments_News]    Script Date: 08/17/2007 15:24:05 ******/
ALTER TABLE [dbo].[NewsComments]  WITH CHECK ADD  CONSTRAINT [FK_Comments_News] FOREIGN KEY([NewsId])
REFERENCES [dbo].[News] ([NewsId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[NewsComments] CHECK CONSTRAINT [FK_Comments_News]
GO
/****** Object:  ForeignKey [FK_WeatherForecasts_WeatherSources]    Script Date: 08/17/2007 15:24:11 ******/
ALTER TABLE [dbo].[WeatherForecasts]  WITH CHECK ADD  CONSTRAINT [FK_WeatherForecasts_WeatherSources] FOREIGN KEY([SourceId])
REFERENCES [dbo].[WeatherSources] ([SourceId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[WeatherForecasts] CHECK CONSTRAINT [FK_WeatherForecasts_WeatherSources]
GO
/****** Object:  ForeignKey [FK_WeatherSources_Portals]    Script Date: 08/17/2007 15:24:14 ******/
ALTER TABLE [dbo].[WeatherSources]  WITH CHECK ADD  CONSTRAINT [FK_WeatherSources_Portals] FOREIGN KEY([PortalId])
REFERENCES [dbo].[Portals] ([PortalId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[WeatherSources] CHECK CONSTRAINT [FK_WeatherSources_Portals]
GO
