@@ -44,6 +44,10 @@ defmodule Ecto.Adapters.SQLite3 do
44
44
* `:busy_timeout` - Sets the busy timeout in milliseconds for a connection.
45
45
Default is `2000`.
46
46
* `:pool_size` - the size of the connection pool. Defaults to `5`.
47
+ * `:binary_id_type` - Defaults to `:string`. Determines how binary IDs are stored in the database and the type of
48
+ `:binary_id` columns. See the [section on binary ID types](#module-binary-id-types) for more details.
49
+ * `:uuid_type` - Defaults to `:string`. Determines the type of `:uuid` columns. Possible values and
50
+ column types are the same as for [binary IDs](#module-binary-id-types).
47
51
48
52
For more information about the options above, see [sqlite documentation][1]
49
53
@@ -72,6 +76,19 @@ defmodule Ecto.Adapters.SQLite3 do
72
76
[1]: https://www.sqlite.org/pragma.html
73
77
[2]: https://sqlite.org/wal.html
74
78
79
+ ### Binary ID types
80
+
81
+ The `:binary_id_type` configuration option allows configuring how `:binary_id` fields are stored in the database as
82
+ well as the type of the column in which these IDs will be stored. The possible values are:
83
+ * `:string` (default): IDs are stored as strings, and the type of the column is `TEXT_UUID`.
84
+ * `:binary`: IDs are stored in their raw binary form, and the type of the column is `UUID`.
85
+
86
+ The main differences between the two formats are as follows:
87
+ * When stored as binary, UUIDs require much less space in the database. IDs stored as strings require 36 bytes each,
88
+ while IDs stored as binary only require 16 bytes.
89
+ * Because SQLite does not have a dedicated UUID type, most clients cannot represent UUIDs stored as binary in a human
90
+ readable format. Therefore, IDs stored as strings may be easier to work with if manual manipulation is required.
91
+
75
92
## Limitations and caveats
76
93
77
94
There are some limitations when using Ecto with SQLite that one needs
0 commit comments