3

When I try to migrate doctrine:migrations:migrate, I get this exception: "The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue.". This only occurs when trying to do a migration on the production environment. When I use the doctrine:migrations:sync-meta-storage command, it throws the same exception.

doctrine_migrations.yaml:

doctrine_migrations:
    # List of namespace/path pairs to search for migrations, at least one required
    migrations_paths:
        'DoctrineMigrations': '%kernel.project_dir%/migrations'

    # List of additional migration classes to be loaded, optional
    migrations:

    # Entity manager to use for migrations. This overrides the "connection" setting.
    em: default

    storage:
        # Default (SQL table) metadata storage configuration
        table_storage:
            table_name: 'doctrine_migration_versions'
            version_column_name: 'version'
            version_column_length: 1024
            executed_at_column_name: 'executed_at'
            execution_time_column_name: 'execution_time'

    # Possible values: "BY_YEAR", "BY_YEAR_AND_MONTH", false
    organize_migrations: false

    # Path to your custom migrations template
    custom_template: ~

    # Run all migrations in a transaction.
    all_or_nothing: false

I am using Symfony 5 and using DoctrineMigrationsBundle version 3.0 to do migration tasks.

Sven Evertse
  • 31
  • 1
  • 3
  • I had exactly the same issue when running Symfony with MariaDB 10.3 and I didn't find a way to resolve it. However, when I switched to PostgreSQL the issue was gone. – fakemeta Jun 17 '20 at 12:01

4 Answers4

7

Try to remove the server version on your .env file

V4aughn
  • 71
  • 1
3

I got it working by adding the version of maria db in .env file.

expl: serverVersion = 10.4.11-MariaDB


Carter
  • 697
  • 5
  • 22
1

you need to update your db : php bin/console doctrine:schema:update --dump-sql then php bin/console doctrine:schema:update --force once the problem is solved you can report it

  • 1
    It's good to refresh metadata first: `php bin/console doctrine:cache:clear-metadata` to make sure you're using current annotation metadata instead of cached one. – Konrad Gałęzowski Jul 31 '20 at 08:50
0

I use DDEV and running into the same issue.

This Configuration in the .env file worked for me…

DATABASE_URL=mysql://db:db@db:3306/db?serverVersion=10.4.11-MariaDB
MonTea
  • 1,166
  • 1
  • 13
  • 30