Skip to content

Commit ce12069

Browse files
authored
Make drop mode optional (#57)
* Re-enable integrations tests This was accidentally disabled after cleaning up the workflow. * Make drop mode optional Fixes #56 and prepares for future addition.
1 parent 806d849 commit ce12069

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ jobs:
5353
- run: mix deps.compile
5454
- run: mix compile
5555
- run: mix test
56+
- run: EXQLITE_INTEGRATION=true mix test --trace

lib/ecto/adapters/sqlite3/connection.ex

Lines changed: 36 additions & 6 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, _mode}) do
380+
def execute_ddl({:drop, %Table{} = table}) do
381381
[
382382
[
383383
"DROP TABLE ",
@@ -387,7 +387,12 @@ defmodule Ecto.Adapters.SQLite3.Connection do
387387
end
388388

389389
@impl true
390-
def execute_ddl({:drop_if_exists, %Table{} = table, _mode}) do
390+
def execute_ddl({:drop, %Table{} = table, _mode}) do
391+
execute_ddl({:drop, table})
392+
end
393+
394+
@impl true
395+
def execute_ddl({:drop_if_exists, %Table{} = table}) do
391396
[
392397
[
393398
"DROP TABLE IF EXISTS ",
@@ -396,6 +401,11 @@ defmodule Ecto.Adapters.SQLite3.Connection do
396401
]
397402
end
398403

404+
@impl true
405+
def execute_ddl({:drop_if_exists, %Table{} = table, _mode}) do
406+
execute_ddl({:drop_if_exists, table})
407+
end
408+
399409
@impl true
400410
def execute_ddl({:alter, %Table{} = table, changes}) do
401411
Enum.map(changes, fn change ->
@@ -449,7 +459,7 @@ defmodule Ecto.Adapters.SQLite3.Connection do
449459
end
450460

451461
@impl true
452-
def execute_ddl({:drop, %Index{} = index, _mode}) do
462+
def execute_ddl({:drop, %Index{} = index}) do
453463
[
454464
[
455465
"DROP INDEX ",
@@ -459,7 +469,12 @@ defmodule Ecto.Adapters.SQLite3.Connection do
459469
end
460470

461471
@impl true
462-
def execute_ddl({:drop_if_exists, %Index{} = index, _mode}) do
472+
def execute_ddl({:drop, %Index{} = index, _mode}) do
473+
execute_ddl({:drop, index})
474+
end
475+
476+
@impl true
477+
def execute_ddl({:drop_if_exists, %Index{} = index}) do
463478
[
464479
[
465480
"DROP INDEX IF EXISTS ",
@@ -468,6 +483,11 @@ defmodule Ecto.Adapters.SQLite3.Connection do
468483
]
469484
end
470485

486+
@impl true
487+
def execute_ddl({:drop_if_exists, %Index{} = index, _mode}) do
488+
execute_ddl({:drop_if_exists, index})
489+
end
490+
471491
@impl true
472492
def execute_ddl({:rename, %Table{} = current_table, %Table{} = new_table}) do
473493
[
@@ -552,7 +572,7 @@ defmodule Ecto.Adapters.SQLite3.Connection do
552572
end
553573

554574
@impl true
555-
def execute_ddl({:drop, %Index{} = index, _mode}) do
575+
def execute_ddl({:drop, %Index{} = index}) do
556576
[
557577
[
558578
"DROP INDEX ",
@@ -562,7 +582,12 @@ defmodule Ecto.Adapters.SQLite3.Connection do
562582
end
563583

564584
@impl true
565-
def execute_ddl({:drop_if_exists, %Index{} = index, _mode}) do
585+
def execute_ddl({:drop, %Index{} = index, _mode}) do
586+
execute_ddl({:drop, index})
587+
end
588+
589+
@impl true
590+
def execute_ddl({:drop_if_exists, %Index{} = index}) do
566591
[
567592
[
568593
"DROP INDEX IF EXISTS ",
@@ -571,6 +596,11 @@ defmodule Ecto.Adapters.SQLite3.Connection do
571596
]
572597
end
573598

599+
@impl true
600+
def execute_ddl({:drop_if_exists, %Index{} = index, _mode}) do
601+
execute_ddl({:drop_if_exists, index})
602+
end
603+
574604
@impl true
575605
def execute_ddl({:drop, %Constraint{}, _mode}) do
576606
raise ArgumentError, "SQLite3 does not support ALTER TABLE DROP CONSTRAINT."

0 commit comments

Comments
 (0)