From 1bb8f7bf521bad52f32715dd2a138f7d3507845d Mon Sep 17 00:00:00 2001 From: MichaelSun48 Date: Mon, 17 Mar 2025 15:56:34 -0700 Subject: [PATCH] Make groupsearchview.position nullable --- migrations_lockfile.txt | 2 +- ...rchview_postition_nullable_for_deletion.py | 33 +++++++++++++++++++ src/sentry/models/groupsearchview.py | 2 +- 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 src/sentry/migrations/0843_make_groupsearchview_postition_nullable_for_deletion.py diff --git a/migrations_lockfile.txt b/migrations_lockfile.txt index 42ff8da28c37ef..c60ac8c0a0a60f 100644 --- a/migrations_lockfile.txt +++ b/migrations_lockfile.txt @@ -17,7 +17,7 @@ remote_subscriptions: 0003_drop_remote_subscription replays: 0004_index_together -sentry: 0842_create_organization_member_invite_table +sentry: 0843_make_groupsearchview_postition_nullable_for_deletion social_auth: 0002_default_auto_field diff --git a/src/sentry/migrations/0843_make_groupsearchview_postition_nullable_for_deletion.py b/src/sentry/migrations/0843_make_groupsearchview_postition_nullable_for_deletion.py new file mode 100644 index 00000000000000..ff6490c9ead65a --- /dev/null +++ b/src/sentry/migrations/0843_make_groupsearchview_postition_nullable_for_deletion.py @@ -0,0 +1,33 @@ +# Generated by Django 5.1.7 on 2025-03-17 22:56 + +from django.db import migrations, models + +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", "0842_create_organization_member_invite_table"), + ] + + operations = [ + migrations.AlterField( + model_name="groupsearchview", + name="position", + field=models.PositiveSmallIntegerField(null=True), + ), + ] diff --git a/src/sentry/models/groupsearchview.py b/src/sentry/models/groupsearchview.py index ca942828884c3a..7cb9c28e3000cf 100644 --- a/src/sentry/models/groupsearchview.py +++ b/src/sentry/models/groupsearchview.py @@ -62,7 +62,7 @@ class GroupSearchView(DefaultFieldsModelExisting): query_sort = models.CharField( max_length=16, default=SortOptions.DATE, choices=SortOptions.as_choices() ) - position = models.PositiveSmallIntegerField() + position = models.PositiveSmallIntegerField(null=True) # Projects = [] maps to "My Projects" (This is so when a project is deleted, it correctly defaults to "My Projects") projects = models.ManyToManyField("sentry.Project", through="sentry.GroupSearchViewProject")