Skip to content

Commit 17cc53a

Browse files
committed
Remove redundant execute_ddl calls
1 parent 154a1a8 commit 17cc53a

1 file changed

Lines changed: 0 additions & 100 deletions

File tree

‎lib/ecto/adapters/sqlite3/connection.ex‎

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,6 @@ defmodule Ecto.Adapters.SQLite3.Connection do
541541
execute_ddl({:drop, index})
542542
end
543543

544-
def execute_ddl({:drop_if_exists, %Index{concurrently: true}}) do
545-
raise ArgumentError, "`concurrently` is not supported with SQLite3"
546-
end
547-
548544
def execute_ddl({:drop_if_exists, %Index{} = index}) do
549545
[
550546
[
@@ -588,76 +584,10 @@ defmodule Ecto.Adapters.SQLite3.Connection do
588584
raise ArgumentError, "SQLite3 adapter does not support keyword lists in execute"
589585
end
590586

591-
def execute_ddl({:create, %Index{} = index}) do
592-
fields = Enum.map_intersperse(index.columns, ", ", &index_expr/1)
593-
594-
[
595-
[
596-
"CREATE ",
597-
if_do(index.unique, "UNIQUE "),
598-
"INDEX",
599-
?\s,
600-
quote_name(index.name),
601-
" ON ",
602-
quote_table(index.prefix, index.table),
603-
" (",
604-
fields,
605-
?),
606-
if_do(index.where, [" WHERE ", to_string(index.where)])
607-
]
608-
]
609-
end
610-
611-
def execute_ddl({:create_if_not_exists, %Index{} = index}) do
612-
fields = Enum.map_intersperse(index.columns, ", ", &index_expr/1)
613-
614-
[
615-
[
616-
"CREATE ",
617-
if_do(index.unique, "UNIQUE "),
618-
"INDEX IF NOT EXISTS",
619-
?\s,
620-
quote_name(index.name),
621-
" ON ",
622-
quote_table(index.prefix, index.table),
623-
" (",
624-
fields,
625-
?),
626-
if_do(index.where, [" WHERE ", to_string(index.where)])
627-
]
628-
]
629-
end
630-
631587
def execute_ddl({:create, %Constraint{}}) do
632588
raise ArgumentError, "SQLite3 does not support ALTER TABLE ADD CONSTRAINT."
633589
end
634590

635-
def execute_ddl({:drop, %Index{} = index}) do
636-
[
637-
[
638-
"DROP INDEX ",
639-
quote_table(index.prefix, index.name)
640-
]
641-
]
642-
end
643-
644-
def execute_ddl({:drop, %Index{} = index, _mode}) do
645-
execute_ddl({:drop, index})
646-
end
647-
648-
def execute_ddl({:drop_if_exists, %Index{} = index}) do
649-
[
650-
[
651-
"DROP INDEX IF EXISTS ",
652-
quote_table(index.prefix, index.name)
653-
]
654-
]
655-
end
656-
657-
def execute_ddl({:drop_if_exists, %Index{} = index, _mode}) do
658-
execute_ddl({:drop_if_exists, index})
659-
end
660-
661591
def execute_ddl({:drop, %Constraint{}, _mode}) do
662592
raise ArgumentError, "SQLite3 does not support ALTER TABLE DROP CONSTRAINT."
663593
end
@@ -666,43 +596,13 @@ defmodule Ecto.Adapters.SQLite3.Connection do
666596
raise ArgumentError, "SQLite3 does not support ALTER TABLE DROP CONSTRAINT."
667597
end
668598

669-
def execute_ddl({:rename, %Table{} = current_table, %Table{} = new_table}) do
670-
[
671-
[
672-
"ALTER TABLE ",
673-
quote_table(current_table.prefix, current_table.name),
674-
" RENAME TO ",
675-
quote_table(new_table.prefix, new_table.name)
676-
]
677-
]
678-
end
679-
680-
def execute_ddl({:rename, %Table{} = table, current_column, new_column}) do
681-
[
682-
[
683-
"ALTER TABLE ",
684-
quote_table(table.prefix, table.name),
685-
" RENAME COLUMN ",
686-
quote_name(current_column),
687-
" TO ",
688-
quote_name(new_column)
689-
]
690-
]
691-
end
692-
693599
def execute_ddl({:rename, %Index{} = index, new_index}) do
694600
[
695601
execute_ddl({:drop, index}),
696602
execute_ddl({:create, %Index{index | name: new_index}})
697603
]
698604
end
699605

700-
def execute_ddl(string) when is_binary(string), do: [string]
701-
702-
def execute_ddl(keyword) when is_list(keyword) do
703-
raise ArgumentError, "SQLite3 adapter does not support keyword lists in execute"
704-
end
705-
706606
@impl true
707607
def ddl_logs(_), do: []
708608

0 commit comments

Comments
 (0)