ophanimflow.sql 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. create database ophanimflow;
  2. use ophanimflow;
  3. drop table if exists raw_in;
  4. drop table if exists raw_out;
  5. drop table if exists host_in;
  6. drop table if exists host_out;
  7. drop table if exists traffstat;
  8. drop table if exists networks;
  9. create table raw_out (
  10. ip_dst CHAR(45) NOT NULL,
  11. port_src INT(2) UNSIGNED NOT NULL,
  12. ip_proto CHAR(8) NOT NULL,
  13. packets INT UNSIGNED NOT NULL,
  14. bytes BIGINT UNSIGNED NOT NULL,
  15. stamp_inserted INT(11) NOT NULL,
  16. stamp_updated INT(11) NOT NULL,
  17. PRIMARY KEY (ip_dst, port_src, ip_proto, stamp_inserted)
  18. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  19. create table raw_in (
  20. ip_src CHAR(45) NOT NULL,
  21. port_dst INT(2) UNSIGNED NOT NULL,
  22. ip_proto CHAR(8) NOT NULL,
  23. packets INT UNSIGNED NOT NULL,
  24. bytes BIGINT UNSIGNED NOT NULL,
  25. stamp_inserted INT(11) NOT NULL,
  26. stamp_updated INT(11) NOT NULL,
  27. PRIMARY KEY (ip_src, port_dst, ip_proto, stamp_inserted)
  28. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  29. create table host_out (
  30. ip_dst CHAR(45) NOT NULL,
  31. packets INT UNSIGNED NOT NULL,
  32. bytes BIGINT UNSIGNED NOT NULL,
  33. stamp_inserted INT(11) NOT NULL,
  34. stamp_updated INT(11) NOT NULL,
  35. PRIMARY KEY (ip_dst, stamp_inserted)
  36. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  37. create table host_in (
  38. ip_src CHAR(45) NOT NULL,
  39. packets INT UNSIGNED NOT NULL,
  40. bytes BIGINT UNSIGNED NOT NULL,
  41. stamp_inserted INT(11) NOT NULL,
  42. stamp_updated INT(11) NOT NULL,
  43. PRIMARY KEY (ip_src, stamp_inserted)
  44. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  45. CREATE TABLE `traffstat` (
  46. `id` int NOT NULL AUTO_INCREMENT,
  47. `ip` varchar(16) NOT NULL,
  48. `month` tinyint NOT NULL,
  49. `year` smallint NOT NULL,
  50. `dl` bigint NOT NULL DEFAULT '0',
  51. `ul` bigint NOT NULL DEFAULT '0',
  52. PRIMARY KEY (`id`),
  53. KEY `ip` (`ip`),
  54. KEY `month` (`month`),
  55. KEY `year` (`year`)
  56. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  57. CREATE TABLE `networks` (
  58. `id` int NOT NULL AUTO_INCREMENT,
  59. `network` varchar(20) NOT NULL,
  60. PRIMARY KEY (`id`)
  61. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  62. -- 0.0.2 patch
  63. ALTER TABLE `networks` ADD `descr` VARCHAR(255) NULL AFTER `network`;