An Ecto type for a whole canvas in one column: a :map (jsonb on
PostgreSQL, JSON text on SQLite and MySQL).
schema "diagrams" do
field :graph, Hakushi.Graph.Type, default: Hakushi.Graph.new()
end
# the migration
add :graph, :map, null: false, default: %{}The column holds Hakushi.Graph.dump/1's maps, so the data of the
nodes and edges must be JSON-able, and comes back with string keys.
A canvas whose nodes are rows of their own (the tables of a schema, the
steps of a workflow) keeps them in its own tables instead, and makes
its graph of them.