[PATCH 0/3] Fix migrations state & load initial data throuh migrations (v2)

Finucane, Stephen stephen.finucane at intel.com
Wed Sep 9 23:21:48 AEST 2015


> v2 of the previous series (long explanation there):
> 
>   https://lists.ozlabs.org/pipermail/patchwork/2015-August/001394.html
> 
> This time passing the tests.

Could you use a prefix next time ('--prefix="PATCH v2"' option in git-send-mail) - it's quite confusing to find the correct version otherwise.

> I've now also noticed that Stephen fixed the same issue in a different way
> in:
> 
>   https://lists.ozlabs.org/pipermail/patchwork/2015-July/001362.html
> 
> I like my solution slightly better, but that's debatable, of course.

I considered taking the approach taken here. However, I read an article detailing why Django 1.8+ removed support for "initial fixtures" (which I, of course, can't find the link for now...). In summary, use of initial fixtures causes whatever data is in the database to be overwritten with the fixtures. This doesn't fit into the paradigm of "migrations", which should modify data based on explicitly defined instructions only. I think the reason we use fixtures is because end users will have different (and changing) requirements for their states and tags. Explicitly having to load fixtures reinforces this idea (you load *your* fixtures, which could provide the same tags/states as the upstream, or could be modified). If this isn't true and users are expected not to modify these, then we should probably look at migrating to a field with 'choices' instead.

tl;dr: I prefer my approach
 
> 
> --
> Damien
> 
> 
> 
> Damien Lespiau (3):
>   migrations: Use a data migration to load initial states and tags
>   fixtures: Remove the initial project data
>   migrations: Add the default value of Patch.state
> 
>  docs/INSTALL                                       |  5 ---
>  patchwork/fixtures/default_projects.xml            | 18 -----------
>  patchwork/migrations/0002_load_initial_data.py     | 37
> ++++++++++++++++++++++
>  .../migrations/0003_patch_state_default_value.py   | 20 ++++++++++++
>  patchwork/models.py                                |  5 ++-
>  5 files changed, 61 insertions(+), 24 deletions(-)
>  delete mode 100644 patchwork/fixtures/default_projects.xml
>  create mode 100644 patchwork/migrations/0002_load_initial_data.py
>  create mode 100644 patchwork/migrations/0003_patch_state_default_value.py
> 
> --
> 2.1.0
> 
> _______________________________________________
> Patchwork mailing list
> Patchwork at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork


More information about the Patchwork mailing list