diff --git a/issues/views.py b/issues/views.py index 75ebd6e..bd63196 100644 --- a/issues/views.py +++ b/issues/views.py @@ -360,7 +360,7 @@ def issue_event_stacktrace(request, issue, event_pk=None, digest_order=None, nav def issue_event_404(request, issue, tab, this_view): """If the Event is 404, but the issue is not, we can still show the issue page; we show a message for the event""" - last_event = issue.event_set.order_by("timestamp").last() # the template needs this for the tabs, we pick the last + last_event = issue.event_set.order_by("digest_order").last() # the template needs this for the tabs return render(request, "issues/event_404.html", { "tab": tab, "this_view": this_view, @@ -471,7 +471,7 @@ def issue_history(request, issue): if request.method == "POST": return _handle_post(request, issue) - last_event = issue.event_set.order_by("timestamp").last() # the template needs this for the tabs, we pick the last + last_event = issue.event_set.order_by("digest_order").last() # the template needs this for the tabs return render(request, "issues/history.html", { "tab": "history", "project": issue.project, @@ -489,7 +489,7 @@ def issue_grouping(request, issue): if request.method == "POST": return _handle_post(request, issue) - last_event = issue.event_set.order_by("timestamp").last() # the template needs this for the tabs, we pick the last + last_event = issue.event_set.order_by("digest_order").last() # the template needs this for the tabs return render(request, "issues/grouping.html", { "tab": "grouping", "project": issue.project, @@ -515,7 +515,7 @@ def issue_event_list(request, issue): page_number = request.GET.get("page") page_obj = paginator.get_page(page_number) - last_event = issue.event_set.order_by("timestamp").last() # the template needs this for the tabs, we pick the last + last_event = issue.event_set.order_by("digest_order").last() # the template needs this for the tabs return render(request, "issues/event_list.html", { "tab": "event-list", "project": issue.project, diff --git a/projects/migrations/0003_project_projects_pr_name_11d782_idx.py b/projects/migrations/0003_project_projects_pr_name_11d782_idx.py new file mode 100644 index 0000000..24148de --- /dev/null +++ b/projects/migrations/0003_project_projects_pr_name_11d782_idx.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.18 on 2025-02-04 20:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("projects", "0002_b_squashed_initial"), + ] + + operations = [ + migrations.AddIndex( + model_name="project", + index=models.Index(fields=["name"], name="projects_pr_name_11d782_idx"), + ), + ] diff --git a/projects/models.py b/projects/models.py index f07b93f..c347f93 100644 --- a/projects/models.py +++ b/projects/models.py @@ -114,6 +114,11 @@ class Project(models.Model): def is_discoverable(self): return self.visibility <= ProjectVisibility.DISCOVERABLE + class Meta: + indexes = [ + models.Index(fields=["name"]), + ] + class ProjectMembership(models.Model): project = models.ForeignKey(Project, on_delete=models.CASCADE) diff --git a/releases/migrations/0002_release_releases_re_sort_ep_5c07c8_idx.py b/releases/migrations/0002_release_releases_re_sort_ep_5c07c8_idx.py new file mode 100644 index 0000000..f65543e --- /dev/null +++ b/releases/migrations/0002_release_releases_re_sort_ep_5c07c8_idx.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.18 on 2025-02-04 20:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("releases", "0001_initial"), + ] + + operations = [ + migrations.AddIndex( + model_name="release", + index=models.Index( + fields=["sort_epoch"], name="releases_re_sort_ep_5c07c8_idx" + ), + ), + ] diff --git a/releases/models.py b/releases/models.py index b1f81c5..872f49f 100644 --- a/releases/models.py +++ b/releases/models.py @@ -83,6 +83,10 @@ class Release(models.Model): class Meta: unique_together = ("project", "version") + indexes = [ + models.Index(fields=["sort_epoch"]), + ] + def get_short_version(self): if self.version == "": # the reason for this little hack is to have something show up in the UI for this case. I 'assume' (mother diff --git a/snappea/migrations/0004_task_snappea_tas_created_eb0824_idx.py b/snappea/migrations/0004_task_snappea_tas_created_eb0824_idx.py new file mode 100644 index 0000000..282af4d --- /dev/null +++ b/snappea/migrations/0004_task_snappea_tas_created_eb0824_idx.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.18 on 2025-02-04 20:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("snappea", "0003_task_created_at"), + ] + + operations = [ + migrations.AddIndex( + model_name="task", + index=models.Index( + fields=["created_at"], name="snappea_tas_created_eb0824_idx" + ), + ), + ] diff --git a/snappea/models.py b/snappea/models.py index 4d5d2c2..08508e9 100644 --- a/snappea/models.py +++ b/snappea/models.py @@ -15,6 +15,11 @@ class Task(models.Model): def __str__(self): return self.task_name + class Meta: + indexes = [ + models.Index(fields=['created_at']), + ] + def wakeup_server(): wakeup_file = os.path.join(get_settings().WAKEUP_CALLS_DIR, thread_uuid) diff --git a/teams/migrations/0002_team_teams_team_name_43e047_idx.py b/teams/migrations/0002_team_teams_team_name_43e047_idx.py new file mode 100644 index 0000000..7be3ccb --- /dev/null +++ b/teams/migrations/0002_team_teams_team_name_43e047_idx.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.18 on 2025-02-04 20:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("teams", "0001_b_squashed_initial"), + ] + + operations = [ + migrations.AddIndex( + model_name="team", + index=models.Index(fields=["name"], name="teams_team_name_43e047_idx"), + ), + ] diff --git a/teams/models.py b/teams/models.py index 8ef3f0e..ae31bc4 100644 --- a/teams/models.py +++ b/teams/models.py @@ -32,6 +32,11 @@ class Team(models.Model): def is_joinable(self): return self.visibility <= TeamVisibility.JOINABLE + class Meta: + indexes = [ + models.Index(fields=["name"]), + ] + class TeamMembership(models.Model): team = models.ForeignKey(Team, on_delete=models.CASCADE)