summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2012-06-04 14:05:25 -0500
committerTim Laszlo <tim.laszlo@gmail.com>2012-06-04 14:25:58 -0500
commit6633ba7144dbc884732ee521d380456bbb2146f7 (patch)
treed61dba938d44a296406ed1f7b71d182b2e81e95f /src
parent48d77ab49b8c8e69c38b2b659ba4b31e781443c8 (diff)
downloadbcfg2-6633ba7144dbc884732ee521d380456bbb2146f7.tar.gz
bcfg2-6633ba7144dbc884732ee521d380456bbb2146f7.tar.bz2
bcfg2-6633ba7144dbc884732ee521d380456bbb2146f7.zip
DBStats: Remove custom sql
Remove the custom sql file. This failed to install in MySQL. Use django to index Interaction.timestamp instead of custom sql.
Diffstat (limited to 'src')
-rw-r--r--src/lib/Bcfg2/Server/Reports/reports/models.py4
-rw-r--r--src/lib/Bcfg2/Server/Reports/reports/sql/client.sql7
2 files changed, 2 insertions, 9 deletions
diff --git a/src/lib/Bcfg2/Server/Reports/reports/models.py b/src/lib/Bcfg2/Server/Reports/reports/models.py
index b58633c38..296c8c3a8 100644
--- a/src/lib/Bcfg2/Server/Reports/reports/models.py
+++ b/src/lib/Bcfg2/Server/Reports/reports/models.py
@@ -161,8 +161,8 @@ class InteractiveManager(models.Manager):
class Interaction(models.Model):
"""Models each reconfiguration operation interaction between client and server."""
- client = models.ForeignKey(Client, related_name="interactions",)
- timestamp = models.DateTimeField() # Timestamp for this record
+ client = models.ForeignKey(Client, related_name="interactions")
+ timestamp = models.DateTimeField(db_index=True) # Timestamp for this record
state = models.CharField(max_length=32) # good/bad/modified/etc
repo_rev_code = models.CharField(max_length=64) # repo revision at time of interaction
goodcount = models.IntegerField() # of good config-items
diff --git a/src/lib/Bcfg2/Server/Reports/reports/sql/client.sql b/src/lib/Bcfg2/Server/Reports/reports/sql/client.sql
deleted file mode 100644
index 28e785450..000000000
--- a/src/lib/Bcfg2/Server/Reports/reports/sql/client.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE VIEW reports_current_interactions AS SELECT x.client_id AS client_id, reports_interaction.id AS interaction_id FROM (select client_id, MAX(timestamp) as timer FROM reports_interaction GROUP BY client_id) x, reports_interaction WHERE reports_interaction.client_id = x.client_id AND reports_interaction.timestamp = x.timer;
-
-create index reports_interaction_client_id on reports_interaction (client_id);
-create index reports_client_current_interaction_id on reports_client (current_interaction_id);
-create index reports_performance_interaction_performance_id on reports_performance_interaction (performance_id);
-create index reports_interaction_timestamp on reports_interaction (timestamp);
-create index reports_performance_interation_interaction_id on reports_performance_interaction (interaction_id);