Is there a way echo.migrate can read my models and update my database accordingly?

Its becoming difficult and hard to keep track of what all updates happen to my models as part of development and create migration files for the corresponding changes etc. Is there a way by which ecto.migrate can read my models vs the database and identify/suggest what updates are reqd or create migration files/update database as reqd? If its not available, is it a good idea to consider this as enhancement? Or is there any other automated way of achieving this?

I don’t think so… it’s a feature I missed coming from python Django. But it is not something that is perfect and will work in any situation though…

Also models are deprecated in Ecto and we can have multiple schemas for the same db table.

What I do to keep track of my projects database structure is using some diagram tools such as draw.io. There are many interresting solutions in this thread:

2 Likes

Thanks, Kurisu. Looks like there are some interesting DB tools to try out. I will check these out.

1 Like

I have done pretty much that with a custom test assertion function that takes in a schema name and a list of expected fields and types. If the schema or database does not match, it fails with a somewhat-helpful set of possible remedies such as the mix command you might consider to fix the problem.

It’s a nice way to test-drive schema changes and get a little help making the changes.

1 Like

Thats wonderful. Would you be able to share it so that I can give it a try?