CREATE TABLE `FlowSources` (
  `FlowSrc` int(11) unsigned NOT NULL,
  `ExportType` varchar(12) NOT NULL default 'NetFlow9',
  `Hostname` varchar(255) default NULL,
  `FlowSrcDesc` varchar(255) default NULL,
  PRIMARY KEY  (`FlowSrc`)
) ENGINE=InnoDB;

CREATE TABLE `Interfaces` (
  `FlowSrc` int(11) unsigned NOT NULL,
  `IntfDesc` varchar(120) default NULL,
  `IntfIndex` int(11) unsigned NOT NULL,
  KEY `FlowSrc` (`FlowSrc`),
  KEY `DevIntfIndex` (`FlowSrc`,`IntfIndex`),
  CONSTRAINT `FlowSrc` FOREIGN KEY (`FlowSrc`) REFERENCES `FlowSources` (`FlowSrc`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB;

CREATE TABLE `Flows` (
  `FlowSrc` int(11) unsigned NOT NULL,
  `IPProto` int(11) unsigned NOT NULL default '0',
  `IPSrc` int(11) unsigned NOT NULL default '0',
  `IPDst` int(11) unsigned NOT NULL default '0',
  `IntIn` int(11) unsigned default '0',
  `IntOut` int(11) unsigned default '0',
  `PortSrc` smallint(11) unsigned default '0',
  `PortDst` smallint(11) unsigned default '0',
  `MaskSrc` int(11) unsigned default '0',
  `MaskDst` int(11) unsigned default '0',
  `TimeStart` int(11) unsigned NOT NULL default '0',
  `TimeStop` int(11) unsigned NOT NULL default '0',
  `Direction` smallint(11) unsigned NULL default NULL,
  `Bytes` int(11) unsigned NOT NULL default '0',
  `Pakets` int(11) unsigned NOT NULL default '0',
  KEY `FlowSrc` (`FlowSrc`),
  KEY `IntfInIndex` (`IntIn`,`FlowSrc`),
  KEY `IntfOutIndex` (`FlowSrc`,`IntOut`),
  KEY `TimeStartIndex` (`TimeStart`),
  KEY `TimeStopIndex` (`TimeStop`),
  KEY `IPProto` (`IPProto`),
  KEY `IPSrc` (`IPSrc`),
  KEY `IPDst` (`IPDst`),
  CONSTRAINT `f_FlowSrc` FOREIGN KEY (`FlowSrc`) REFERENCES `FlowSources` (`FlowSrc`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB;
