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.

Where Next?

Popular in Questions Top

9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
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
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
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
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
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
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement