Kurisu

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

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

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

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

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

NobbZ

But that’s an invasive query, altering the schema, you should run those properly in a migration to keep track of the changes.

Where Next?

Popular in Questions Top

jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement