-- MySQL dump 10.11
--
-- Host: localhost    Database: Portal
-- ------------------------------------------------------
-- Server version	5.0.45-Debian_1-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `AnnouncementPictures`
--

DROP TABLE IF EXISTS `AnnouncementPictures`;
CREATE TABLE `AnnouncementPictures` (
  `AnnouncementId` int(10) NOT NULL,
  `Url` varchar(250) NOT NULL,
  `Subtitle` varchar(50) default NULL,
  KEY `AnnouncementId` (`AnnouncementId`),
  CONSTRAINT `AnnouncementPictures_ibfk_1` FOREIGN KEY (`AnnouncementId`) REFERENCES `Announcements` (`AnnouncementId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;

--
-- Dumping data for table `AnnouncementPictures`
--

LOCK TABLES `AnnouncementPictures` WRITE;
/*!40000 ALTER TABLE `AnnouncementPictures` DISABLE KEYS */;
/*!40000 ALTER TABLE `AnnouncementPictures` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Announcements`
--

DROP TABLE IF EXISTS `Announcements`;
CREATE TABLE `Announcements` (
  `AnnouncementId` int(10) NOT NULL auto_increment,
  `Url` varchar(250) NOT NULL,
  `PublishDate` datetime NOT NULL,
  `ExpireDate` datetime default NULL,
  `AutorName` varchar(50) NOT NULL,
  `AutorUrl` varchar(250) default NULL,
  `Title` varchar(50) NOT NULL,
  `Text` text,
  `PortalId` int(10) NOT NULL,
  PRIMARY KEY  (`AnnouncementId`),
  KEY `PortalId` (`PortalId`),
  CONSTRAINT `Announcements_ibfk_1` FOREIGN KEY (`PortalId`) REFERENCES `Portals` (`PortalId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;

--
-- Dumping data for table `Announcements`
--

LOCK TABLES `Announcements` WRITE;
/*!40000 ALTER TABLE `Announcements` DISABLE KEYS */;
/*!40000 ALTER TABLE `Announcements` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Categories`
--

DROP TABLE IF EXISTS `Categories`;
CREATE TABLE `Categories` (
  `CategoryId` int(10) NOT NULL auto_increment,
  `PortalId` int(10) default NULL,
  `Url` varchar(255) NOT NULL,
  `Name` varchar(255) default NULL,
  PRIMARY KEY  (`CategoryId`),
  KEY `PortalId` (`PortalId`),
  CONSTRAINT `Categories_ibfk_1` FOREIGN KEY (`PortalId`) REFERENCES `Portals` (`PortalId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;

--
-- Dumping data for table `Categories`
--

LOCK TABLES `Categories` WRITE;
/*!40000 ALTER TABLE `Categories` DISABLE KEYS */;
/*!40000 ALTER TABLE `Categories` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `ExchangeRates`
--

DROP TABLE IF EXISTS `ExchangeRates`;
CREATE TABLE `ExchangeRates` (
  `RateId` int(10) NOT NULL auto_increment,
  `SourceId` int(10) NOT NULL,
  `FromCurrency` char(3) NOT NULL,
  `ToCurrency` char(3) NOT NULL,
  `Sells` decimal(10,0) NOT NULL,
  `Buys` decimal(10,0) NOT NULL,
  PRIMARY KEY  (`RateId`),
  KEY `SourceId` (`SourceId`),
  CONSTRAINT `Rates_ibfk_1` FOREIGN KEY (`SourceId`) REFERENCES `ExchangeSources` (`SourceId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;

--
-- Dumping data for table `ExchangeRates`
--

LOCK TABLES `ExchangeRates` WRITE;
/*!40000 ALTER TABLE `ExchangeRates` DISABLE KEYS */;
/*!40000 ALTER TABLE `ExchangeRates` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `ExchangeSources`
--

DROP TABLE IF EXISTS `ExchangeSources`;
CREATE TABLE `ExchangeSources` (
  `SourceId` int(10) NOT NULL auto_increment,
  `PortalId` int(10) NOT NULL,
  `Name` varchar(50) NOT NULL,
  `Url` varchar(255) default NULL,
  `LastUpdate` datetime NOT NULL,
  PRIMARY KEY  (`SourceId`),
  KEY `PortalId` (`PortalId`),
  CONSTRAINT `RateSources_ibfk_1` FOREIGN KEY (`PortalId`) REFERENCES `Portals` (`PortalId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;

--
-- Dumping data for table `ExchangeSources`
--

LOCK TABLES `ExchangeSources` WRITE;
/*!40000 ALTER TABLE `ExchangeSources` DISABLE KEYS */;
/*!40000 ALTER TABLE `ExchangeSources` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `News`
--

DROP TABLE IF EXISTS `News`;
CREATE TABLE `News` (
  `NewsId` int(10) NOT NULL auto_increment,
  `Url` varchar(255) NOT NULL,
  `PublishDate` datetime NOT NULL,
  `AuthorName` varchar(50) default NULL,
  `AuthorUrl` varchar(50) default NULL,
  `Title` varchar(50) NOT NULL,
  `Intro` varchar(255) default NULL,
  `Content` text NOT NULL,
  `PictureUrl` varchar(255) default NULL,
  `PictureSubtitle` varchar(50) default NULL,
  `PortalId` int(10) default NULL,
  PRIMARY KEY  (`NewsId`),
  KEY `PortalId` (`PortalId`),
  CONSTRAINT `News_ibfk_1` FOREIGN KEY (`PortalId`) REFERENCES `Portals` (`PortalId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;

--
-- Dumping data for table `News`
--

LOCK TABLES `News` WRITE;
/*!40000 ALTER TABLE `News` DISABLE KEYS */;
/*!40000 ALTER TABLE `News` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `NewsCategory`
--

DROP TABLE IF EXISTS `NewsCategory`;
CREATE TABLE `NewsCategory` (
  `NewsId` int(10) NOT NULL,
  `CategoryId` int(10) NOT NULL,
  KEY `CategoryId` (`CategoryId`),
  KEY `NewsId` (`NewsId`),
  CONSTRAINT `NewsCategory_ibfk_2` FOREIGN KEY (`NewsId`) REFERENCES `News` (`NewsId`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `NewsCategory_ibfk_1` FOREIGN KEY (`CategoryId`) REFERENCES `Categories` (`CategoryId`)
) ENGINE=InnoDB;

--
-- Dumping data for table `NewsCategory`
--

LOCK TABLES `NewsCategory` WRITE;
/*!40000 ALTER TABLE `NewsCategory` DISABLE KEYS */;
/*!40000 ALTER TABLE `NewsCategory` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `NewsComments`
--

DROP TABLE IF EXISTS `NewsComments`;
CREATE TABLE `NewsComments` (
  `CommentId` int(10) NOT NULL auto_increment,
  `PublishDate` datetime NOT NULL,
  `AuthorName` varchar(50) NOT NULL,
  `AuthorUrl` varchar(50) default NULL,
  `Title` varchar(50) NOT NULL,
  `Content` text NOT NULL,
  `NewsId` int(10) default NULL,
  PRIMARY KEY  (`CommentId`),
  KEY `NewsId` (`NewsId`),
  CONSTRAINT `NewsComments_ibfk_1` FOREIGN KEY (`NewsId`) REFERENCES `News` (`NewsId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;

--
-- Dumping data for table `NewsComments`
--

LOCK TABLES `NewsComments` WRITE;
/*!40000 ALTER TABLE `NewsComments` DISABLE KEYS */;
/*!40000 ALTER TABLE `NewsComments` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Portals`
--

DROP TABLE IF EXISTS `Portals`;
CREATE TABLE `Portals` (
  `PortalId` int(10) NOT NULL auto_increment,
  `XmlUrl` varchar(255) NOT NULL,
  `Name` varchar(255) NOT NULL,
  `Description` text,
  `Url` varchar(255) NOT NULL,
  `LastUpdate` datetime default NULL,
  PRIMARY KEY  (`PortalId`)
) ENGINE=InnoDB;

--
-- Dumping data for table `Portals`
--

LOCK TABLES `Portals` WRITE;
/*!40000 ALTER TABLE `Portals` DISABLE KEYS */;
/*!40000 ALTER TABLE `Portals` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `WeatherForecasts`
--

DROP TABLE IF EXISTS `WeatherForecasts`;
CREATE TABLE `WeatherForecasts` (
  `ForecastId` int(10) NOT NULL auto_increment,
  `SourceId` int(10) NOT NULL,
  `Location` varchar(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` text,
  PRIMARY KEY  (`ForecastId`),
  KEY `SourceId` (`SourceId`),
  CONSTRAINT `WeatherForecasts_ibfk_1` FOREIGN KEY (`SourceId`) REFERENCES `WeatherSources` (`SourceId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;

--
-- Dumping data for table `WeatherForecasts`
--

LOCK TABLES `WeatherForecasts` WRITE;
/*!40000 ALTER TABLE `WeatherForecasts` DISABLE KEYS */;
/*!40000 ALTER TABLE `WeatherForecasts` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `WeatherSources`
--

DROP TABLE IF EXISTS `WeatherSources`;
CREATE TABLE `WeatherSources` (
  `SourceId` int(10) NOT NULL auto_increment,
  `PortalId` int(10) NOT NULL,
  `Name` varchar(5) NOT NULL,
  `Url` varchar(255) default NULL,
  `LastUpdate` datetime NOT NULL,
  PRIMARY KEY  (`SourceId`),
  KEY `PortalId` (`PortalId`),
  CONSTRAINT `WeatherSources_ibfk_1` FOREIGN KEY (`PortalId`) REFERENCES `Portals` (`PortalId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;

--
-- Dumping data for table `WeatherSources`
--

LOCK TABLES `WeatherSources` WRITE;
/*!40000 ALTER TABLE `WeatherSources` DISABLE KEYS */;
/*!40000 ALTER TABLE `WeatherSources` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2007-08-17 12:24:40
