I just fixed some things in my code. I'm now trying to validate my schema
php bin/console doctrine:schema:validate
Doctrine tells me my mapping is correct but my database schema is not. So I'm doing a
schema:update --dump-sql
which results in the same ALTER again and again, that I already performed many times.
Here is the ALTER :
ALTER TABLE migration_versions CHANGE version version VARCHAR(14) NOT NULL;
I did it (with --force), the entity is reflecting the change already :
**
* MigrationVersions
*
* @ORM\Table(name="migration_versions")
* @ORM\Entity
*/
class MigrationVersions
{
/**
* @var string
*
* @ORM\Column(name="version", type="string", length=14, nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $version;
I am correct right ? its varchar, lenght 14...
I don't think Im making a mistake here but I may be missing something.
Have you already verified that the server_version
in the doctrine config file is correct? ( config/packages/doctrine.yaml
in symfony5)
It happened to me that I was using MariaDB ( version 10.4.11-MariaDB - Source distribution
) and in the file doctrine.yaml
the server_version
parameter had the value 5.7
. After I corrected that, the error no longer occurred.
Also you can check this question
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.