Skip to content

Conversation

@armenzg
Copy link
Member

@armenzg armenzg commented Oct 31, 2025

While investigating #102470, I realized we don't actually use it for anything useful.

In order to delete the column, we first need to stop making use of it (see docs for instructions).

Next PR: #102672

While investigating #102470, I realized we don't actually use it for anything useful.

In order to delete the column, we first need to stop making any reference to it ([docs](https://develop.sentry.dev/backend/application-domains/database-migrations/#deleting-columns).
@armenzg armenzg self-assigned this Oct 31, 2025
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 31, 2025
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can go straight into removing the usage of prev_history since it's already null.

First, if the column is either not nullable, or doesn't have a db_default set, then make a PR to make it nullable via null=True.

prev_history = FlexibleForeignKey(
"sentry.GroupHistory", null=True
) # This field has no immediate use, but might be useful.

user_id: int | None = None,
team_id: int | None = None,
prev_history: GroupHistory | None = None,
prev_history_date: datetime | None = None,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, this is the column which can be null or a datetime:

prev_history_date = models.DateTimeField(
null=True
) # This field is used to simplify query calculations.

GroupHistoryStatus.RESOLVED,
user_id=self.user.id,
prev_history=gh1,
prev_history_date=gh1.date_added,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, the date_added field:

date_added = models.DateTimeField(default=timezone.now)

@armenzg armenzg marked this pull request as ready for review October 31, 2025 13:33
@armenzg armenzg requested a review from a team as a code owner October 31, 2025 13:33
@armenzg armenzg enabled auto-merge (squash) October 31, 2025 13:33
Copy link
Contributor

@cvxluo cvxluo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we planning to remove prev_history but keep prev_history_date?

@armenzg
Copy link
Member Author

armenzg commented Oct 31, 2025

are we planning to remove prev_history but keep prev_history_date?

That's correct!

@armenzg armenzg disabled auto-merge October 31, 2025 16:34
@armenzg armenzg requested a review from cvxluo October 31, 2025 16:34
@armenzg armenzg enabled auto-merge (squash) October 31, 2025 16:35
@armenzg armenzg merged commit b06c951 into master Oct 31, 2025
71 checks passed
@armenzg armenzg deleted the 1/prev_history/allow_null/armenzg branch October 31, 2025 16:45
jjbayer pushed a commit that referenced this pull request Nov 3, 2025
While investigating #102470, I realized we don't actually use it for
anything useful.

In order to delete the column, we first need to stop making use of it
(see
[docs](https://develop.sentry.dev/backend/application-domains/database-migrations/#deleting-columns)
for instructions).
armenzg added a commit that referenced this pull request Nov 4, 2025
This is part of the required steps to remove a column from Sentry:
https://develop.sentry.dev/backend/application-domains/database-migrations/#deleting-columns.

This is a follow-up to #102474.

This fixes [SENTRY-5BX8](https://sentry.sentry.io/issues/6994851757/) and [SENTRY-5BXW](https://sentry.sentry.io/issues/6995699817/) which are happening since we switched to the bulk deletion model (#102580).
armenzg added a commit that referenced this pull request Nov 4, 2025
This is part of the required steps to remove a column from Sentry:
https://develop.sentry.dev/backend/application-domains/database-migrations/#deleting-columns.

This is a follow-up to #102474.

This fixes [SENTRY-5BX8](https://sentry.sentry.io/issues/6994851757/)
and [SENTRY-5BXW](https://sentry.sentry.io/issues/6995699817/) which are
happening since we switched to the bulk deletion model (#102580).
shashjar pushed a commit that referenced this pull request Nov 4, 2025
While investigating #102470, I realized we don't actually use it for
anything useful.

In order to delete the column, we first need to stop making use of it
(see
[docs](https://develop.sentry.dev/backend/application-domains/database-migrations/#deleting-columns)
for instructions).
shashjar pushed a commit that referenced this pull request Nov 4, 2025
priscilawebdev pushed a commit that referenced this pull request Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants