|
2 | 2 |
|
3 | 3 | [](https://github.com/elixir-sqlite/ecto_sqlite3/actions) |
4 | 4 |
|
5 | | -An Ecto SQLite3 Adapter. |
| 5 | +An Ecto SQLite3 Adapter. Uses [Exqlite](https://github.com/elixir-sqlite/exqlite) as the driver to communicate with sqlite3. |
6 | 6 |
|
| 7 | +## Caveats and limitations |
7 | 8 |
|
8 | | -## Caveats |
9 | | - |
10 | | -* Prepared statements are not cached. |
11 | | -* Prepared statements are not immutable. You must be careful when manipulating |
12 | | - statements and binding values to statements. Do not try to manipulate the |
13 | | - statements concurrently. Keep it isolated to one process. |
14 | | -* Adding a `CHECK` constraint is not supported by the Ecto adapter. This is due |
15 | | - to how Ecto handles specifying constraints. In SQLite you must specify the |
16 | | - `CHECK` on creation. |
17 | | -* All native calls are run through the Dirty NIF scheduler. |
18 | | -* Datetimes are stored without offsets. This is due to how SQLite3 handles date |
19 | | - and times. If you would like to store a timezone, you will need to create a |
20 | | - second column somewhere storing the timezone name and shifting it when you |
21 | | - get it from the database. This is more reliable than storing the offset as |
22 | | - `+03:00` as it does not respect daylight savings time. |
23 | | - |
| 9 | +See [Limitations](https://hexdocs.pm/ecto_sqlite3/Ecto.Adapters.SQLite3.html#module-limitations) in Hexdocs. |
24 | 10 |
|
25 | 11 | ## Installation |
26 | 12 |
|
27 | 13 | ```elixir |
28 | 14 | defp deps do |
29 | | - {:ecto_sqlite3, "~> 0.5.0"} |
| 15 | + {:ecto_sqlite3, "~> 0.5.2"} |
30 | 16 | end |
31 | 17 | ``` |
32 | 18 |
|
|
42 | 28 |
|
43 | 29 | Configure your repository similar to the following. If you want to know more |
44 | 30 | about the possible options to pass the repository, checkout the documentation |
45 | | -for `SQLite3.Connection.connect/1`. It will have more information on what is |
46 | | -configurable. |
| 31 | +for [`Ecto.Adapters.SQLite`](https://hexdocs.pm/ecto_sqlite3/). It will have more information on what is configurable. |
47 | 32 |
|
48 | 33 | ```elixir |
49 | 34 | config :my_app, |
50 | 35 | ecto_repos: [MyApp.Repo] |
51 | 36 |
|
52 | 37 | config :my_app, MyApp.Repo, |
53 | 38 | database: "path/to/my/database.db", |
54 | | - show_sensitive_data_on_connection_error: false, |
55 | | - journal_mode: :wal, |
56 | | - cache_size: -64000, |
57 | | - temp_store: :memory, |
58 | | - pool_size: 1 |
59 | 39 | ``` |
60 | | - |
61 | | - |
62 | | -### Note |
63 | | - |
64 | | -* Pool size is set to `1` but can be increased to `4`. When set to `10` there |
65 | | - was a lot of database busy errors. Currently this is a known issue and is |
66 | | - being looked in to. |
67 | | - |
68 | | -* Cache size is a negative number because that is how SQLite3 defines the cache |
69 | | - size in kilobytes. If you make it positive, that is the number of pages in |
70 | | - memory to use. Both have their pros and cons. Check the documentation out for |
71 | | - [SQLite3][pragma]. |
72 | | - |
73 | | -* Uses [Exqlite][exqlite] as the driver to communicate with sqlite3. |
74 | | - |
75 | | -## Contributing |
76 | | - |
77 | | -Feel free to check the project out and submit pull requests. |
78 | | - |
79 | | -[pragma]: <https://www.sqlite.org/pragma.html> |
80 | | -[exqlite]: <https://github.com/warmwaffles/exqlite> |
0 commit comments