@@ -4,11 +4,15 @@ defmodule Ecto.Adapters.SQLite3.DataTypeTest do
4
4
alias Ecto.Adapters.SQLite3.DataType
5
5
6
6
setup do
7
+ Application . put_env ( :ecto_sqlite3 , :array_type , :string )
7
8
Application . put_env ( :ecto_sqlite3 , :binary_id_type , :string )
9
+ Application . put_env ( :ecto_sqlite3 , :map_type , :string )
8
10
Application . put_env ( :ecto_sqlite3 , :uuid_type , :string )
9
11
10
12
on_exit ( fn ->
13
+ Application . put_env ( :ecto_sqlite3 , :array_type , :string )
11
14
Application . put_env ( :ecto_sqlite3 , :binary_id_type , :string )
15
+ Application . put_env ( :ecto_sqlite3 , :map_type , :string )
12
16
Application . put_env ( :ecto_sqlite3 , :uuid_type , :string )
13
17
end )
14
18
end
@@ -46,20 +50,36 @@ defmodule Ecto.Adapters.SQLite3.DataTypeTest do
46
50
assert DataType . column_type ( :uuid , nil ) == "BLOB"
47
51
end
48
52
49
- test ":map is TEXT" do
53
+ test ":map is TEXT or BLOB " do
50
54
assert DataType . column_type ( :map , nil ) == "TEXT"
55
+
56
+ Application . put_env ( :ecto_sqlite3 , :map_type , :binary )
57
+
58
+ assert DataType . column_type ( :map , nil ) == "BLOB"
51
59
end
52
60
53
- test "{:map, _} is TEXT" do
61
+ test "{:map, _} is TEXT or BLOB " do
54
62
assert DataType . column_type ( { :map , % { } } , nil ) == "TEXT"
63
+
64
+ Application . put_env ( :ecto_sqlite3 , :map_type , :binary )
65
+
66
+ assert DataType . column_type ( { :map , % { } } , nil ) == "BLOB"
55
67
end
56
68
57
- test ":array is TEXT" do
69
+ test ":array is TEXT or BLOB " do
58
70
assert DataType . column_type ( :array , nil ) == "TEXT"
71
+
72
+ Application . put_env ( :ecto_sqlite3 , :array_type , :binary )
73
+
74
+ assert DataType . column_type ( :array , nil ) == "BLOB"
59
75
end
60
76
61
- test "{:array, _} is TEXT" do
77
+ test "{:array, _} is TEXT or BLOB " do
62
78
assert DataType . column_type ( { :array , [ ] } , nil ) == "TEXT"
79
+
80
+ Application . put_env ( :ecto_sqlite3 , :array_type , :binary )
81
+
82
+ assert DataType . column_type ( { :array , [ ] } , nil ) == "BLOB"
63
83
end
64
84
65
85
test ":float is NUMERIC" do
0 commit comments