I'm trying to execute the update schema command on doctrine, but the operation is not completed because the follow error:
Command executed:
php doctrine orm:schema-tool:update --force
Error:
SQLSTATE[23000]: Integrity constraint violation: 1062 ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '1' for key 'PRIMARY'
But the table on question at present don't have auto_increment. So, Doctrine are inserting auto_increment on my table without my will?
How I can pass for this error without insert auto_increment in my table?
I resolved the problem!
I removed the @ORM\GeneratedValue(strategy="IDENTITY")
annotation property of the respective attribute of the entity.
See the examples below:
Before:
/**
* @var integer
*
* @ORM\Column(name="id_usuario", type="smallint", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $idUsuario;
After:
/**
* @var integer
*
* @ORM\Column(name="id_usuario", type="smallint", nullable=false)
* @ORM\Id
*/
private $idUsuario;