Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony Make:Migration : The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue

I keep getting this problem everytime i try to migrate using the commandline: php bin/console make:migration or even doctrine:migration status when i try the doctrine:migration:sync-metadata-storage as they tell me I still get the same error message.

I'm currently learning symfony and have been following a guide but I get this problem somehow Symfony 4.4 php 7.2

like image 314
Aziz Bouaouina Avatar asked Jun 16 '20 15:06

Aziz Bouaouina


3 Answers

Try changing the DATABASE_URL in .env from

DATABASE_URL=mysql://root:@127.0.0.1:3306/testtest?serverVersion=10.4.11

to

DATABASE_URL=mysql://root:@127.0.0.1:3306/testtest?serverVersion=mariadb-10.4.11

Symfony documentation suggest specifying the version number but not the database type

"There are more options in config/packages/doctrine.yaml that you can configure, including your server_version (e.g. 5.7 if you're using MySQL 5.7), which may affect how Doctrine functions." https://symfony.com/doc/current/doctrine.html

Original Answer: https://github.com/doctrine/DoctrineMigrationsBundle/issues/337#issuecomment-645390496

For MariaDB you will need the full semver compat version: Major.Minor.Patch. By executing mysql --version, you will get the correct version you are currently running.

like image 158
Mees van Wel Avatar answered Nov 02 '22 01:11

Mees van Wel


For me was enough prefixing the server version with mariadb-x.x.x. It fixed the issue.

"If you are running a MariaDB database, you should prefix the serverVersion with mariadb- (ex: mariadb-10.2.12)."

https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url

like image 31
utidevid Avatar answered Nov 02 '22 01:11

utidevid


It works if I change the DATABASE_URL in .env

From:

DATABASE_URL=mysql://root:@127.0.0.1:3306/testtest?serverVersion=10.4.11

To:

DATABASE_URL=mysql://root:@127.0.0.1:3306/testtest?serverVersion=mariadb-10.4.11
like image 17
Mohammad Ali Avatar answered Nov 02 '22 02:11

Mohammad Ali