Skip to content

Commit 0b9c490

Browse files
committed
Add missing column type map :date to TEXT
1 parent f478b38 commit 0b9c490

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/ecto/adapters/sqlite3/codec.ex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ defmodule Ecto.Adapters.SQLite3.Codec do
6868
end
6969
end
7070

71+
def date_encode(val), do: date_encode(val, :iso8601)
72+
73+
def date_encode(val, :iso8601) do
74+
case Date.to_iso8601(val) do
75+
date when is_bitstring(date) -> {:ok, date}
76+
_ -> :error
77+
end
78+
end
79+
7180
def time_decode(nil), do: {:ok, nil}
7281

7382
def time_decode(value) do

lib/ecto/adapters/sqlite3/data_type.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ defmodule Ecto.Adapters.SQLite3.DataType do
2020
def column_type(:array, _opts), do: "TEXT"
2121
def column_type({:map, _}, _opts), do: "TEXT"
2222
def column_type({:array, _}, _opts), do: "TEXT"
23+
def column_type(:date, _opts), do: "TEXT"
2324
def column_type(:utc_datetime, _opts), do: "TEXT"
2425
def column_type(:utc_datetime_usec, _opts), do: "TEXT"
2526
def column_type(:naive_datetime, _opts), do: "TEXT"

0 commit comments

Comments
 (0)