Project

General

Profile

Actions

Bug #3077

closed

Add migration to convert remaining non-root collection owner_uuids to name links

Added by Tom Clegg over 9 years ago. Updated over 9 years ago.

Status:
Rejected
Priority:
Normal
Assigned To:
Category:
-
Target version:
-
Story points:
1.0

Description

The Collection model used to have its owner_uuid set to the uuid of the user who created it. Now owner_uuid is always system_user_uuid. Old collections still need to be migrated.

For each collection whose owner_uuid is not system_user_uuid, we need to:
  1. Create a new link with
    • owner_uuid = tail_uuid = old collection's owner_uuid
    • head_uuid = old collection's uuid
    • link_class = "name"
    • name = old collection's uuid
    • system metadata attributes (created_by*, etc) copied from the old collection
  2. Change owner_uuid to system_user_uuid

Example:

{
  "uuid": "07046024ba76642c9f4f27dac4dc931d+242",
  "locator": null,
  "owner_uuid": "qr1hi-j7d0g-it30l961gq3t0oi",
  "created_at": "2014-02-10 08:25:21 UTC",
  "modified_by_client_uuid": "qr1hi-ozdt8-obw7foaks3qjyej",
  "modified_by_user_uuid": "qr1hi-tpzed-tpj2ff66551eyym",
  "modified_at": "2014-02-14 18:28:18 UTC",
  "portable_data_hash": null,
  "redundancy": null,
  "redundancy_confirmed_by_client_uuid": null,
  "redundancy_confirmed_at": null,
  "redundancy_confirmed_as": null,
  "updated_at": null,
  "manifest_text": ". 37a4633d6484823b4bef5eb818c88bc2+67108864+K@1h9kt+A647c3a9e4b2ce8944b3798404244ed0b8f491f56@53ba9fda 43e2e0a568f2ed215d9966e5c67e498b+67108864+K@1h9kt+Af62db167881509c58b3361ed297478df477e554b@53ba9fda cd7b4bed23e8feae93656f3396de8964+67108864+K@1h9kt+A84203fab608e1e17d0c5c3a9b239182e72fe3d53@53ba9fda b14da7079ff81e9c0c493df888fb6ca4+43499401+K@1h9kt+A2b6aa3cd407fcd33bc94edc7ba36ea4ee8b47c22@53ba9fda 0:244825993:var-GS000015886-ASM.tsv.bz2\n" 
}
Existing name links could cause a unique constraint violation. In this case either:
  • head_uuid = name. The new name link would be redundant so we should just not create it.
  • head_uuid does not match, i.e., a user/project has a collection whose name is the uuid of a different collection. This is unlikely enough that skipping creation of the new name (with matching uuid=name) seems like an acceptable sacrifice.

This is also the best time to start enforcing the owner_uuid==system_user_uuid constraint at the Collection model level by overloading ensure_owner_uuid_is_permitted to return false if owner_uuid != system_user_uuid.

Actions #1

Updated by Tom Clegg over 9 years ago

  • Description updated (diff)
Actions #2

Updated by Tom Clegg over 9 years ago

  • Target version deleted (2014-07-16 Sprint)
Actions #3

Updated by Tom Clegg over 9 years ago

  • Assigned To set to Tom Clegg
Actions #4

Updated by Peter Amstutz over 9 years ago

  • Status changed from New to Rejected

Obsoleted by #3036

Actions

Also available in: Atom PDF