From 1dce1975b23512329139aa96acb8258eafd9aed0 Mon Sep 17 00:00:00 2001 From: Maarten Jacobs Date: Fri, 26 Oct 2018 22:48:46 +0200 Subject: [PATCH] Prepare for upgrade to Ecto 3.0 (#60) * upgrade to ecto 3.x * apply change in syntax for bindings * set Sandbox mode for sql adapter in tests to shared * update deps and pin postgrex in order to prevent version collision in db_connection --- lib/scrivener/paginater/ecto/query.ex | 2 +- mix.exs | 4 ++-- mix.lock | 17 +++++++---------- test/test_helper.exs | 1 + 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/scrivener/paginater/ecto/query.ex b/lib/scrivener/paginater/ecto/query.ex index 53b1eb5..0f9d4a7 100644 --- a/lib/scrivener/paginater/ecto/query.ex +++ b/lib/scrivener/paginater/ecto/query.ex @@ -63,7 +63,7 @@ defimpl Scrivener.Paginater, for: Ecto.Query do ) do query |> exclude(:select) - |> select([x: source_index], struct(x, ^[field])) + |> select([{x, source_index}], struct(x, ^[field])) end defp prepare_select(query) do diff --git a/mix.exs b/mix.exs index df6ac11..8d91470 100644 --- a/mix.exs +++ b/mix.exs @@ -42,11 +42,11 @@ defmodule Scrivener.Ecto.Mixfile do defp deps do [ {:scrivener, "~> 2.4"}, - {:ecto, "~> 2.0"}, + {:ecto, git: "https://github.com/elixir-ecto/ecto.git"}, {:dialyxir, "~> 0.5.0", only: :dev}, {:earmark, ">= 0.0.0", only: :dev}, {:ex_doc, "~> 0.18.0", only: :dev}, - {:postgrex, "~> 0.11.0 or ~> 0.12.0 or ~> 0.13.0", optional: true} + {:postgrex, "~> 0.14.0-dev", github: "elixir-ecto/postgrex", ref: "6cabc3b"} ] end diff --git a/mix.lock b/mix.lock index 585ef76..a8fb6a7 100644 --- a/mix.lock +++ b/mix.lock @@ -1,14 +1,11 @@ %{ "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm"}, - "db_connection": {:hex, :db_connection, "1.1.3", "89b30ca1ef0a3b469b1c779579590688561d586694a3ce8792985d4d7e575a61", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"}, - "decimal": {:hex, :decimal, "1.4.1", "ad9e501edf7322f122f7fc151cce7c2a0c9ada96f2b0155b8a09a795c2029770", [:mix], [], "hexpm"}, + "db_connection": {:git, "https://github.com/elixir-ecto/db_connection.git", "854d917721b820576da4b74b3620bf359c61179f", [ref: "854d917"]}, + "decimal": {:hex, :decimal, "1.5.0", "b0433a36d0e2430e3d50291b1c65f53c37d56f83665b43d79963684865beab68", [:mix], [], "hexpm"}, "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"}, - "dialyze": {:hex, :dialyze, "0.2.1"}, - "earmark": {:hex, :earmark, "1.2.4", "99b637c62a4d65a20a9fb674b8cffb8baa771c04605a80c911c4418c69b75439", [:mix], [], "hexpm"}, - "ecto": {:hex, :ecto, "2.2.8", "a4463c0928b970f2cee722cd29aaac154e866a15882c5737e0038bbfcf03ec2c", [:mix], [{:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"}, - "ex_doc": {:hex, :ex_doc, "0.18.1", "37c69d2ef62f24928c1f4fdc7c724ea04aecfdf500c4329185f8e3649c915baf", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"}, - "ex_spec": {:hex, :ex_spec, "1.0.0", "b1e791072fecbf80c725adf45e7cbdf3d96af3765638a1f1547824706ece4bc9", [:mix], []}, - "poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [:rebar], [], "hexpm"}, - "postgrex": {:hex, :postgrex, "0.13.3", "c277cfb2a9c5034d445a722494c13359e361d344ef6f25d604c2353185682bfc", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm"}, - "scrivener": {:hex, :scrivener, "2.4.0", "c9431804b13ac6a5c4b01eb32188c1ff926898a2d684244d021706841f022e66", [:mix], [], "hexpm"}, + "earmark": {:hex, :earmark, "1.2.6", "b6da42b3831458d3ecc57314dff3051b080b9b2be88c2e5aa41cd642a5b044ed", [:mix], [], "hexpm"}, + "ecto": {:git, "https://github.com/elixir-ecto/ecto.git", "bba34c5ba218537bf196630179e4934946ab94e0", []}, + "ex_doc": {:hex, :ex_doc, "0.18.4", "4406b8891cecf1352f49975c6d554e62e4341ceb41b9338949077b0d4a97b949", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"}, + "postgrex": {:git, "https://github.com/elixir-ecto/postgrex.git", "6cabc3b018cabc6e036e7d162414889a20785b96", [ref: "6cabc3b"]}, + "scrivener": {:hex, :scrivener, "2.5.0", "e1f78c62b6806d91cc9c4778deef1ea4e80aa9fadfce2c16831afe0468cc8a2c", [:mix], [], "hexpm"}, } diff --git a/test/test_helper.exs b/test/test_helper.exs index 17627d6..f19721c 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -10,6 +10,7 @@ defmodule Scrivener.Ecto.TestCase do setup do :ok = Ecto.Adapters.SQL.Sandbox.checkout(Scrivener.Ecto.Repo) + Ecto.Adapters.SQL.Sandbox.mode(Scrivener.Ecto.Repo, {:shared, self()}) end end