File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,15 @@ can automatically generate an empty ``test_project`` database for you:
149149 support 4-byte unicode characters, and strings containing them will be
150150 truncated. This is fixed by the `newer utf8mb4 character set `_.
151151
152+ .. caution ::
153+
154+ MySQL sets a `limit of 767 bytes for the index key prefix `_. When using
155+ ``utf8mb4 ``, string columns with 255 character length surpass that limit.
156+ This means that any column of type ``string `` and ``unique=true `` must
157+ set its maximum ``length `` to ``190 ``. Otherwise, you'll see this error:
158+ *"[PDOException] SQLSTATE[42000]: Syntax error or access violation:
159+ 1071 Specified key was too long; max key length is 767 bytes" *.
160+
152161.. note ::
153162
154163 If you want to use SQLite as your database, you need to set the path
@@ -838,3 +847,4 @@ Learn more
838847.. _`FrameworkExtraBundle documentation` : https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
839848.. _`newer utf8mb4 character set` : https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html
840849.. _`Transactions and Concurrency` : http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/transactions-and-concurrency.html
850+ .. _`limit of 767 bytes for the index key prefix` : https://dev.mysql.com/doc/refman/5.6/en/innodb-restrictions.html
You can’t perform that action at this time.
0 commit comments