I have an Postgres table and corresponding Ecto schema,
Activity. One of the fields
activity_data has the potential to contain a relatively large amount of data and is stored as binary data in the DB.
schema "activities" do belongs_to(:user, User) field(:activity_id, :string) field(:started_at, :naive_datetime) field(:ended_at, :naive_datetime) field(:activity_data, :binary) timestamps() end
I need this field in the schema because when I insert a record I need to be able to insert this data into the database.
However, most of the time I don’t need to query the
I’m trying to figure out a way to avoid querying this from the DB in functions like
Repo.get and through associations. E.g.
My first thought is to have 2 schemas; one for creation and another for querying. But I was wondering if there’s a simpler way.