summaryrefslogtreecommitdiff
path: root/patchwork/migrations/0043_merge_patch_submission.py
diff options
context:
space:
mode:
Diffstat (limited to 'patchwork/migrations/0043_merge_patch_submission.py')
-rw-r--r--patchwork/migrations/0043_merge_patch_submission.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/patchwork/migrations/0043_merge_patch_submission.py b/patchwork/migrations/0043_merge_patch_submission.py
index 25e741d..d351892 100644
--- a/patchwork/migrations/0043_merge_patch_submission.py
+++ b/patchwork/migrations/0043_merge_patch_submission.py
@@ -42,11 +42,41 @@ def migrate_data(apps, schema_editor):
""" # noqa
)
else:
- raise Exception('DB not supported')
+ schema_editor.execute(
+ """
+ UPDATE patchwork_submission
+ SET (
+ archived, commit_ref, delegate_id, diff, hash, number,
+ pull_url, related_id, series_id, state_id
+ ) = (
+ SELECT
+ patchwork_patch.archived2,
+ patchwork_patch.commit_ref2,
+ patchwork_patch.delegate2_id,
+ patchwork_patch.diff2,
+ patchwork_patch.hash2,
+ patchwork_patch.number2,
+ patchwork_patch.pull_url2,
+ patchwork_patch.related2_id,
+ patchwork_patch.series2_id,
+ patchwork_patch.state2_id
+ FROM patchwork_patch
+ WHERE patchwork_patch.submission_ptr_id = patchwork_submission.id
+ )
+ WHERE
+ EXISTS (
+ SELECT *
+ FROM patchwork_patch
+ WHERE patchwork_patch.submission_ptr_id = patchwork_submission.id
+ )
+ """ # noqa
+ )
class Migration(migrations.Migration):
+ atomic = False
+
dependencies = [
('patchwork', '0042_add_cover_model'),
]