Kurisu
How to run a specific Ecto migration file in the console while preventing it to be tracked?
I want to run a specific migration file but I want it to keep its pending status on next call of ecto_migrate.
Please, is quiet the right option to pass to the command?
Like for example:
mix ecto.migrate --quiet --to 20080906120000
And incidentally which option will allow me to run only one given migration file if there are several pending migrations?
Thanks
Marked As Solved
NobbZ
--quiet just surpresses output, or at least parts of it.
I do not think there is a way to run a migration without marking it as “done”. Also, I do not think its possible to run a single migration file out of order.
Migrations describe changes to a database schema over time.
Also Liked
cnck1387
I do this too.
As long as the app hasn’t shipped yet I just keep around a single migration file and I change it around as needed.
Another thing you might want to set up is a way to generate fake data for development. Then you can drop the db → run your single master migration file → generate new fake data in about 3 seconds once you get used to running the combo.
Kurisu
I guess I have to learn more psql commands…
Please, by any chance is there a way I can convert an Ecto migration file to pure psql command that I can paste in the psql console and execute it?
Edit: I mean I find it really easier to write Ecto queries instead of PostgreSQL ones.
NobbZ
If you have queries that you need more often than once, wrap them in a mix task, if it’s one off queries, do them on iex.
NobbZ
But that’s an invasive query, altering the schema, you should run those properly in a migration to keep track of the changes.







