brajnacs

brajnacs

Ecto Migration Can't be executed, Migration name is duplicated

Hi Everyone,

I am using Phoenix for a game application and while everything works great I am stuck with this one issue with Ecto migrations.

When running migrations no matter if the database is empty or not, it throws the following error.

(Ecto.MigrationError) migrations can’t be executed, migration name create_users is duplicated (ecto_sql) lib/ecto/migrator.ex:572: Ecto.Migrator.ensure_no_duplication!/1 (ecto_sql) lib/ecto/migrator.ex:414: Ecto.Migrator.run/4 (ecto_sql) lib/ecto/migrator.ex:142: Ecto.Migrator.with_repo/3 (game_of_fortune) lib/game_of_fortune/release.ex:10: anonymous fn/2 in GameOfFortune.Release.migrate/0 (elixir) lib/enum.ex:1948: Enum.“-reduce/3-lists^foldl/2-0-”/3 (game_of_fortune) lib/game_of_fortune/release.ex:9: GameOfFortune.Release.migrate/0 (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6 Build step ‘Execute shell’ marked build as failure Finished: FAILURE

I am running the migration from the release as defined in Phoenix deployment documentation.

I tried doing the same on my MacBook and it just works fine. There are no duplicate migrations in code. Its not working on ubuntu machine. I am building the release in a docker image.

PS - The local version of Postgres on Macbook is 11.5, while on the Ubuntu server its 9.5.19

Marked As Solved

brajnacs

brajnacs

Thanks for your help,

This turned out to be a completely different problem. After building release in a container, our devops team rsync that to a different server and they ran rsync in incremental mode, so an old file was a leftover from a previous rsync.

Thank you very much for helping me out.

Also Liked

wolfiton

wolfiton

Doesn’t pow create a migration on it’s own, when you run mix pow.install?

Confirmed it from the pow docs

Excerpt from the docs

mix pow.install

This will add the following files to your app:

LIB_PATH/users/user.ex
**PRIV_PATH/repo/migrations/TIMESTAMP_create_user.ex**

It will generate a migration: PRIV_PATH/repo/migrations/TIMESTAMP_create_user.ex so here is your duplicate in your migration.
https://hexdocs.pm/pow/README.html

I hope that your problem is solved now.

hauleth

hauleth

Could you provide list of all migrations? ls -1 priv/repo/

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
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
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 fore...
New
nobody
How to bind a phoenix app to a specific ip address? could not find anything about that, nowhere, unfortunately, but for me this is qui...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "eq...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

Other popular topics Top

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
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30840 112
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
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
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
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 126226 1237
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

We're in Beta

About us Mission Statement