Skip to content
This repository has been archived by the owner on Jan 9, 2019. It is now read-only.

Problem: migration 0004 breaks upgrade if fprules have been customized #46

Closed
jhsimpson opened this issue Apr 19, 2017 · 1 comment
Closed
Milestone

Comments

@jhsimpson
Copy link
Member

Migration 0004 runs loaddata, using pronom_88.json. That json file has new fprules defined in it, for example:

    {
        "fields": {
            "count_not_okay": 0,
            "replaces": null,
            "count_attempts": 0,
            "uuid": "dfc4197d-d265-4eac-839d-b267d4ac4a9f",
            "format": "dc76c66b-8be8-45f4-a8c8-7d40a47a5b52",
            "lastmodified": "2016-12-14T14:04:19Z",
            "enabled": true,
            "command": "80314f3c-5d48-4ad1-a9f2-2c0f7c7b229d",
            "purpose": "characterization",
            "count_okay": 0
        },
        "model": "fpr.fprule",
        "pk": 712
    },

Each new instance of the fprule model defines a pk to use. If the database already has a row with that pk used, then the loaddata method tries to overwrite it. If that row has a uuid that is referred to in a replaces_id property of some other row in the database, the upgrade fails on an integrityError.

It is not necessary to pre-define the pk values. Omitting them works, the database will assign new keys automatically, and avoid this problem.

It would be better to avoid the use of loaddata altogether, ( see #38 ) but removing the pk's will fix the problem of not being able to upgrade Archivematica from 1.5.1 to 1.6.0 when the fpr has been customized.

@jhsimpson jhsimpson added this to the 1.6.1 milestone Apr 19, 2017
jhsimpson added a commit to jhsimpson/archivematica-fpr-admin that referenced this issue Apr 19, 2017
references artefactual#46

Do not set pk's from this fixture, when running loaddata.
qubot pushed a commit that referenced this issue Apr 19, 2017
setting pk's in this fixture causes loaddata to overwrite existing data.

see #46
@jhsimpson
Copy link
Member Author

fixed in #47

@sevein sevein modified the milestones: 1.2.1, 1.6.1 Apr 20, 2017
qubot pushed a commit that referenced this issue Apr 27, 2017
setting pk's in this fixture causes loaddata to overwrite existing data.

see #46
qubot pushed a commit that referenced this issue Apr 27, 2017
setting pk's in this fixture causes loaddata to overwrite existing data.

see #46
qubot pushed a commit that referenced this issue Apr 27, 2017
setting pk's in this fixture causes loaddata to overwrite existing data.

see #46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants