Skip to content

Commit 455bee6

Browse files
authored
update Ecto to v3.13 (#170)
* update Ecto to v3.13 * add identifier/1 support * link identifier/1 in changelog * pin ecto_sql to ~> 0.13.0 * drop :literal clause
1 parent a04c249 commit 455bee6

File tree

6 files changed

+26
-5
lines changed

6 files changed

+26
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is loosely based on [Keep a Changelog][keepachangelog], and this
66
project adheres to [Semantic Versioning][semver].
77

88
## Unreleased
9+
- added: Ecto [`identifier/1`](https://hexdocs.pm/ecto/Ecto.Query.API.html#identifier/1) support
10+
- changed: Bump (and restrict) Ecto to `3.13.0`
911

1012
## v0.19.0
1113
- changed: Configurable encoding for `:map` and `:array`, allowing usage of SQLite's JSONB storage format.

lib/ecto/adapters/sqlite3/connection.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ defmodule Ecto.Adapters.SQLite3.Connection do
13721372
raise ArgumentError, "SQLite3 adapter does not support values lists"
13731373
end
13741374

1375-
defp expr({:literal, _, [literal]}, _sources, _query) do
1375+
defp expr({:identifier, _, [literal]}, _sources, _query) do
13761376
quote_name(literal)
13771377
end
13781378

mix.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ defmodule EctoSQLite3.MixProject do
3535
defp deps do
3636
[
3737
{:decimal, "~> 1.6 or ~> 2.0"},
38-
{:ecto_sql, "~> 3.12"},
39-
{:ecto, "~> 3.12"},
38+
{:ecto_sql, "~> 3.13.0"},
39+
{:ecto, "~> 3.13.0"},
4040
{:exqlite, "~> 0.22"},
4141
{:ex_doc, "~> 0.27", only: [:dev], runtime: false},
4242
{:jason, ">= 0.0.0", only: [:dev, :test, :docs]},

mix.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"decimal": {:hex, :decimal, "2.3.0", "3ad6255aa77b4a3c4f818171b12d237500e63525c2fd056699967a3e7ea20f62", [:mix], [], "hexpm", "a4d66355cb29cb47c3cf30e71329e58361cfcb37c34235ef3bf1d7bf3773aeac"},
99
"deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"},
1010
"earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"},
11-
"ecto": {:hex, :ecto, "3.12.5", "4a312960ce612e17337e7cefcf9be45b95a3be6b36b6f94dfb3d8c361d631866", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "6eb18e80bef8bb57e17f5a7f068a1719fbda384d40fc37acb8eb8aeca493b6ea"},
12-
"ecto_sql": {:hex, :ecto_sql, "3.12.1", "c0d0d60e85d9ff4631f12bafa454bc392ce8b9ec83531a412c12a0d415a3a4d0", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.12", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.7", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "aff5b958a899762c5f09028c847569f7dfb9cc9d63bdb8133bff8a5546de6bf5"},
11+
"ecto": {:hex, :ecto, "3.13.1", "ebb11c2f0307ff62e8aaba57def59ad920a3cbd89d002b1118944cbf598c13c7", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d9ea5075a6f3af9cd2cdbabe8a0759eb73b485e981fd7c03014f79479ac85340"},
12+
"ecto_sql": {:hex, :ecto_sql, "3.13.0", "a732428f38ce86612a2c34a1ea5d0a9642a5a71f044052007fd2f2e815707990", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.13.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.7", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5ce13085122a0871d93ea9ba1a886447d89c07f3b563e19e0b3dcdf201ed9fe9"},
1313
"elixir_make": {:hex, :elixir_make, "0.9.0", "6484b3cd8c0cee58f09f05ecaf1a140a8c97670671a6a0e7ab4dc326c3109726", [:mix], [], "hexpm", "db23d4fd8b757462ad02f8aa73431a426fe6671c80b200d9710caf3d1dd0ffdb"},
1414
"ex_doc": {:hex, :ex_doc, "0.37.3", "f7816881a443cd77872b7d6118e8a55f547f49903aef8747dbcb345a75b462f9", [:mix], [{:earmark_parser, "~> 1.4.42", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "e6aebca7156e7c29b5da4daa17f6361205b2ae5f26e5c7d8ca0d3f7e18972233"},
1515
"exqlite": {:hex, :exqlite, "0.30.0", "92cd991fc7fcdf688718452bca5012ffa9015d333845d7661ee00c8256e80423", [:make, :mix], [{:cc_precompiler, "~> 0.1", [hex: :cc_precompiler, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.8", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "3ed5800d1ccafc220d4a2e0bc7cf2c0e2f93456f03f73856158b474e010c792c"},

test/ecto/adapters/sqlite3/connection/select_test.exs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,15 @@ defmodule Ecto.Adapters.SQLite3.Connection.SelectTest do
166166
assert ~s{SELECT s0."x" COLLATE "es_ES" FROM "schema" AS s0} == all(query)
167167
end
168168

169+
test "collating with identifier" do
170+
query =
171+
Schema
172+
|> select([r], fragment("? COLLATE ?", r.x, identifier(^"es_ES")))
173+
|> plan()
174+
175+
assert ~s{SELECT s0."x" COLLATE "es_ES" FROM "schema" AS s0} == all(query)
176+
end
177+
169178
test "fragment with a column and value specified" do
170179
value = 13
171180

test/ecto/integration/crud_test.exs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,16 @@ defmodule Ecto.Integration.CrudTest do
282282
assert account.id == account1.id
283283
end
284284

285+
test "can handle fragment identifier" do
286+
account1 = TestRepo.insert!(%Account{name: "Main"})
287+
288+
name = "name"
289+
query = from(a in Account, where: fragment("? = ?", identifier(^name), "Main"))
290+
291+
assert [account] = TestRepo.all(query)
292+
assert account.id == account1.id
293+
end
294+
285295
test "can handle selected_as" do
286296
TestRepo.insert!(%Account{name: "Main"})
287297
TestRepo.insert!(%Account{name: "Main"})

0 commit comments

Comments
 (0)