Database not migrated

I just pulled the latest Docker container from dockerhub and am getting

2018-03-15 11:38:18Crash dump is being written to: erl_crash.dump...done
2018-03-15 11:38:15{"Kernel pid terminated",application_controller,"{application_start_failure,bors,{{shutdown,{failed_to_start_child,'Elixir.BorsNG.Worker.Batcher.Registry',{#{'__exception__' => true,'__struct__' => 'Elixir.Postgrex.Error',connection_id => 16532,message => nil,postgres => #{code => undefined_column,file => <<\"parse_relation.c\">>,line => <<\"3293\">>,message => <<\"column p0.auto_reviewer_required_perm does not exist\">>,pg_code => <<\"42703\">>,position => <<\"181\">>,routine => <<\"errorMissingColumn\">>,severity => <<\"ERROR\">>,unknown => <<\"ERROR\">>}},[{'Elixir.Ecto.Adapters.SQL',execute_and_cache,7,[{file,\"lib/ecto/adapters/sql.ex\"},{line,431}]},{'Elixir.Ecto.Repo.Queryable',execute,5,[{file,\"lib/ecto/repo/queryable.ex\"},{line,133}]},{'Elixir.Ecto.Repo.Queryable',all,4,[{file,\"lib/ecto/repo/queryable.ex\"},{line,37}]},{'Elixir.BorsNG.Worker.Batcher.Registry',init,1,[{file,\"lib/worker/batcher/registry.ex\"},{line,36}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,247}]}]}}},{'Elixir.BorsNG.Application',start,[normal,[]]}}}"}
2018-03-15 11:38:15Kernel pid terminated (application_controller) ({application_start_failure,bors,{{shutdown,{failed_to_start_child,'Elixir.BorsNG.Worker.Batcher.Registry',{#{'__exception__' => true,'__struct__' => 'El
2018-03-15 11:38:15
2018-03-15 11:38:1410:38:14.056 [info] Application bors exited: BorsNG.Application.start(:normal, []) returned an error: shutdown: failed to start child: BorsNG.Worker.Batcher.Registry
2018-03-15 11:38:14 ** (EXIT) an exception was raised:
2018-03-15 11:38:14 ** (Postgrex.Error) ERROR 42703 (undefined_column): column p0.auto_reviewer_required_perm does not exist
2018-03-15 11:38:14 (ecto) lib/ecto/adapters/sql.ex:431: Ecto.Adapters.SQL.execute_and_cache/7
2018-03-15 11:38:14 (ecto) lib/ecto/repo/queryable.ex:133: Ecto.Repo.Queryable.execute/5
2018-03-15 11:38:14 (ecto) lib/ecto/repo/queryable.ex:37: Ecto.Repo.Queryable.all/4
2018-03-15 11:38:14 (bors) lib/worker/batcher/registry.ex:36: BorsNG.Worker.Batcher.Registry.init/1
2018-03-15 11:38:14 (stdlib) gen_server.erl:328: :gen_server.init_it/6
2018-03-15 11:38:14 (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
2018-03-15 11:37:50+ exec ./bors/bin/bors foreground

I guess it looks like the database migration ran properly. I’ve also tried explicitly setting DATABASE_AUTO_MIGRATE=true to no avail. Any input appreciated!

Cheers,
Jens

Does anything happen when you try to run the migration manually? Like:

docker run -e [...] borsng/bors-ng:latest /app/bors/bin/bors migrate

CC @danielkza

I am having the same issue trying to run docker run -e [env variables] borsng/bors-ng:latest /app/bors/bin/bors migrate. I am running the command locally, connecting to a docker postgres 10.3-alpine database. The connection to the DB works, but the migration does not happen, whether I specify DATABASE_AUTO_MIGRATE=true or not. I do not set a specific version of Elixir.

    + exec /app/bors/bin/bors migrate
15:02:51.655 [info] Application bors exited: BorsNG.Application.start(:normal, []) returned an error: shutdown: failed to start child: BorsNG.Worker.Batcher.Registry
    ** (EXIT) an exception was raised:
        ** (Postgrex.Error) ERROR 42P01 (undefined_table): relation "projects" does not exist
            (ecto) lib/ecto/adapters/sql.ex:431: Ecto.Adapters.SQL.execute_and_cache/7
            (ecto) lib/ecto/repo/queryable.ex:133: Ecto.Repo.Queryable.execute/5
            (ecto) lib/ecto/repo/queryable.ex:37: Ecto.Repo.Queryable.all/4
            (bors) lib/worker/batcher/registry.ex:36: BorsNG.Worker.Batcher.Registry.init/1
            (stdlib) gen_server.erl:328: :gen_server.init_it/6
            (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
1 Like

That error is perfect. Thanks, @vathanalen!

I’ve just reproduced it locally, and put together PR #367.

Super awesome, I confirm the database is migrated correctly. Thanks for the quick fix! @notriddle

1 Like

Excellent. I can also confirm that the fix worked. Thanks!

1 Like