Skip to content

Commit b6bd734

Browse files
authored
Merge pull request #7 from AlexKovalevych/fix-ecto-migrate
Fix ecto migrate
2 parents 0b61b46 + cad75d1 commit b6bd734

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

lib/mongo_ecto.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ defmodule Mongo.Ecto do
422422
{_, opts} = repo.__pool__
423423
with {:ok, pool} <- DBConnection.ensure_all_started(opts, type),
424424
{:ok, mongo} <- Application.ensure_all_started(:mongodb, type),
425-
do: {:ok, pool ++ [mongo]}
425+
do: {:ok, pool ++ mongo}
426426
end
427427

428428
@doc false

lib/mongo_ecto/connection.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@ defmodule Mongo.Ecto.Connection do
1313
def storage_down(opts) do
1414
opts = Keyword.put(opts, :pool, DBConnection.Connection)
1515

16+
{:ok, pid} = case Application.ensure_started(:mongodb) do
17+
:ok -> {:ok, nil}
18+
{:error, reason} -> Mongo.App.start(nil, nil)
19+
pid -> pid
20+
end
1621
{:ok, conn} = Mongo.start_link(opts)
1722

1823
try do
1924
Mongo.command!(conn, dropDatabase: 1)
2025
:ok
2126
after
27+
if pid, do: Supervisor.stop(pid)
2228
GenServer.stop(conn)
2329
end
2430
end

0 commit comments

Comments
 (0)