Skip to content

Commit 0ddc2bd

Browse files
authored
Fix various issues with ecto 3.12 (#147)
* Make expr function private * Support column type integer * Bump locked dependencies * Fix issue ByExpr closes: #146 * Swap in `Enum.map_intersperse/3` * Tag constraint test to keep with upstream * SQLite doesn't suffer from this issue anymore * Simplify default_expr to no longer consider type * Fix integration test setup
1 parent 802fbf6 commit 0ddc2bd

File tree

6 files changed

+223
-214
lines changed

6 files changed

+223
-214
lines changed

integration_test/constraints_test.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ defmodule Ecto.Integration.ConstraintsTest do
3939
:ok
4040
end
4141

42+
@tag :create_constraint
4243
test "check constraint" do
4344
changeset = Ecto.Changeset.change(%Constraint{}, fromm: 0, too: 10)
4445
{:ok, _} = PoolRepo.insert(changeset)

integration_test/test_helper.exs

Lines changed: 80 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,85 @@ _ = Ecto.Adapters.SQLite3.storage_down(PoolRepo.config())
5757
{:ok, _} = TestRepo.start_link()
5858
{:ok, _pid} = PoolRepo.start_link()
5959

60+
excludes = [
61+
:delete_with_join,
62+
:right_join,
63+
64+
# SQLite does not have an array type
65+
:array_type,
66+
:transaction_isolation,
67+
:insert_cell_wise_defaults,
68+
:insert_select,
69+
70+
# sqlite does not support microsecond precision, only millisecond
71+
:microsecond_precision,
72+
73+
# sqlite supports FKs, but does not return sufficient data
74+
# for ecto to support matching on a given constraint violation name
75+
# which is what most of the tests validate
76+
:foreign_key_constraint,
77+
78+
# SQLite with DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1
79+
# does not support using LIKE on BLOB types
80+
:like_match_blob,
81+
82+
# SQLite will return a string for schemaless map types as
83+
# Ecto does not have enough information to call the associated loader
84+
# that converts the string JSON representaiton into a map
85+
:map_type_schemaless,
86+
87+
# right now in lock_for_migrations() we do effectively nothing, this is because
88+
# SQLite is single-writer so there isn't really a need for us to do anything.
89+
# ecto assumes all implementing adapters need >=2 connections for migrations
90+
# which is not true for SQLite
91+
:lock_for_migrations,
92+
93+
# Migration we don't support
94+
:prefix,
95+
:add_column_if_not_exists,
96+
:remove_column_if_exists,
97+
:alter_primary_key,
98+
:alter_foreign_key,
99+
:assigns_id_type,
100+
:modify_column,
101+
:restrict,
102+
103+
# SQLite3 does not support the concat function
104+
:concat,
105+
106+
# SQLite3 does not support placeholders
107+
:placeholders,
108+
109+
# SQLite3 stores booleans as integers, causing Ecto's json_extract_path tests to fail
110+
:json_extract_path,
111+
112+
# SQLite3 doesn't support specifying columns for ON DELETE SET NULL
113+
:on_delete_nilify_column_list,
114+
115+
# not sure how to support this yet
116+
:bitstring_type,
117+
118+
# sqlite does not have a duration type... yet
119+
:duration_type,
120+
121+
# We don't support selected_as
122+
:selected_as_with_group_by,
123+
:selected_as_with_order_by,
124+
:selected_as_with_order_by_expression,
125+
:selected_as_with_having,
126+
127+
# Distinct with options not supported
128+
:distinct_count,
129+
130+
# SQLite does not support anything except a single column in DISTINCT
131+
:multicolumn_distinct,
132+
133+
# Values list
134+
:values_list
135+
]
136+
137+
ExUnit.configure(exclude: excludes)
138+
60139
# migrate the pool repo
61140
case Ecto.Migrator.migrated_versions(PoolRepo) do
62141
[] ->
@@ -71,64 +150,4 @@ end
71150
Ecto.Adapters.SQL.Sandbox.mode(TestRepo, :manual)
72151
Process.flag(:trap_exit, true)
73152

74-
ExUnit.start(
75-
exclude: [
76-
:delete_with_join,
77-
:right_join,
78-
# SQLite does not have an array type
79-
:array_type,
80-
:transaction_isolation,
81-
:insert_cell_wise_defaults,
82-
:insert_select,
83-
# sqlite does not support microsecond precision, only millisecond
84-
:microsecond_precision,
85-
# sqlite supports FKs, but does not return sufficient data
86-
# for ecto to support matching on a given constraint violation name
87-
# which is what most of the tests validate
88-
:foreign_key_constraint,
89-
# SQLite with DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1
90-
# does not support using LIKE on BLOB types
91-
:like_match_blob,
92-
# SQLite will return a string for schemaless map types as
93-
# Ecto does not have enough information to call the associated loader
94-
# that converts the string JSON representaiton into a map
95-
:map_type_schemaless,
96-
97-
# right now in lock_for_migrations() we do effectively nothing, this is because
98-
# SQLite is single-writer so there isn't really a need for us to do anything.
99-
# ecto assumes all implementing adapters need >=2 connections for migrations
100-
# which is not true for SQLite
101-
:lock_for_migrations,
102-
103-
# Migration we don't support
104-
:prefix,
105-
:add_column_if_not_exists,
106-
:remove_column_if_exists,
107-
:alter_primary_key,
108-
:alter_foreign_key,
109-
:assigns_id_type,
110-
:modify_column,
111-
:restrict,
112-
113-
# SQLite3 does not support the concat function
114-
:concat,
115-
# SQLite3 does not support placeholders
116-
:placeholders,
117-
# SQLite3 stores booleans as integers, causing Ecto's json_extract_path tests to fail
118-
:json_extract_path,
119-
# SQLite3 doesn't support specifying columns for ON DELETE SET NULL
120-
:on_delete_nilify_column_list,
121-
122-
# We don't support selected_as
123-
:selected_as_with_group_by,
124-
:selected_as_with_order_by,
125-
:selected_as_with_order_by_expression,
126-
:selected_as_with_having,
127-
128-
# Distinct with options not supported
129-
:distinct_count,
130-
131-
# Values list
132-
:values_list
133-
]
134-
)
153+
ExUnit.start()

0 commit comments

Comments
 (0)