Skip to content

Commit

Permalink
Add projects, environemnts, time_filters, and is_all_projects column
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSun48 committed Jan 14, 2025
1 parent e221530 commit 8f95206
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Generated by Django 5.1.4 on 2025-01-14 01:50

from django.db import migrations, models

import sentry.db.models.fields.array
import sentry.models.groupsearchview
from sentry.new_migrations.migrations import CheckedMigration


class Migration(CheckedMigration):
# This flag is used to mark that a migration shouldn't be automatically run in production.
# This should only be used for operations where it's safe to run the migration after your
# code has deployed. So this should not be used for most operations that alter the schema
# of a table.
# Here are some things that make sense to mark as post deployment:
# - Large data migrations. Typically we want these to be run manually so that they can be
# monitored and not block the deploy for a long period of time while they run.
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
# run this outside deployments so that we don't block them. Note that while adding an index
# is a schema change, it's completely safe to run the operation after the code has deployed.
# Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment

is_post_deployment = False

dependencies = [
("sentry", "0813_rm_alertruleactivation_models"),
]

operations = [
migrations.AddField(
model_name="groupsearchview",
name="environments",
field=sentry.db.models.fields.array.ArrayField(default=[], null=True),
),
migrations.AddField(
model_name="groupsearchview",
name="projects",
field=sentry.db.models.fields.array.ArrayField(default=[], null=True),
),
migrations.AddField(
model_name="groupsearchview",
name="time_filters",
field=models.JSONField(
default=sentry.models.groupsearchview.default_time_filters, null=True
),
),
]
14 changes: 14 additions & 0 deletions src/sentry/models/groupsearchview.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
from sentry.backup.scopes import RelocationScope
from sentry.db.models import region_silo_model
from sentry.db.models.base import DefaultFieldsModelExisting
from sentry.db.models.fields.array import ArrayField
from sentry.db.models.fields.foreignkey import FlexibleForeignKey
from sentry.db.models.fields.hybrid_cloud_foreign_key import HybridCloudForeignKey
from sentry.models.savedsearch import SortOptions


def default_time_filters():
return {"period": "14d"}


@region_silo_model
class GroupSearchView(DefaultFieldsModelExisting):
"""
Expand All @@ -26,6 +31,15 @@ class GroupSearchView(DefaultFieldsModelExisting):
)
position = models.PositiveSmallIntegerField()

# projects = [] -> "My Projects"
# projects = [-1] -> "All Projects"
projects = ArrayField(models.IntegerField(), default=[], null=False)

# environments = [] -> "All Environments"
environments = ArrayField(models.IntegerField(), default=[], null=False)

time_filters = models.JSONField(null=True, default=default_time_filters)

class Meta:
app_label = "sentry"
db_table = "sentry_groupsearchview"
Expand Down

0 comments on commit 8f95206

Please sign in to comment.