Create context file for a table which was created from mix ecto.gen.migration

Is there a way to create generate the context file for a table (the one where the functions for the basic CRUD operations are present) that was generated using the mix ecto.gen.migration instead of mix phx.gen.context?

Can you not just run the second mix task and then delete the duplicate migration?

Altered the question now

Do you have the schema for the table? What happens if you run mix phx.gen.context? Migrations only get run when you explicitly run them so if a mix task generates an extra migration that duplicates creating the table you can just delete it before running it.


I believe this the only trick we can use when we have already created migration and schema for the table.