1

For a Symfony 3.4 project, after having switched on an existing branch on git, I made a

php bin/console doctrine:schema:update --force

in order to create new needed fields in database.

I'm facing an error:

In AbstractMySQLDriver.php line 60: An exception occurred while executing 'SELECT t0.id AS id_1, t0.name AS name_2, t0.real_name AS real_name_3, ...

SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.real_name' in 'field list'

That's precisely the field I want to add in my database, so why I am getting this error ?

Tried doctrine:cache:clear-metadata, cache:clear, ...,

Thank you for your help.

olivierf
  • 33
  • 3
  • 3
    Please share more details. Why not use migrations? Also, are you sure this question is related to [tag:git]? – Nico Haase Feb 10 '21 at 16:11
  • I created another branch and added new field, then switched to master and returned to branch test recreated correctly the new field. – olivierf Feb 11 '21 at 10:11
  • Like Nico Haase have said, prefer the use of Doctrine migrations. After each modification of your entity, run `bin/console doctrine:migration:diff` and all sql change will appear in a php file. Run migration. Each migration who has been executed is recorded in BDD – Astro-Otter Feb 12 '21 at 09:38

1 Answers1

0

I found the problem: In a Service __construct method, I have a query on the table which missed fields. I think that any symfony command (cache clear, doctrine schema) must check the integrity of all services before running them.

olivierf
  • 33
  • 3