Attachments in the SpiraTeam Database

When you upload a new attachment into SpiraTeam, it creates two entries in the database, TST_ATTACHMENT and TST_ATTACHMENT_VERSION. We will examine each of these in turn.

TST_ATTACHMENT

This table contains a row for each attachment, including the filename and mime type:

If you decide to upload a new version of the same attachment, the version number gets updated, but the primary key (ATTACHMENT_ID) does not change. The FILENAME field contains the actual filename of the attachment and the extension will be correct filetype (e.g. .pdf, .xlsx, etc.)

 

TST_ATTACHMENT_VERSION

This table contains a row for each version of each attachment:

If you upload a new version of an existing document, the new row will have the same ATTACHMENT_ID (linked back to the TST_ATTACHMENT table), but a new ATTACHMENT_VERSION_ID.

Attachments in the Web Server Repository

On the web server running SpiraTeam, you will see a set of .dat files on the file system:

These files correspond to the ATTACHMENT_VERSION_ID (in very early versions of SpiraTeam it used to be the ATTACHMENT_ID). So if you know the ATTACHMENT_VERSION_ID then you simply need that ID's file:

<ATTACHMENT_ID>.dat