Skip to content

Commit 5448c34

Browse files
authored
Update lockfile dependencies (#53)
* Update dependencies to the latest possible versions. * Backport: Fix CTE subqueries not finding parent bindings elixir-ecto/ecto_sql@e5663b8 * Backport: Default to :restrict elixir-ecto/ecto_sql@b67cdae * Drop support for OTP 20 Telemetry does not compile for OTP20 anymore.
1 parent 0a36c0b commit 5448c34

File tree

6 files changed

+63
-47
lines changed

6 files changed

+63
-47
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- elixir: "1.10"
4343
otp: "23"
4444
- elixir: "1.8"
45-
otp: "20"
45+
otp: "21"
4646
steps:
4747
- uses: actions/checkout@v2
4848
- uses: erlef/setup-elixir@v1

CHANGELOG.md

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

88
## [Unreleased]
9+
### Changed
10+
- Update dependencies to the latest.
11+
- Drop support for OTP 20. It is not supported by `telemetry` and won't compile. For now we will just support Elixir 1.8 and OTP 21.
912

1013
## [0.6.1] - 2021-08-27
1114
### Changed

lib/ecto/adapters/sqlite3/connection.ex

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ defmodule Ecto.Adapters.SQLite3.Connection do
377377
end
378378

379379
@impl true
380-
def execute_ddl({:drop, %Table{} = table}) do
380+
def execute_ddl({:drop, %Table{} = table, _mode}) do
381381
[
382382
[
383383
"DROP TABLE ",
@@ -387,7 +387,7 @@ defmodule Ecto.Adapters.SQLite3.Connection do
387387
end
388388

389389
@impl true
390-
def execute_ddl({:drop_if_exists, %Table{} = table}) do
390+
def execute_ddl({:drop_if_exists, %Table{} = table, _mode}) do
391391
[
392392
[
393393
"DROP TABLE IF EXISTS ",
@@ -449,7 +449,7 @@ defmodule Ecto.Adapters.SQLite3.Connection do
449449
end
450450

451451
@impl true
452-
def execute_ddl({:drop, %Index{} = index}) do
452+
def execute_ddl({:drop, %Index{} = index, _mode}) do
453453
[
454454
[
455455
"DROP INDEX ",
@@ -459,7 +459,7 @@ defmodule Ecto.Adapters.SQLite3.Connection do
459459
end
460460

461461
@impl true
462-
def execute_ddl({:drop_if_exists, %Index{} = index}) do
462+
def execute_ddl({:drop_if_exists, %Index{} = index, _mode}) do
463463
[
464464
[
465465
"DROP INDEX IF EXISTS ",
@@ -552,7 +552,7 @@ defmodule Ecto.Adapters.SQLite3.Connection do
552552
end
553553

554554
@impl true
555-
def execute_ddl({:drop, %Index{} = index}) do
555+
def execute_ddl({:drop, %Index{} = index, _mode}) do
556556
[
557557
[
558558
"DROP INDEX ",
@@ -562,7 +562,7 @@ defmodule Ecto.Adapters.SQLite3.Connection do
562562
end
563563

564564
@impl true
565-
def execute_ddl({:drop_if_exists, %Index{} = index}) do
565+
def execute_ddl({:drop_if_exists, %Index{} = index, _mode}) do
566566
[
567567
[
568568
"DROP INDEX IF EXISTS ",
@@ -572,12 +572,12 @@ defmodule Ecto.Adapters.SQLite3.Connection do
572572
end
573573

574574
@impl true
575-
def execute_ddl({:drop, %Constraint{}}) do
575+
def execute_ddl({:drop, %Constraint{}, _mode}) do
576576
raise ArgumentError, "SQLite3 does not support ALTER TABLE DROP CONSTRAINT."
577577
end
578578

579579
@impl true
580-
def execute_ddl({:drop_if_exists, %Constraint{}}) do
580+
def execute_ddl({:drop_if_exists, %Constraint{}, _mode}) do
581581
raise ArgumentError, "SQLite3 does not support ALTER TABLE DROP CONSTRAINT."
582582
end
583583

@@ -834,10 +834,14 @@ defmodule Ecto.Adapters.SQLite3.Connection do
834834
]
835835
end
836836

837-
defp cte_query(%Ecto.Query{} = query, _, _), do: ["(", all(query), ")"]
837+
defp cte_query(%Ecto.Query{} = query, sources, parent_query) do
838+
query = put_in(query.aliases[@parent_as], {parent_query, sources})
839+
["(", all(query, subquery_as_prefix(sources)), ")"]
840+
end
838841

839-
defp cte_query(%QueryExpr{expr: expression}, sources, query),
840-
do: expr(expression, sources, query)
842+
defp cte_query(%QueryExpr{expr: expr}, sources, query) do
843+
expr(expr, sources, query)
844+
end
841845

842846
defp update_fields(type, %{updates: updates} = query, sources) do
843847
fields =
@@ -1131,13 +1135,11 @@ defmodule Ecto.Adapters.SQLite3.Connection do
11311135
quote_name(field)
11321136
end
11331137

1134-
def expr(
1135-
{{:., _, [{:parent_as, _, [{:&, _, [idx]}]}, field]}, _, []},
1136-
_sources,
1137-
query
1138-
)
1138+
# def expr({{:., _, [{:parent_as, _, [{:&, _, [idx]}]}, field]}, _, []}, _sources, query)
1139+
def expr({{:., _, [{:parent_as, _, [as]}, field]}, _, []}, _sources, query)
11391140
when is_atom(field) do
1140-
{_, name, _} = elem(query.aliases[@parent_as], idx)
1141+
{ix, sources} = get_parent_sources_ix(query, as)
1142+
{_, name, _} = elem(sources, ix)
11411143
[name, ?. | quote_name(field)]
11421144
end
11431145

@@ -1197,8 +1199,8 @@ defmodule Ecto.Adapters.SQLite3.Connection do
11971199
[aggregate, " FILTER (WHERE ", expr(filter, sources, query), ?)]
11981200
end
11991201

1200-
def expr(%Ecto.SubQuery{query: query}, sources, _query) do
1201-
query = put_in(query.aliases[@parent_as], sources)
1202+
def expr(%Ecto.SubQuery{query: query}, sources, parent_query) do
1203+
query = put_in(query.aliases[@parent_as], {parent_query, sources})
12021204
[?(, all(query, subquery_as_prefix(sources)), ?)]
12031205
end
12041206

@@ -1703,6 +1705,13 @@ defmodule Ecto.Adapters.SQLite3.Connection do
17031705
{expression || expr(source, sources, query), name}
17041706
end
17051707

1708+
defp get_parent_sources_ix(query, as) do
1709+
case query.aliases[@parent_as] do
1710+
{%{aliases: %{^as => ix}}, sources} -> {ix, sources}
1711+
{%{} = parent, _sources} -> get_parent_sources_ix(parent, as)
1712+
end
1713+
end
1714+
17061715
defp quote_names(names), do: intersperse_map(names, ?,, &quote_name/1)
17071716

17081717
def quote_name(name), do: quote_entity(name)

mix.exs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ defmodule EctoSQLite3.MixProject do
3434
defp deps do
3535
[
3636
{:decimal, "~> 1.6 or ~> 2.0"},
37-
{:ecto_sql, "~> 3.6"},
38-
{:ecto, "~> 3.5"},
39-
{:exqlite, "~> 0.5"},
40-
{:ex_doc, "~> 0.23.0", only: [:dev], runtime: false},
37+
{:ecto_sql, "~> 3.7"},
38+
{:ecto, "~> 3.7"},
39+
{:exqlite, "~> 0.6"},
40+
{:ex_doc, "~> 0.25.0", only: [:dev], runtime: false},
4141
{:jason, ">= 0.0.0", only: [:bench, :test, :docs]},
4242
{:temp, "~> 0.4", only: [:test]},
4343

4444
# Benchmarks
4545
{:benchee, "~> 1.0", only: :bench},
4646
{:benchee_markdown, "~> 0.2", only: :bench},
4747
{:postgrex, "~> 0.15.0", only: :bench},
48-
{:myxql, "~> 0.4.0", only: :bench}
48+
{:myxql, "~> 0.5.0", only: :bench}
4949
]
5050
end
5151

mix.lock

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55
"db_connection": {:hex, :db_connection, "2.4.0", "d04b1b73795dae60cead94189f1b8a51cc9e1f911c234cc23074017c43c031e5", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ad416c21ad9f61b3103d254a71b63696ecadb6a917b36f563921e0de00d7d7c8"},
66
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
77
"deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"},
8-
"earmark_parser": {:hex, :earmark_parser, "1.4.13", "0c98163e7d04a15feb62000e1a891489feb29f3d10cb57d4f845c405852bbef8", [:mix], [], "hexpm", "d602c26af3a0af43d2f2645613f65841657ad6efc9f0e361c3b6c06b578214ba"},
9-
"ecto": {:hex, :ecto, "3.6.1", "7bb317e3fd0179ad725069fd0fe8a28ebe48fec6282e964ea502e4deccb0bd0f", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "cbb3294a990447b19f0725488a749f8cf806374e0d9d0dffc45d61e7aeaf6553"},
10-
"ecto_sql": {:hex, :ecto_sql, "3.6.1", "8774dc3fc0ff7b6be510858b99883640f990c0736b8ab54588f9a0c91807f909", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.6.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.4.0 or ~> 0.5.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "66f35c3f2d5978b6bffebd1e6351ab8c9d6b68650d62abd1ab8d149de40e0779"},
8+
"earmark_parser": {:hex, :earmark_parser, "1.4.15", "b29e8e729f4aa4a00436580dcc2c9c5c51890613457c193cc8525c388ccb2f06", [:mix], [], "hexpm", "044523d6438ea19c1b8ec877ec221b008661d3c27e3b848f4c879f500421ca5c"},
9+
"ecto": {:hex, :ecto, "3.7.1", "a20598862351b29f80f285b21ec5297da1181c0442687f9b8329f0445d228892", [:mix], [{:decimal, "~> 1.6 or ~> 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", "d36e5b39fc479e654cffd4dbe1865d9716e4a9b6311faff799b6f90ab81b8638"},
10+
"ecto_sql": {:hex, :ecto_sql, "3.7.0", "2fcaad4ab0c8d76a5afbef078162806adbe709c04160aca58400d5cbbe8eeac6", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.4.0 or ~> 0.5.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a26135dfa1d99bf87a928c464cfa25bba6535a4fe761eefa56077a4febc60f70"},
1111
"elixir_make": {:hex, :elixir_make, "0.6.2", "7dffacd77dec4c37b39af867cedaabb0b59f6a871f89722c25b28fcd4bd70530", [:mix], [], "hexpm", "03e49eadda22526a7e5279d53321d1cced6552f344ba4e03e619063de75348d9"},
12-
"ex_doc": {:hex, :ex_doc, "0.23.0", "a069bc9b0bf8efe323ecde8c0d62afc13d308b1fa3d228b65bca5cf8703a529d", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f5e2c4702468b2fd11b10d39416ddadd2fcdd173ba2a0285ebd92c39827a5a16"},
13-
"exqlite": {:hex, :exqlite, "0.5.11", "e16601bab3f90e18d040264306668cde72c0ccc24d0a799c8d4b88b33b67e875", [:make, :mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "01cddc5cd84575b76d4ae6f9ebd7d58b37ee77cf84fa021a4f1f057136689aad"},
12+
"ex_doc": {:hex, :ex_doc, "0.25.1", "4b736fa38dc76488a937e5ef2944f5474f3eff921de771b25371345a8dc810bc", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "3200b0a69ddb2028365281fbef3753ea9e728683863d8cdaa96580925c891f67"},
13+
"exqlite": {:hex, :exqlite, "0.6.3", "379907bca7474ae6665f59423e8a2796f086864892cdc60914dd1c78d762df38", [:make, :mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "9ccd7dcf92cfcde4b3396f444986430e31e565e6cdb982f452044d7118f0f003"},
1414
"jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
1515
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},
1616
"makeup_elixir": {:hex, :makeup_elixir, "0.15.1", "b5888c880d17d1cc3e598f05cdb5b5a91b7b17ac4eaf5f297cb697663a1094dd", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "db68c173234b07ab2a07f645a5acdc117b9f99d69ebf521821d89690ae6c6ec8"},
17-
"myxql": {:hex, :myxql, "0.4.5", "49784e6a3e4fc33088cc9004948ef255ee698b0d7b533fb1fa453cc99a3f9972", [:mix], [{:db_connection, "~> 2.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:geo, "~> 3.3", [hex: :geo, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "40a6166ab0a54f44a6e2c437aed6360ce51ce7f779557ae30d1cc4c4b4e7ad13"},
17+
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
18+
"myxql": {:hex, :myxql, "0.5.1", "42cc502f9f373eeebfe6753266c0b601c01a6a96e4d861d429a4952ffb396689", [:mix], [{:db_connection, "~> 2.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:geo, "~> 3.3", [hex: :geo, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "73c6b684ae119ef9707a755f185f1410ec611ee748e54b9b1b1ff4aab4bc48d7"},
1819
"nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"},
19-
"postgrex": {:hex, :postgrex, "0.15.9", "46f8fe6f25711aeb861c4d0ae09780facfdf3adbd2fb5594ead61504dd489bda", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "610719103e4cb2223d4ab78f9f0f3e720320eeca6011415ab4137ddef730adee"},
20-
"telemetry": {:hex, :telemetry, "0.4.3", "a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818", [:rebar3], [], "hexpm", "eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041"},
20+
"postgrex": {:hex, :postgrex, "0.15.10", "2809dee1b1d76f7cbabe570b2a9285c2e7b41be60cf792f5f2804a54b838a067", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "1560ca427542f6b213f8e281633ae1a3b31cdbcd84ebd7f50628765b8f6132be"},
21+
"telemetry": {:hex, :telemetry, "1.0.0", "0f453a102cdf13d506b7c0ab158324c337c41f1cc7548f0bc0e130bbf0ae9452", [:rebar3], [], "hexpm", "73bc09fa59b4a0284efb4624335583c528e07ec9ae76aca96ea0673850aec57a"},
2122
"temp": {:hex, :temp, "0.4.7", "2c78482cc2294020a4bc0c95950b907ff386523367d4e63308a252feffbea9f2", [:mix], [], "hexpm", "6af19e7d6a85a427478be1021574d1ae2a1e1b90882586f06bde76c63cd03e0d"},
2223
}

test/ecto/adapters/sqlite3/connection_test.exs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
235235
assert all(query) ==
236236
"""
237237
WITH RECURSIVE "tree" AS \
238-
(SELECT c0."id" AS "id", 1 AS "depth" FROM "categories" AS c0 WHERE (c0."parent_id" IS NULL) \
238+
(SELECT sc0."id" AS "id", 1 AS "depth" FROM "categories" AS sc0 WHERE (sc0."parent_id" IS NULL) \
239239
UNION ALL \
240240
SELECT c0."id", t1."depth" + 1 FROM "categories" AS c0 \
241241
INNER JOIN "tree" AS t1 ON t1."id" = c0."parent_id") \
@@ -270,8 +270,8 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
270270
assert all(query) ==
271271
"""
272272
WITH "comments_scope" AS (\
273-
SELECT c0."entity_id" AS "entity_id", c0."text" AS "text" \
274-
FROM "comments" AS c0 WHERE (c0."deleted_at" IS NULL)) \
273+
SELECT sc0."entity_id" AS "entity_id", sc0."text" AS "text" \
274+
FROM "comments" AS sc0 WHERE (sc0."deleted_at" IS NULL)) \
275275
SELECT p0."title", c1."text" \
276276
FROM "posts" AS p0 \
277277
INNER JOIN "comments_scope" AS c1 ON c1."entity_id" = p0."guid" \
@@ -325,7 +325,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
325325
assert update_all(query) ==
326326
"""
327327
WITH "target_rows" AS \
328-
(SELECT s0."id" AS "id" FROM "schema" AS s0 ORDER BY s0."id" LIMIT 10) \
328+
(SELECT ss0."id" AS "id" FROM "schema" AS ss0 ORDER BY ss0."id" LIMIT 10) \
329329
UPDATE "schema" AS s0 \
330330
SET "x" = 123 \
331331
FROM "target_rows" AS t1 \
@@ -346,7 +346,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
346346
assert delete_all(query) ==
347347
"""
348348
WITH "target_rows" AS \
349-
(SELECT s0."id" AS "id" FROM "schema" AS s0 ORDER BY s0."id" LIMIT 10) \
349+
(SELECT ss0."id" AS "id" FROM "schema" AS ss0 ORDER BY ss0."id" LIMIT 10) \
350350
DELETE \
351351
FROM "schema" AS s0\
352352
"""
@@ -1208,7 +1208,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
12081208

12091209
assert all(query) ==
12101210
"""
1211-
WITH "cte1" AS (SELECT s0."id" AS "id", ? AS "smth" FROM "schema1" AS s0 WHERE (?)), \
1211+
WITH "cte1" AS (SELECT ss0."id" AS "id", ? AS "smth" FROM "schema1" AS ss0 WHERE (?)), \
12121212
"cte2" AS (SELECT * FROM schema WHERE ?) \
12131213
SELECT s0."id", ? FROM "schema" AS s0 INNER JOIN "schema2" AS s1 ON ? \
12141214
INNER JOIN "schema2" AS s2 ON ? WHERE (?) AND (?) \
@@ -2381,13 +2381,13 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
23812381
end
23822382

23832383
test "drop table" do
2384-
drop = {:drop, table(:posts)}
2384+
drop = {:drop, table(:posts), :restrict}
23852385

23862386
assert execute_ddl(drop) == [~s|DROP TABLE "posts"|]
23872387
end
23882388

23892389
test "drop table with prefixes" do
2390-
drop = {:drop, table(:posts, prefix: :foo)}
2390+
drop = {:drop, table(:posts, prefix: :foo), :restrict}
23912391

23922392
assert execute_ddl(drop) == [~s|DROP TABLE "foo"."posts"|]
23932393
end
@@ -2398,7 +2398,8 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
23982398
~r/SQLite3 does not support ALTER TABLE DROP CONSTRAINT./,
23992399
fn ->
24002400
execute_ddl(
2401-
{:drop, constraint(:products, "price_must_be_positive", prefix: :foo)}
2401+
{:drop, constraint(:products, "price_must_be_positive", prefix: :foo),
2402+
:restrict}
24022403
)
24032404
end
24042405
)
@@ -2411,7 +2412,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
24112412
fn ->
24122413
execute_ddl(
24132414
{:drop_if_exists,
2414-
constraint(:products, "price_must_be_positive", prefix: :foo)}
2415+
constraint(:products, "price_must_be_positive", prefix: :foo), :restrict}
24152416
)
24162417
end
24172418
)
@@ -2656,23 +2657,25 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
26562657
end
26572658

26582659
test "drop index" do
2659-
drop = {:drop, index(:posts, [:id], name: "posts$main")}
2660+
drop = {:drop, index(:posts, [:id], name: "posts$main"), :restrict}
26602661
assert execute_ddl(drop) == [~s|DROP INDEX "posts$main"|]
26612662
end
26622663

26632664
test "drop index with prefix" do
2664-
drop = {:drop, index(:posts, [:id], name: "posts$main", prefix: :foo)}
2665+
drop = {:drop, index(:posts, [:id], name: "posts$main", prefix: :foo), :restrict}
26652666
assert execute_ddl(drop) == [~s|DROP INDEX "foo"."posts$main"|]
26662667
end
26672668

26682669
test "drop index if exists" do
2669-
drop = {:drop_if_exists, index(:posts, [:id], name: "posts$main")}
2670+
drop = {:drop_if_exists, index(:posts, [:id], name: "posts$main"), :restrict}
26702671
assert execute_ddl(drop) == [~s|DROP INDEX IF EXISTS "posts$main"|]
26712672
end
26722673

26732674
test "drop index concurrently" do
26742675
# NOTE: SQLite doesn't support CONCURRENTLY, so this isn't included in generated SQL.
2675-
drop = {:drop, index(:posts, [:id], name: "posts$main", concurrently: true)}
2676+
drop =
2677+
{:drop, index(:posts, [:id], name: "posts$main", concurrently: true), :restrict}
2678+
26762679
assert execute_ddl(drop) == [~s|DROP INDEX "posts$main"|]
26772680
end
26782681

0 commit comments

Comments
 (0)