Issue #3130
Updated by ttereshc about 7 years ago
@0040_errata_pkglist_collection.py@ migration is not safe to re-run if it failed (or was interrupted) for some reason.
Getting @E11000 duplicate key error index: pulp_database.erratum_pkglists.$errata_id_1_repo_id_1 dup key...@
The @erratum_pkglists@ collection will be created automatically when adding the first entry in the collection. That means the collection will be created without any unique index and the @DuplicateKeyError@ exception in the migration script will never be raised.
The unique index will added by the @pulp-manage-db@ after the migrations in the "Ensure indexes" state but it is too late.
Ensure/create collection and its indexes before migrating data.
Workaround: remove a document from erratum_pkglists collection which triggers the duplicate error. There could be only one duplicated document in the collection because of the way migration script is written.