Capitan Duke
Capitan Duke

Reputation: 135

Add new columns to a existing database througt doctrine command Symfony

I need help, I'm working in symfony, adn I created a database with 3 tables, but now I need to add some new columns into the tables, I created a new properties on the entity that I want to add them (new columns) into my tables. I installed the migrations Bundle but it doesn't work, I tried the schema uopdate as the documentation said and then I tried the migrations:diff and then the Migrate, and it seems like there is no changes to add to the entity/table, I'm very lost, could someone guide me please ? Is the private $usuario;

/**
 * @ORM\OneToOne(targetEntity="Usuario", inversedBy="user")
 * @ORM\JoinColumn(name="usuario_id", referencedColumnName="id")
 */
private $usuario;

Upvotes: 0

Views: 1552

Answers (1)

Robert Saylor
Robert Saylor

Reputation: 1369

So you need to make the changes to your Entity and save it. Verify the changes have been made.

Then from the command prompt run:

php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate

Out of the box on a Symfony 4.2.x app this should work with no issues.

Upvotes: 1

Related Questions