]> git.ipfire.org Git - thirdparty/patchwork.git/commit
models: Merge patch and first comment
authorStephen Finucane <stephen.finucane@intel.com>
Sat, 6 Feb 2016 20:32:20 +0000 (20:32 +0000)
committerStephen Finucane <stephen.finucane@intel.com>
Wed, 16 Mar 2016 09:37:39 +0000 (09:37 +0000)
commitef56359fb7762126edac213d36727f4e0655f9f8
treec5984eb84c319345388ece4c2edb8d6f204c3b86
parent2aab573703741a481952bd9f3301574de44c172f
models: Merge patch and first comment

At the moment a patch is split into two model entries: a Patch and a
linked Comment. The original rationale for this was that a Patch is
really a sub-class of Comment. A comment is a record of the text
content of an incoming mail, while a patch is that, plus the patch
content too. Hence the separation and a one-to-one relationship when a
patch is present. However, this decision was made before Django added
support for model inheritance and is no longer necessary. This change
flatten the models in preparation for some email subclassing work. This
is achieved by copying over the non-duplicated fields from the Comment
to the linked Patch, then deleting the Comment.

The migrations are broken into two steps: a schema migration and a data
migration, per the recommendations of the Django documentation [1]. SQL
migration scripts, where necessary, will need to be created manually as
there appears to be no way to do this in a way that is
RDBMS-independant [2][3].

[1] https://docs.djangoproject.com/en/1.9/topics/migrations/#data-migrations
[2] https://stackoverflow.com/q/6856849/
[3] https://stackoverflow.com/q/224732/

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
18 files changed:
patchwork/bin/parsemail.py
patchwork/migrations/0006_add_patch_diff.py [new file with mode: 0644]
patchwork/migrations/0007_move_comment_content_to_patch_content.py [new file with mode: 0644]
patchwork/models.py
patchwork/templates/patchwork/patch.html
patchwork/templatetags/syntax.py
patchwork/tests/test_checks.py
patchwork/tests/test_encodings.py
patchwork/tests/test_expiry.py
patchwork/tests/test_list.py
patchwork/tests/test_mboxviews.py
patchwork/tests/test_notifications.py
patchwork/tests/test_patchparser.py
patchwork/tests/test_tags.py
patchwork/tests/utils.py
patchwork/views/__init__.py
patchwork/views/patch.py
patchwork/views/xmlrpc.py