Browse Source

Fixed non-unique primary key in ip_ports table

Stefan Schmidt 6 years ago
parent
commit
23ccc7d823
2 changed files with 2 additions and 2 deletions
  1. 1 1
      code_boost/src/cxx/statistics_db.cpp
  2. 1 1
      code_boost/src/cxx/statistics_db.h

+ 1 - 1
code_boost/src/cxx/statistics_db.cpp

@@ -264,7 +264,7 @@ void statistics_db::writeStatisticsPorts(const std::unordered_map<ipAddress_inOu
                 "byteCount REAL,"
                 "portProtocol TEXT COLLATE NOCASE,"
                 "portService TEXT COLLATE NOCASE,"
-                "PRIMARY KEY(ipAddress,portDirection,portNumber));";
+                "PRIMARY KEY(ipAddress,portDirection,portNumber,portProtocol));";
         db->exec(createTable);
         SQLite::Statement query(*db, "INSERT INTO ip_ports VALUES (?, ?, ?, ?, ?, ?, ?)");
         for (auto it = portsStatistics.begin(); it != portsStatistics.end(); ++it) {

+ 1 - 1
code_boost/src/cxx/statistics_db.h

@@ -22,7 +22,7 @@ public:
     /*
      * Database version: Increment number on every change in the C++ code!
      */
-    static const int DB_VERSION = 6;
+    static const int DB_VERSION = 7;
 
     /*
      * Methods for writing values into database