Storage.AttachmentSchema (PhoenixContribStorage v0.1.0)

View Source

Schema for linking records to blobs.

An Attachment represents the relationship between a record (like User) and a Blob (the actual file). This allows for polymorphic associations where any record can have attachments.

Summary

Functions

Finds all attachments for a given record and name.

Creates an attachment for the given record and blob.

Detaches an attachment without deleting the underlying blob.

Finds a single attachment for a given record and name.

Finds attachments for a given record and name.

Purges an attachment and its associated blob if no other attachments reference it.

Functions

all_for_record(record, name)

Finds all attachments for a given record and name.

create!(record, name, blob)

Creates an attachment for the given record and blob.

detach!(attachment)

Detaches an attachment without deleting the underlying blob.

find_for_record(record, name)

Finds a single attachment for a given record and name.

for_record(record, name)

Finds attachments for a given record and name.

purge!(attachment)

Purges an attachment and its associated blob if no other attachments reference it.