diff --git a/libnymea-zigbee/zigbeenetworkdatabase.cpp b/libnymea-zigbee/zigbeenetworkdatabase.cpp index 6e5861a..a065cb1 100644 --- a/libnymea-zigbee/zigbeenetworkdatabase.cpp +++ b/libnymea-zigbee/zigbeenetworkdatabase.cpp @@ -239,7 +239,6 @@ bool ZigbeeNetworkDatabase::initDatabase() "powerDescriptor INTEGER NOT NULL, " // uint16 "lqi INTEGER NOT NULL," // uint8 "timestamp INTEGER NOT NULL)"); // unix timestamp with the last communication - createIndices("ieeeAddressIndex", "nodes", "ieeeAddress"); } // Create endpoints table @@ -252,7 +251,6 @@ bool ZigbeeNetworkDatabase::initDatabase() "deviceId INTEGER NOT NULL, " // uint16 "deviceVersion INTEGER, " // uint8 "CONSTRAINT fk_ieeeAddress FOREIGN KEY(ieeeAddress) REFERENCES nodes(ieeeAddress) ON DELETE CASCADE)"); - createIndices("endpointIndex", "endpoints", "ieeeAddress, endpointId"); } // Create server cluster table @@ -262,7 +260,6 @@ bool ZigbeeNetworkDatabase::initDatabase() "endpointId INTEGER NOT NULL, " // reference to endpoint.id "clusterId INTEGER NOT NULL, " // uint16 "CONSTRAINT fk_endpoint FOREIGN KEY(endpointId) REFERENCES endpoints(id) ON DELETE CASCADE)"); - createIndices("serverClusterIndex", "serverClusters", "endpointId, clusterId"); } // Create client cluster table @@ -272,7 +269,6 @@ bool ZigbeeNetworkDatabase::initDatabase() "endpointId INTEGER NOT NULL, " // reference to endpoint.id "clusterId INTEGER NOT NULL, " // uint16 "CONSTRAINT fk_endpoint FOREIGN KEY(endpointId) REFERENCES endpoints(id) ON DELETE CASCADE)"); - createIndices("clientClusterIndex", "clientClusters", "endpointId, clusterId"); } // Create cluster attributes table @@ -284,7 +280,6 @@ bool ZigbeeNetworkDatabase::initDatabase() "dataType INTEGER NOT NULL, " // uint8 "data BLOB NOT NULL, " // raw data from attribute "CONSTRAINT fk_cluster FOREIGN KEY(clusterId) REFERENCES serverClusters(id) ON DELETE CASCADE)"); - createIndices("attributesIndex", "attributes", "clusterId, attributeId"); } return true; @@ -301,12 +296,6 @@ void ZigbeeNetworkDatabase::createTable(const QString &tableName, const QString } } -void ZigbeeNetworkDatabase::createIndices(const QString &indexName, const QString &tableName, const QString &columns) -{ - qCDebug(dcZigbeeNetworkDatabase()) << "Creating table indices" << indexName << tableName << columns; - m_db.exec(QString("CREATE UNIQUE INDEX IF NOT EXISTS %1 ON %2(%3);").arg(indexName).arg(tableName).arg(columns)); -} - bool ZigbeeNetworkDatabase::saveNodeEndpoint(ZigbeeNodeEndpoint *endpoint) { qCDebug(dcZigbeeNetworkDatabase()) << "Save" << endpoint; diff --git a/libnymea-zigbee/zigbeenetworkdatabase.h b/libnymea-zigbee/zigbeenetworkdatabase.h index 2874708..cb94521 100644 --- a/libnymea-zigbee/zigbeenetworkdatabase.h +++ b/libnymea-zigbee/zigbeenetworkdatabase.h @@ -62,7 +62,6 @@ private: bool initDatabase(); void createTable(const QString &tableName, const QString &schema); - void createIndices(const QString &indexName, const QString &tableName, const QString &columns); public slots: bool saveNodeEndpoint(ZigbeeNodeEndpoint *endpoint);