How to find correct UUID for attachment in Content-Store

Hi.

After migration from 2022.06 to 2023.06 attachments where moved to Content-Store.

In attachment_reference Table of Dataservices-DB, I see an entry for an attachment I look for:

However, the UUID of this Entry does not seem to be the UUID of the referenced Attachment.

How can I found out, which Attachment-UUID I have to use for JSON-RPC-Call LOAD_ATTACHMENT_HEADER?

It is related to my A12-Bug: A12-15266

Moin @stefan-grey-canyon,

the “attachment_header_id” in the attachment_reference-table should match the one in attachment_header table.

I’ve tested it now in the Project Template by sending following rpc request:

[
    {
      "jsonrpc":"2.0",
      "id":"PlatformDocumentListDataLoader-6",
      "method":"LOAD_ATTACHMENT_HEADER",
      "params":{
         "attachmentId": "ab4e144d-e9bf-4f36-9e86-33ce79adbbef",
         "docRef": "Person-document/18"
      }
   }
]

And retrieved following response:

[
    {
        "jsonrpc": "2.0",
        "id": "PlatformDocumentListDataLoader-6",
        "result": {
            "attachmentId": "ab4e144d-e9bf-4f36-9e86-33ce79adbbef",
            "filename": "TheCat.png",
            "mimeType": "image/png",
            "smallThumbnailUrl": "http://localhost:8082/cs/download/94b9604e-e318-415d-9580-598f44810811",
            "bigThumbnailUrl": "http://localhost:8082/cs/download/d40312e3-2341-4220-bf0e-3c21ba52a8bd",
            "size": 247140,
            "annotations": []
        }
    }
]

Thanks. What makes this difficult is when, after a migration, there can be “dead attachments”, where the document does not exist anymore.

To analyze this better, I also created a SQL query to match both tables excluding the “dead attachments”, only showing existing partners:

SELECT d.id, d.model_name, ar.attachment_header_id
FROM document d, attachment_reference ar
WHERE ar.type='DOCUMENT'
AND d.id = SPLIT_PART(ar.reference,'/',2)