summaryrefslogtreecommitdiff
path: root/patchwork/migrations/0010_migrate_data_from_submission_to_patch.py
blob: 3b80233626d8bd1d400925f4268d6419a686713a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ('patchwork', '0009_add_submission_model'),
    ]

    operations = [
        migrations.RunSQL(
            '''INSERT INTO patchwork_patch
                  (submission_ptr_id, diff2, commit_ref2, pull_url2,
                   delegate2_id, state2_id, archived2, hash2)
                SELECT id, diff, commit_ref, pull_url, delegate_id, state_id,
                       archived, hash
                FROM patchwork_submission
                ''',
            '''UPDATE patchwork_submission SET
                  diff=diff2, commit_ref=commit_ref2, pull_url=pull_url2,
                  delegate_id=delegate2_id, state_id=state2_id,
                  archived=archived2, hash=hash2
                FROM patchwork_patch WHERE
                  patchwork_submission.id = patchwork_patch.submission_ptr_id
                ''',
        ),
    ]