Skip to content

Commit 342efeb

Browse files
committed
add docs and changelog
1 parent a63caa1 commit 342efeb

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog][keepachangelog], and this project
66
adheres to [Semantic Versioning][semver].
77

88
## [Unreleased]
9+
- Added `collate:` opts support to `:string` column type
910

1011
## [0.5.1] - 2021-03-18
1112
- Updated exqlite to 0.5.0

lib/ecto/adapters/sqlite3.ex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,24 @@ defmodule Ecto.Adapters.SQLite3 do
9191
We have the DSQLITE_LIKE_DOESNT_MATCH_BLOBS compile-time option set to true,
9292
as [recommended][3] by SQLite. This means you cannot do LIKE queries on BLOB columns.
9393
94+
### Case sensitivity
95+
96+
Case sensitivty for `LIKE` is off by default, and controlled by the `:case_sensitive_like`
97+
option outlined above.
98+
99+
However, for equality comparison, case sensitivity is always _on_.
100+
If you want to make a column not be case sensitive, for email storage for example, you can
101+
make it case insensitive by using the [`COLLATE NOCASE`][6] option in SQLite. This is configured
102+
via the `:collate` option.
103+
104+
So instead of:
105+
106+
add :email, :string
107+
108+
You would do:
109+
110+
add :email, :string, collate: :nocase
111+
94112
### Schemaless queries
95113
96114
Using [schemaless Ecto queries][5] will not work well with SQLite. This is because
@@ -101,6 +119,7 @@ defmodule Ecto.Adapters.SQLite3 do
101119
[3]: https://www.sqlite.org/compile.html
102120
[4]: https://www.sqlite.org/whentouse.html
103121
[5]: https://www.sqlite.org/datatype3.html
122+
[6]: https://www.sqlite.org/datatype3.html#collating_sequences
104123
"""
105124

106125
use Ecto.Adapters.SQL,

0 commit comments

Comments
 (0)