Juan
Juan

Reputation: 1

Symfony 6: Error thrown while running command "doctrine:migrations:diff"

Whenever I run doctrine:migrations:status or doctrine:migrations:diff (or anything related to doctrine:migrations actually) i get the following error message:

[critical] Error thrown while running command "doctrine:migrations:status". Message: "An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'i_c.TABLE_NAME' in 'where clause'"

The app connection to the database is OK, but it seems like doctrine is unable to query the table doctrine_migration_versions.

I get a related message in my profiler: "error while trying to collect executed migrations".

I tried dropping the doctrine_migration_versions table and to recreate it through

doctrine:migrations:sync-metadata-storage

The command recreates an empty table in my database but the problem still persists.

I also tried to update my dependencies, to clear the cache and to rename my relevant doctrine.yaml and doctrine_migrations.yaml variables (such as table_name) in various ways but without effect.

My current doctrine.yaml

doctrine:
    dbal:
        default_connection: default
        connections:
            local_connection:
                url: '%env(LOCAL_DATABASE_URL)%'

            default:
                dbname: '%env(resolve:DB_NAME)%'
                user: '%env(resolve:DB_USER)%'
                host: '%env(resolve:HOST)%'
                password: '%env(resolve:DATABASE_PASSWORD)%'
                driver: 'pdo_mysql'
                server_version: 'mariadb-10.4.11'


            profiling_collect_backtrace: '%kernel.debug%'
            use_savepoints: true

    orm:
        auto_generate_proxy_classes: true
        enable_lazy_ghost_objects: true
        report_fields_where_declared: true
        validate_xml_mapping: true
        naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
        auto_mapping: true
        mappings:
            App:
                type: attribute
                is_bundle: false
                dir: '%kernel.project_dir%/src/Entity'
                prefix: 'App\Entity'
                alias: App

doctrine_migrations.yaml

doctrine_migrations:
    migrations_paths:
        # namespace is arbitrary but should be different from App\Migrations
        # as migrations classes should NOT be autoloaded
        'App\Migrations': '%kernel.project_dir%/migrations'

    enable_profiler: true

    # Connection to use for the migrations
    connection: default


    storage:
        # Default (SQL table) metadata storage configuration
        table_storage:
            table_name: 'doctrine_migration_versions'

Upvotes: 0

Views: 375

Answers (0)

Related Questions