Alex Grs
Alex Grs

Reputation: 3301

How to make automatic migrations on Phoenix / Ecto?

I come from a python / django background where a simple python manage.py makemigrations was generating my migration.

Now the question is, with Ecto, I do not find commands like that. It seems i have to use mix ecto.gen.migration and then fill the migration manually. It will not detect changes in my model automatically, I have to fill it manually.

Do you have any ideas how to generate the migration almost automatically (for instance if I am adding a field in an existing model).

Upvotes: 7

Views: 989

Answers (1)

Nic Nilov
Nic Nilov

Reputation: 5156

As of the latest relevant commit, June 2018, this functionality is not there.

As an idea, why not try and parse the schema clause in the model, compare it to the underlying database and generate the statements based on the difference? Should be doable but probably not quite easy.

Upvotes: 3

Related Questions