brainlid

brainlid

New "mix release" and DB migrations

I’ve been playing with the new Elixir 1.9.0-dev branch to try out the new “releases”. Everything is working but the piece left unsolved is running DB migrations and seeds.

Previously with Distillery I did those as release tasks. I haven’t found any examples or recommended approaches to this yet.

Looking for guidance or core-team information on what the expected or recommended approach should be.

Most Liked

jola

jola

I asked that question on the mailing list and the short answer is, basically the same way you do with Distillery. Release tasks in Distillery are just custom commands, and what the guide for migrations does is a custom command that evals a function. You can do that in 1.9 releases as well. So it’s the exact same thing, except instead of

app/bin/hello migrate

you run

app/bin/hello eval "Hello.ReleaseTasks.migrate"

12
Post #2
josevalim

josevalim

Creator of Elixir

We are also adding new functions to Ecto.SQL to abstract the bureaucracy of starting new applications and repositories to run migrations in releases: Add Ecto.Migrator.with_repo/2 to start/stop apps for migrations by josevalim · Pull Request #113 · elixir-ecto/ecto_sql · GitHub

This code was already inside of Ecto.SQL, we are just making it public.

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
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
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
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
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
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

New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
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
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
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
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52341 488
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31142 143
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New

We're in Beta

About us Mission Statement