No announcement yet.

filedata and attachment

  • Filter
  • Time
  • Show
Clear All
new posts

  • filedata and attachment


    1- What is the difference between filedata and attachment tables in database?

    I find that the id for both is the same but there are tons of filedata ids that are not in the attachment table
    2- Does it refer to missing attachment?, if yes. is it restorable?

    3- how can i find the Post count for the filedata or attachment?

    N.B: I am saving attachment in file system outside public_html

    Thank you

  • #2
    1. attachment is a vBulletin 4.X table and not used in vBulletin 5.

    vBulletin 5 uses filedata and attach.
    • filedata holds the information about the actual file. This includes filename, size, binary data if stored in the database, and other information.
    • attach holds the information about where the file is used. Each filedata record can be attached to one or more nodes and displayed on those nodes.
    The filedataid within the attachment table is a reference key to the filedata table. It is not the primary key of the attach table.

    2. No. Missing attachments would not have a filedata record. That is why they are missing. The system will store some files are not attached to a node in the filedata field as well. These files include uploaded logos and the Theme Icons shown in Site Builder's Style selector. These files should have an artificially high refcount (see #3 below)

    3. The easiest way to count how many times a filedata record is referenced is to use the refcount field in that table. This will be incremented every time a record is attached to a node and decremented every time the node is either deleted or the attached file is removed from the node. In most cases, if the refcount field reaches zero, then the record will be deleted and the attachment will be lost.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API


    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.