Is there a annotate_models like tool in phoenix?

Elixir newbie here.

In rails, annotate_models can help to annotate table schema information in comment.

# == Schema Info
#
# Table name: line_items
#
#  id                  :integer(11)    not null, primary key
#  quantity            :integer(11)    not null
#  product_id          :integer(11)    not null
#  unit_price          :float
#  order_id            :integer(11)
#

 class LineItem < ActiveRecord::Base
   belongs_to :product

Is there a similar tool in phoenix ? Or can I read a table’s column and index information manually by ecto?

Thanks

I have been using annotate models in Rails, but it’s probably less important in Ecto because the schema is quite expressive.

Searching in https://hex.pm/ did not give similar package.

1 Like

It would probably be quite simple to add, when you can do the part about the data retrieval from the db. Wrap use Ecto.Schema in a use EctoAnnotate.Schema and decorate the schema/2 macro. In it you should be able to get the file and location of the call and the table used.

3 Likes