Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make:migration dont create AUTO_INCREMENT on some entity #486

Open
Adi-18 opened this issue Feb 2, 2023 · 0 comments
Open

make:migration dont create AUTO_INCREMENT on some entity #486

Adi-18 opened this issue Feb 2, 2023 · 0 comments

Comments

@Adi-18
Copy link

Adi-18 commented Feb 2, 2023

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

@Adi-18 Adi-18 changed the title make:migration dont create AUTO_INCREMENT on some object make:migration dont create AUTO_INCREMENT on some entity Feb 2, 2023
@Adi-18 Adi-18 changed the title make:migration dont create AUTO_INCREMENT on some entity 'make:migration' dont create 'AUTO_INCREMENT' on some entity Feb 2, 2023
@Adi-18 Adi-18 changed the title 'make:migration' dont create 'AUTO_INCREMENT' on some entity make:migration dont create AUTO_INCREMENT on some entity Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant