doctrine/DoctrineMigrationsBundle

The metadata storage is not up to date (because of platformOptions?)

semoriil opened this issue · 2 comments

Upgraded from Symfony 6.0 to Symfony 6.2 and got error The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue. Running said command says OK, no issues. But bin/console doctrine:migrations:status shows that error again.

doctrine/dbal 3.5.2
doctrine/doctrine-migrations-bundle 3.2.2
doctrine/migrations 3.5.3
Server version: 10.5.18-MariaDB-1:10.5.18+maria~deb11 mariadb.org binary distribution (server version passed via DB URL)
PHP 8.1

For debugging I've changed lines in Doctrine\Migrations\Exception\MetadataStorageError::notUpToDate() at vendor/doctrine/migrations/lib/Doctrine/Migrations/Metadata/Storage/TableMetadataStorage.php:239 to this

        if (($diff = $this->needsUpdate($expectedTable)) !== null) {
            var_dump($diff);
            throw MetadataStorageError::notUpToDate();
        }

and got this output (the only difference I see is in _platformOptions IDK, what I can do about this.

bin/console doctrine:migrations:status
object(Doctrine\DBAL\Schema\TableDiff)#555 (14) {
  ["name"]=>
  string(27) "doctrine_migration_versions"
  ["newName"]=>
  bool(false)
  ["addedColumns"]=>
  array(0) {
  }
  ["changedColumns"]=>
  array(1) {
    ["version"]=>
    object(Doctrine\DBAL\Schema\ColumnDiff)#600 (4) {
      ["oldColumnName"]=>
      string(7) "version"
      ["column"]=>
      object(Doctrine\DBAL\Schema\Column)#530 (16) {
        ["_name":protected]=>
        string(7) "version"
        ["_namespace":protected]=>
        NULL
        ["_quoted":protected]=>
        bool(false)
        ["_type":protected]=>
        object(Doctrine\DBAL\Types\StringType)#372 (0) {
        }
        ["_length":protected]=>
        int(191)
        ["_precision":protected]=>
        int(10)
        ["_scale":protected]=>
        int(0)
        ["_unsigned":protected]=>
        bool(false)
        ["_fixed":protected]=>
        bool(false)
        ["_notnull":protected]=>
        bool(true)
        ["_default":protected]=>
        NULL
        ["_autoincrement":protected]=>
        bool(false)
        ["_platformOptions":protected]=>
        array(0) {
        }
        ["_columnDefinition":protected]=>
        NULL
        ["_comment":protected]=>
        NULL
        ["_customSchemaOptions":protected]=>
        array(0) {
        }
      }
      ["changedProperties"]=>
      array(0) {
      }
      ["fromColumn"]=>
      object(Doctrine\DBAL\Schema\Column)#552 (16) {
        ["_name":protected]=>
        string(7) "version"
        ["_namespace":protected]=>
        NULL
        ["_quoted":protected]=>
        bool(false)
        ["_type":protected]=>
        object(Doctrine\DBAL\Types\StringType)#372 (0) {
        }
        ["_length":protected]=>
        int(191)
        ["_precision":protected]=>
        int(10)
        ["_scale":protected]=>
        int(0)
        ["_unsigned":protected]=>
        bool(false)
        ["_fixed":protected]=>
        bool(false)
        ["_notnull":protected]=>
        bool(true)
        ["_default":protected]=>
        NULL
        ["_autoincrement":protected]=>
        bool(false)
        ["_platformOptions":protected]=>
        array(2) {
          ["charset"]=>
          string(7) "utf8mb4"
          ["collation"]=>
          string(18) "utf8mb4_unicode_ci"
        }
        ["_columnDefinition":protected]=>
        NULL
        ["_comment":protected]=>
        NULL
        ["_customSchemaOptions":protected]=>
        array(0) {
        }
      }
    }
  }
  ["removedColumns"]=>
  array(0) {
  }
  ["renamedColumns"]=>
  array(0) {
  }
  ["addedIndexes"]=>
  array(0) {
  }
  ["changedIndexes"]=>
  array(0) {
  }
  ["removedIndexes"]=>
  array(0) {
  }
  ["renamedIndexes"]=>
  array(0) {
  }
  ["addedForeignKeys"]=>
  array(0) {
  }
  ["changedForeignKeys"]=>
  array(0) {
  }
  ["removedForeignKeys"]=>
  array(0) {
  }
  ["fromTable"]=>
  object(Doctrine\DBAL\Schema\Table)#559 (11) {
    ["_name":protected]=>
    string(27) "doctrine_migration_versions"
    ["_namespace":protected]=>
    NULL
    ["_quoted":protected]=>
    bool(false)
    ["_columns":protected]=>
    array(3) {
      ["version"]=>
      object(Doctrine\DBAL\Schema\Column)#552 (16) {
        ["_name":protected]=>
        string(7) "version"
        ["_namespace":protected]=>
        NULL
        ["_quoted":protected]=>
        bool(false)
        ["_type":protected]=>
        object(Doctrine\DBAL\Types\StringType)#372 (0) {
        }
        ["_length":protected]=>
        int(191)
        ["_precision":protected]=>
        int(10)
        ["_scale":protected]=>
        int(0)
        ["_unsigned":protected]=>
        bool(false)
        ["_fixed":protected]=>
        bool(false)
        ["_notnull":protected]=>
        bool(true)
        ["_default":protected]=>
        NULL
        ["_autoincrement":protected]=>
        bool(false)
        ["_platformOptions":protected]=>
        array(2) {
          ["charset"]=>
          string(7) "utf8mb4"
          ["collation"]=>
          string(18) "utf8mb4_unicode_ci"
        }
        ["_columnDefinition":protected]=>
        NULL
        ["_comment":protected]=>
        NULL
        ["_customSchemaOptions":protected]=>
        array(0) {
        }
      }
      ["executed_at"]=>
      object(Doctrine\DBAL\Schema\Column)#560 (16) {
        ["_name":protected]=>
        string(11) "executed_at"
        ["_namespace":protected]=>
        NULL
        ["_quoted":protected]=>
        bool(false)
        ["_type":protected]=>
        object(Doctrine\DBAL\Types\DateTimeType)#334 (0) {
        }
        ["_length":protected]=>
        int(0)
        ["_precision":protected]=>
        int(10)
        ["_scale":protected]=>
        int(0)
        ["_unsigned":protected]=>
        bool(false)
        ["_fixed":protected]=>
        bool(false)
        ["_notnull":protected]=>
        bool(false)
        ["_default":protected]=>
        NULL
        ["_autoincrement":protected]=>
        bool(false)
        ["_platformOptions":protected]=>
        array(0) {
        }
        ["_columnDefinition":protected]=>
        NULL
        ["_comment":protected]=>
        NULL
        ["_customSchemaOptions":protected]=>
        array(0) {
        }
      }
      ["execution_time"]=>
      object(Doctrine\DBAL\Schema\Column)#515 (16) {
        ["_name":protected]=>
        string(14) "execution_time"
        ["_namespace":protected]=>
        NULL
        ["_quoted":protected]=>
        bool(false)
        ["_type":protected]=>
        object(Doctrine\DBAL\Types\IntegerType)#367 (0) {
        }
        ["_length":protected]=>
        NULL
        ["_precision":protected]=>
        int(10)
        ["_scale":protected]=>
        int(0)
        ["_unsigned":protected]=>
        bool(false)
        ["_fixed":protected]=>
        bool(false)
        ["_notnull":protected]=>
        bool(false)
        ["_default":protected]=>
        NULL
        ["_autoincrement":protected]=>
        bool(false)
        ["_platformOptions":protected]=>
        array(0) {
        }
        ["_columnDefinition":protected]=>
        NULL
        ["_comment":protected]=>
        NULL
        ["_customSchemaOptions":protected]=>
        array(0) {
        }
      }
    }
    ["_indexes":protected]=>
    array(1) {
      ["primary"]=>
      object(Doctrine\DBAL\Schema\Index)#529 (8) {
        ["_name":protected]=>
        string(7) "PRIMARY"
        ["_namespace":protected]=>
        NULL
        ["_quoted":protected]=>
        bool(false)
        ["_columns":protected]=>
        array(1) {
          ["version"]=>
          object(Doctrine\DBAL\Schema\Identifier)#528 (3) {
            ["_name":protected]=>
            string(7) "version"
            ["_namespace":protected]=>
            NULL
            ["_quoted":protected]=>
            bool(false)
          }
        }
        ["_isUnique":protected]=>
        bool(true)
        ["_isPrimary":protected]=>
        bool(true)
        ["_flags":protected]=>
        array(0) {
        }
        ["options":"Doctrine\DBAL\Schema\Index":private]=>
        array(1) {
          ["lengths"]=>
          array(1) {
            [0]=>
            NULL
          }
        }
      }
    }
    ["_primaryKeyName":protected]=>
    string(7) "primary"
    ["uniqueConstraints":protected]=>
    array(0) {
    }
    ["_fkConstraints":protected]=>
    array(0) {
    }
    ["_options":protected]=>
    array(6) {
      ["create_options"]=>
      array(0) {
      }
      ["engine"]=>
      string(6) "InnoDB"
      ["collation"]=>
      string(18) "utf8mb4_unicode_ci"
      ["charset"]=>
      string(7) "utf8mb4"
      ["autoincrement"]=>
      NULL
      ["comment"]=>
      string(0) ""
    }
    ["_schemaConfig":protected]=>
    NULL
    ["implicitIndexes":"Doctrine\DBAL\Schema\Table":private]=>
    array(0) {
    }
  }
}

In MetadataStorageError.php line 13:
                                                                                                           
  The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue.  
                                                                                                           

doctrine:migrations:status [--configuration CONFIGURATION] [--em EM] [--conn CONN]

Duplicate of #483

OK, closed.

Upgrading doctrine/dbal (3.5.2 => 3.5.3) seems to fix this.