I've created entities on my Symfony project, but when I execute migrations, I received this error:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
I've created these two entities 'Post' and 'Tag' with ManyToMany associations:
App\Entity\Post
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Tag", inversedBy="posts")
* @ORM\JoinTable(name="post_tag",
* joinColumns={@ORM\JoinColumn(name="post_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="tag_code", referencedColumnName="code")}
* )
*/
private $tags;
App\Entity\Tag:
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Post", mappedBy="tags")
*/
private $posts;
The migrations should create the pivot table 'post_tag' with post_id and tag_code as primary keys. How can I fix the error?
doctrine: dbal: charset: UTF8- J.Hpour