Skip to content

Commit

Permalink
Remove dead code from storage_{up, down, status}
Browse files Browse the repository at this point in the history
`Keyword.fetch!/2` raises. The runtime error the result coalesced to wasn't
ever raised.
  • Loading branch information
v0idpwn committed Apr 15, 2024
1 parent 32113be commit 4b81ea5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
9 changes: 3 additions & 6 deletions lib/ecto/adapters/myxql.ex
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ defmodule Ecto.Adapters.MyXQL do

@impl true
def storage_up(opts) do
database =
Keyword.fetch!(opts, :database) || raise ":database is nil in repository configuration"
database = Keyword.fetch!(opts, :database)

opts = Keyword.delete(opts, :database)
charset = opts[:charset] || "utf8mb4"
Expand Down Expand Up @@ -213,8 +212,7 @@ defmodule Ecto.Adapters.MyXQL do

@impl true
def storage_down(opts) do
database =
Keyword.fetch!(opts, :database) || raise ":database is nil in repository configuration"
database = Keyword.fetch!(opts, :database)

opts = Keyword.delete(opts, :database)
command = "DROP DATABASE `#{database}`"
Expand Down Expand Up @@ -242,8 +240,7 @@ defmodule Ecto.Adapters.MyXQL do

@impl Ecto.Adapter.Storage
def storage_status(opts) do
database =
Keyword.fetch!(opts, :database) || raise ":database is nil in repository configuration"
database = Keyword.fetch!(opts, :database)

opts = Keyword.delete(opts, :database)

Expand Down
9 changes: 3 additions & 6 deletions lib/ecto/adapters/postgres.ex
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ defmodule Ecto.Adapters.Postgres do

@impl true
def storage_up(opts) do
database =
Keyword.fetch!(opts, :database) || raise ":database is nil in repository configuration"
database = Keyword.fetch!(opts, :database)

encoding = if opts[:encoding] == :unspecified, do: nil, else: opts[:encoding] || "UTF8"
maintenance_database = Keyword.get(opts, :maintenance_database, @default_maintenance_database)
Expand Down Expand Up @@ -215,8 +214,7 @@ defmodule Ecto.Adapters.Postgres do

@impl true
def storage_down(opts) do
database =
Keyword.fetch!(opts, :database) || raise ":database is nil in repository configuration"
database = Keyword.fetch!(opts, :database)

command =
"DROP DATABASE \"#{database}\""
Expand All @@ -239,8 +237,7 @@ defmodule Ecto.Adapters.Postgres do

@impl Ecto.Adapter.Storage
def storage_status(opts) do
database =
Keyword.fetch!(opts, :database) || raise ":database is nil in repository configuration"
database = Keyword.fetch!(opts, :database)

maintenance_database = Keyword.get(opts, :maintenance_database, @default_maintenance_database)
opts = Keyword.put(opts, :database, maintenance_database)
Expand Down
9 changes: 3 additions & 6 deletions lib/ecto/adapters/tds.ex
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ defmodule Ecto.Adapters.Tds do
@doc false
@impl true
def storage_up(opts) do
database =
Keyword.fetch!(opts, :database) || raise ":database is nil in repository configuration"
database = Keyword.fetch!(opts, :database)

command =
~s(CREATE DATABASE [#{database}])
Expand All @@ -197,8 +196,7 @@ defmodule Ecto.Adapters.Tds do
@doc false
@impl true
def storage_down(opts) do
database =
Keyword.fetch!(opts, :database) || raise ":database is nil in repository configuration"
database = Keyword.fetch!(opts, :database)

case run_query(Keyword.put(opts, :database, "master"), "DROP DATABASE [#{database}]") do
{:ok, _} ->
Expand All @@ -214,8 +212,7 @@ defmodule Ecto.Adapters.Tds do

@impl Ecto.Adapter.Storage
def storage_status(opts) do
database =
Keyword.fetch!(opts, :database) || raise ":database is nil in repository configuration"
database = Keyword.fetch!(opts, :database)

opts = Keyword.put(opts, :database, "master")

Expand Down

0 comments on commit 4b81ea5

Please sign in to comment.