The tables of a library of files (Storehouse.Ecto.Blob,
Storehouse.Ecto.Usage), for a migration of the app's:
defmodule MyApp.Repo.Migrations.AddStorehouseBlobs do
use Ecto.Migration
def up, do: Storehouse.Ecto.Migrations.up()
def down, do: Storehouse.Ecto.Migrations.down()
endIt makes two tables:
storehouse_blobs- a file a row: its key (unique), store, owner, name, type, size, checksum, width, height, metadata, analysis,processing_errorand timestamps, with a UUID for its id. The same file of the same owner is one row (a unique index of the owner and the checksum).storehouse_usages- which records use each file: the blob, the record's table and id. A blob a record uses cannot be deleted, by the database's own foreign key.
Apps that keep their files in records' columns (Storehouse.Ecto.File)
need neither.
Options
:blobsand:usages- the tables' names. The defaults are"storehouse_blobs"and"storehouse_usages".:unique_checksum-falselets an owner keep the same file twice. The default istrue.:prefix- the database schema (PostgreSQL's) of the tables.