Skip to content

feat(preprod): drop existing extras column on PreprodArtifact #93388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 12, 2025

Conversation

trevor-e
Copy link
Member

@trevor-e trevor-e commented Jun 11, 2025

In #92056 (comment) we were requested to switch to using Django's JSONField. I don't remember anything in particular for why we chose Sentry's version, so seems fine to me!

Since this is renaming a column type (text -> jsonb) this requires a few migrations (based on this):

  1. (this PR) drop the existing column in safe mode. this is fine because we don't have any prod data for this table yet.
  2. actually drop the column
  3. add back the column with the new type

@trevor-e trevor-e requested a review from a team as a code owner June 11, 2025 22:40
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 11, 2025

This comment was marked as outdated.

Copy link

codecov bot commented Jun 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #93388       +/-   ##
===========================================
+ Coverage   41.27%   88.00%   +46.72%     
===========================================
  Files       10259    10289       +30     
  Lines      592078   593525     +1447     
  Branches    23028    23028               
===========================================
+ Hits       244401   522311   +277910     
+ Misses     347245    70782   -276463     
  Partials      432      432               

@trevor-e trevor-e changed the title feat(preprod): add new misc column to replace extras feat(preprod): drop existing extras column on PreprodArtifact Jun 11, 2025
Copy link
Contributor

This PR has a migration; here is the generated SQL for src/sentry/preprod/migrations/0002_drop_sentry_jsonfield.py

for 0002_drop_sentry_jsonfield in preprod

--
-- Moved preprodartifact.extras field to pending deletion state
--
-- (no-op)

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved this other migration test to our project.

Copy link
Member

@cmanallen cmanallen left a comment

Choose a reason for hiding this comment

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

Looks correct to me 👍. And since the table is empty I don't foresee there being any trouble whatsoever. Pinging @wedamija in case he has thoughts. But LGTM.

@trevor-e
Copy link
Member Author

To clarify we have ~6 records in the table, but extras is null and not being written yet and there are no usages.

from sentry.testutils.cases import TestMigrations


class DropSentryJsonfieldTests(TestMigrations):
Copy link
Member

Choose a reason for hiding this comment

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

No need to write migration tests for table changes. These are just for backfills and so on that have logic, better to remove this since these tend to be slow and a break over time

@trevor-e trevor-e merged commit 5d2b612 into master Jun 12, 2025
61 checks passed
@trevor-e trevor-e deleted the telkins/json-migrate branch June 12, 2025 17:59
trevor-e added a commit that referenced this pull request Jun 13, 2025
Second step of the plan in
#93388

Won't merge until the first PR is fully deployed.
trevor-e added a commit that referenced this pull request Jun 13, 2025
The final PR in our saga to change the type of `extras` ->
`models.JSONField`. This simply adds back the column.

See #93466 and
#93388
billyvg pushed a commit that referenced this pull request Jun 18, 2025
Second step of the plan in
#93388

Won't merge until the first PR is fully deployed.
billyvg pushed a commit that referenced this pull request Jun 18, 2025
The final PR in our saga to change the type of `extras` ->
`models.JSONField`. This simply adds back the column.

See #93466 and
#93388
andrewshie-sentry pushed a commit that referenced this pull request Jun 19, 2025
<!-- Describe your PR here. -->
In #92056 (comment)
we were requested to switch to using Django's JSONField. I don't
remember anything in particular for why we chose Sentry's version, so
seems fine to me!

Since this is renaming a column type (text -> jsonb) this requires a few
migrations ([based on
this)](https://develop.sentry.dev/backend/application-domains/database-migrations/#deleting-columns):
1) (this PR) drop the existing column in safe mode. this is fine because
we don't have any prod data for this table yet.
2) actually drop the column
3) add back the column with the new type
andrewshie-sentry pushed a commit that referenced this pull request Jun 19, 2025
Second step of the plan in
#93388

Won't merge until the first PR is fully deployed.
andrewshie-sentry pushed a commit that referenced this pull request Jun 19, 2025
The final PR in our saga to change the type of `extras` ->
`models.JSONField`. This simply adds back the column.

See #93466 and
#93388
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