doctrine/DoctrineMigrationsBundle

make:migration dont create AUTO_INCREMENT on some entity

Adi-18 opened this issue · 0 comments

doctrine/doctrine-migrations-bundle: 3.2.2

I have several entities. But in one, migration dont add AUTO_INCREMENT

One working Entity :

/**
 * @ORM\Table(name="mandant")
 * @ORM\Entity(repositoryClass=MandantRepository::class)
 */
class Mandant
{
    /**
     * @var int
     *
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(name="id", type="integer", nullable=false)
     */
    private int $id = 0;

    ...
}

Result:
$this->addSql('CREATE TABLE mandant (id INT AUTO_INCREMENT NOT NULL, ...')

other, not working, Entity:

/**
 * Projects
 *
 * @ORM\Table(name="projects")
 * @ORM\Entity(repositoryClass=ProjectsRepository::class)
 */
class Projects
{
    /**
     * @var int
     *
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(name="id", type="integer", nullable=false)
     */
    private int $id = 0;

    ...
}

Result:
$this->addSql('CREATE TABLE projects (id INT NOT NULL, ...')

And if I add AUTO_INCREMENT manually, next migration will change it again