Doctrine:migrations:migrate. The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue

Viewed 5165

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.

4 Answers

Try to remove the server version on your .env file

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

expl: serverVersion = 10.4.11-MariaDB


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

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
Related