From f15ecb900df0d269ce19d47d7d365dc4b1827e17 Mon Sep 17 00:00:00 2001 From: Michael Matloka Date: Thu, 25 Apr 2024 23:22:03 +0200 Subject: [PATCH] Mark `Insight.last_refresh` as deprecated --- posthog/api/insight.py | 1 - posthog/models/insight.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/api/insight.py b/posthog/api/insight.py index e4595fe776c9e..895aa0fc99852 100644 --- a/posthog/api/insight.py +++ b/posthog/api/insight.py @@ -326,7 +326,6 @@ def create(self, validated_data: dict, *args: Any, **kwargs: Any) -> Insight: raise serializers.ValidationError("Dashboard not found") DashboardTile.objects.create(insight=insight, dashboard=dashboard, last_refresh=now()) - insight.last_refresh = now() # set last refresh if the insight is on at least one dashboard # Manual tag creation since this create method doesn't call super() self._attempt_set_tags(tags, insight) diff --git a/posthog/models/insight.py b/posthog/models/insight.py index b4949771d6d80..2b93b3c214d4f 100644 --- a/posthog/models/insight.py +++ b/posthog/models/insight.py @@ -43,7 +43,6 @@ class Insight(models.Model): deleted: models.BooleanField = models.BooleanField(default=False) saved: models.BooleanField = models.BooleanField(default=False) created_at: models.DateTimeField = models.DateTimeField(null=True, blank=True, auto_now_add=True) - last_refresh: models.DateTimeField = models.DateTimeField(blank=True, null=True) refreshing: models.BooleanField = models.BooleanField(default=False) created_by: models.ForeignKey = models.ForeignKey("User", on_delete=models.SET_NULL, null=True, blank=True) # Indicates if it's a sample graph generated by dashboard templates @@ -69,6 +68,8 @@ class Insight(models.Model): null=True, blank=True, ) + # DEPRECATED: within cached results package now + last_refresh: models.DateTimeField = models.DateTimeField(blank=True, null=True) # DEPRECATED: on dashboard_insight now layouts: models.JSONField = models.JSONField(default=dict) # DEPRECATED: on dashboard_insight now