[PATCH v2 2/3] models: Split Patch into two models

Andy Doan andy.doan at linaro.org
Thu Mar 17 08:46:13 AEDT 2016

On 03/16/2016 04:28 PM, Andy Doan wrote:
> This logic is very time-consuming. It took 20 minutes on my instance. I
> just hacked this together in pure SQL to run in about 8 seconds (not
> really tested):
> 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
>                  '''],
>              ['TODO THE reverse migration i haven't figured out yet']
>          ),

I figured out the reverse migration path also. Its a little more time 
consuming at 30 seconds, but still not too bad:

['''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 = 

Full source: http://paste.ubuntu.com/15404553/

More information about the Patchwork mailing list