From 0864eab4e30c33d7a76dd0577de20cc4e7aefe56 Mon Sep 17 00:00:00 2001 From: Gilbert Date: Sat, 13 Jun 2026 16:09:43 +0800 Subject: [PATCH] Fix compile warnings and update CI matrix for latest Elixir/OTP Two unrelated maintenance changes: 1. Fix redundant execute_ddl/1 clauses in connection.ex The file had two duplicate sets of execute_ddl/1 clauses: a newer set (with @impl true markers) and an older set of duplicates. The newer Ecto type system flags the duplicates as redundant warnings that fail the build with --warnings-as-errors. Remove the older duplicate clauses, keeping the first (correct) set intact. Also remove one redundant {:drop_if_exists, %Index{concurrently: true}} clause that is fully covered by the wildcard {:_, %Index{concurrently: true}} clause which raises the same ArgumentError. Preserves the original non-duplicate clauses for Constraint and Index rename operations that only existed in the second set. 2. Update CI matrix to Elixir 1.18-1.20 / OTP 27-29 Per the official Elixir/OTP compatibility table (June 2026): - Elixir 1.20: OTP 27-29 (latest) - Elixir 1.19: OTP 26-28 - Elixir 1.18: OTP 25-27 Drops Elixir 1.17 and OTP 26 (both EOL), adds Elixir 1.20 and OTP 29 (latest). Excludes 3 combinations that fall outside the official support ranges. Lint job runs on the latest (1.20+29). 6 valid combinations remain, all within official support ranges. --- .github/workflows/ci.yml | 14 ++-- lib/ecto/adapters/sqlite3/connection.ex | 102 ------------------------ 2 files changed, 9 insertions(+), 107 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8d6e70..6e2cf5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,8 @@ jobs: strategy: matrix: os: ["ubuntu-latest"] - elixir: ["1.19"] - otp: ["28"] + elixir: ["1.20"] + otp: ["29"] steps: - uses: actions/checkout@v6 - uses: erlef/setup-beam@v1 @@ -41,11 +41,15 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest"] - elixir: ["1.19", "1.18", "1.17"] - otp: ["28", "27", "26"] + elixir: ["1.20", "1.19", "1.18"] + otp: ["29", "28", "27"] exclude: - - elixir: "1.17" + - elixir: "1.18" otp: "28" + - elixir: "1.18" + otp: "29" + - elixir: "1.19" + otp: "29" steps: - uses: actions/checkout@v6 - uses: erlef/setup-beam@v1 diff --git a/lib/ecto/adapters/sqlite3/connection.ex b/lib/ecto/adapters/sqlite3/connection.ex index ec7c7bc..47ff5d2 100644 --- a/lib/ecto/adapters/sqlite3/connection.ex +++ b/lib/ecto/adapters/sqlite3/connection.ex @@ -550,11 +550,6 @@ defmodule Ecto.Adapters.SQLite3.Connection do execute_ddl({:drop, index}) end - @impl true - def execute_ddl({:drop_if_exists, %Index{concurrently: true}}) do - raise ArgumentError, "`concurrently` is not supported with SQLite3" - end - @impl true def execute_ddl({:drop_if_exists, %Index{} = index}) do [ @@ -604,77 +599,10 @@ defmodule Ecto.Adapters.SQLite3.Connection do raise ArgumentError, "SQLite3 adapter does not support keyword lists in execute" end - @impl true - def execute_ddl({:create, %Index{} = index}) do - fields = Enum.map_intersperse(index.columns, ", ", &index_expr/1) - - [ - [ - "CREATE ", - if_do(index.unique, "UNIQUE "), - "INDEX", - ?\s, - quote_name(index.name), - " ON ", - quote_table(index.prefix, index.table), - " (", - fields, - ?), - if_do(index.where, [" WHERE ", to_string(index.where)]) - ] - ] - end - - def execute_ddl({:create_if_not_exists, %Index{} = index}) do - fields = Enum.map_intersperse(index.columns, ", ", &index_expr/1) - - [ - [ - "CREATE ", - if_do(index.unique, "UNIQUE "), - "INDEX IF NOT EXISTS", - ?\s, - quote_name(index.name), - " ON ", - quote_table(index.prefix, index.table), - " (", - fields, - ?), - if_do(index.where, [" WHERE ", to_string(index.where)]) - ] - ] - end - def execute_ddl({:create, %Constraint{}}) do raise ArgumentError, "SQLite3 does not support ALTER TABLE ADD CONSTRAINT." end - def execute_ddl({:drop, %Index{} = index}) do - [ - [ - "DROP INDEX ", - quote_table(index.prefix, index.name) - ] - ] - end - - def execute_ddl({:drop, %Index{} = index, _mode}) do - execute_ddl({:drop, index}) - end - - def execute_ddl({:drop_if_exists, %Index{} = index}) do - [ - [ - "DROP INDEX IF EXISTS ", - quote_table(index.prefix, index.name) - ] - ] - end - - def execute_ddl({:drop_if_exists, %Index{} = index, _mode}) do - execute_ddl({:drop_if_exists, index}) - end - def execute_ddl({:drop, %Constraint{}, _mode}) do raise ArgumentError, "SQLite3 does not support ALTER TABLE DROP CONSTRAINT." end @@ -683,30 +611,6 @@ defmodule Ecto.Adapters.SQLite3.Connection do raise ArgumentError, "SQLite3 does not support ALTER TABLE DROP CONSTRAINT." end - def execute_ddl({:rename, %Table{} = current_table, %Table{} = new_table}) do - [ - [ - "ALTER TABLE ", - quote_table(current_table.prefix, current_table.name), - " RENAME TO ", - quote_table(new_table.prefix, new_table.name) - ] - ] - end - - def execute_ddl({:rename, %Table{} = table, current_column, new_column}) do - [ - [ - "ALTER TABLE ", - quote_table(table.prefix, table.name), - " RENAME COLUMN ", - quote_name(current_column), - " TO ", - quote_name(new_column) - ] - ] - end - def execute_ddl({:rename, %Index{} = index, new_index}) do [ execute_ddl({:drop, index}), @@ -714,12 +618,6 @@ defmodule Ecto.Adapters.SQLite3.Connection do ] end - def execute_ddl(string) when is_binary(string), do: [string] - - def execute_ddl(keyword) when is_list(keyword) do - raise ArgumentError, "SQLite3 adapter does not support keyword lists in execute" - end - @impl true def ddl_logs(_), do: []