Skip to content

Commit

Permalink
Remove conflict_target definition matching deprecated constraint tuple (
Browse files Browse the repository at this point in the history
  • Loading branch information
quintinm-dev authored Jun 1, 2022
1 parent 4d39a6f commit 9c05d4f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 5 deletions.
2 changes: 0 additions & 2 deletions lib/ecto/adapters/postgres/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ if Code.ensure_loaded?(Postgrex) do
defp conflict_target!(target),
do: conflict_target(target)

defp conflict_target({:constraint, constraint}),
do: ["ON CONSTRAINT ", quote_name(constraint), ?\s]
defp conflict_target({:unsafe_fragment, fragment}),
do: [fragment, ?\s]
defp conflict_target([]),
Expand Down
3 changes: 0 additions & 3 deletions test/ecto/adapters/postgres_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,9 +1222,6 @@ defmodule Ecto.Adapters.PostgresTest do
query = insert(nil, "schema", [:x, :y], [[:x, :y]], {[:x, :y], [], [:id]}, [])
assert query == ~s{INSERT INTO "schema" ("x","y") VALUES ($1,$2) ON CONFLICT ("id") DO UPDATE SET "x" = EXCLUDED."x","y" = EXCLUDED."y"}

query = insert(nil, "schema", [:x, :y], [[:x, :y]], {[:x, :y], [], {:constraint, :foo}}, [])
assert query == ~s{INSERT INTO "schema" ("x","y") VALUES ($1,$2) ON CONFLICT ON CONSTRAINT \"foo\" DO UPDATE SET "x" = EXCLUDED."x","y" = EXCLUDED."y"}

query = insert(nil, "schema", [:x, :y], [[:x, :y]], {[:x, :y], [], {:unsafe_fragment, "(\"id\")"}}, [])
assert query == ~s{INSERT INTO "schema" ("x","y") VALUES ($1,$2) ON CONFLICT (\"id\") DO UPDATE SET "x" = EXCLUDED."x","y" = EXCLUDED."y"}

Expand Down

0 comments on commit 9c05d4f

Please sign in to comment.