-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref: re-introduce migration to unpickle project options (#67436)
copy paste of `0454_pickle_to_json_sentry_projectoptions` but post-squash <!-- Describe your PR here. -->
- Loading branch information
1 parent
f1d2328
commit c987d30
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/sentry/migrations/0677_unpickle_project_options_again.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Generated by Django 2.2.28 on 2023-05-19 17:25 | ||
|
||
from django.db import migrations | ||
|
||
from sentry.new_migrations.migrations import CheckedMigration | ||
from sentry.utils.query import RangeQuerySetWrapperWithProgressBar | ||
|
||
|
||
def _backfill(apps, schema_editor): | ||
cls = apps.get_model("sentry", "ProjectOption") | ||
|
||
for obj in RangeQuerySetWrapperWithProgressBar(cls.objects.all()): | ||
# load pickle, save json | ||
obj.save(update_fields=["value"]) | ||
|
||
|
||
class Migration(CheckedMigration): | ||
# data migration: must be run out of band | ||
is_dangerous = True | ||
|
||
# data migration: run outside of a transaction | ||
atomic = False | ||
|
||
dependencies = [ | ||
("sentry", "0676_apitoken_hashed_indexes"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
_backfill, | ||
migrations.RunPython.noop, | ||
hints={"tables": ["sentry_projectoptions"]}, | ||
), | ||
] |