X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fglobal.cpp;h=cfd458c624eb42d6f553ed4b0a261a04b4ea96aa;hb=0236076defe60bcd4b3a25c23efa53c21993a48e;hp=c9bdefed604f7ca27f6d6dacdb7b358c441370ba;hpb=1230cc420c955e75051d011d964bc68f061ba08c;p=fms.git diff --git a/src/global.cpp b/src/global.cpp index c9bdefe..cfd458c 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -415,6 +415,11 @@ void SetupDB() AND ( PeerTrustListTrust IS NULL OR PeerTrustListTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerTrustListTrust') ) \ GROUP BY TargetIdentityID;"); + db->Execute("CREATE VIEW IF NOT EXISTS vwIdentityStats AS \ + SELECT tblIdentity.IdentityID, COUNT(tblMessage.MessageID) AS MessageCount, MIN(tblMessage.MessageDate) AS FirstMessageDate, MAX(tblMessage.MessageDate) AS LastMessageDate \ + FROM tblIdentity LEFT JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID \ + GROUP BY tblIdentity.IdentityID;"); + /* These peer trust calculations are too CPU intensive to be triggers - they were called every time a new trust list was processed All trust levels will now be recalculated every hour in the PeriodicDBMaintenance class