I’m just starting out an elixir application using the whole mix package (phx, ecto) for the first time.
The initial migration seems extremely backwards to me. But i’m not that versed on ORMs either. I can see why I wouldn’t want migrations after the DB exists to screw up tables and such. But for the initial one, I honestly cannot see any advantage.
What is bugging me most is, i will spend probably several days authoring a bunch of Schema in my repo. Then, i will have to repeat line by line all the tables/fields into my initial migration file. Not to mention that at this time, until I have anything in production, i want to collapse all my “migrations” into a initial one anyone.
Does this make sense? anyone have any work around to save the initial work on this? any workflow that is more practical not covered on the official guide?
If you’re at that point, the workflow I generally use is to write out the mix phx.gen commands I run, and then I just edit those as I want to tweak stuff and just keep deleting the lib / priv directories until things are the way I want. This also helps solve any html boilerplate (if applicable).
i see. so the usual process is to ignore echo.migration initial and never manually editing Schemas/Migrations.Create_xxx, and going straight to mix phx.gen?
edit: …and then manually tweaking the fields not present on the html/api endpoints? sigh…
@gcb I haven’t read the books you’re referring to in a long time, so I don’t know what you mean by ecto.migration initial. You asked about alternative work flows and I’m saying I jump straight in to phx.gen. This minimizes the tweaking.