[BUG] Migrations diff doesn't work
thrashzone13 opened this issue · 7 comments
I get this error on running migrations diff command
Declaration of Database\Migrations\Version20200409152424::up(Doctrine\DBAL\Schema\Schema $schema) must be
compatible with Doctrine\Migrations\AbstractMigration::up(Doctrine\DBAL\Schema\Schema $schema): void
What version of migrations
are you running? Did you recently upgrade your project? There were some breaking changes in the most recent release, that requires some steps from you to upgrade your older migrations.
You can read about which updates are needed in the release notes for 2.0.0
https://github.com/laravel-doctrine/migrations/releases/tag/2.0.0
@chewbakartik
these are the veriosns I'm using
"laravel/framework": "^7.0",
"laravel-doctrine/migrations": "^2.1",
"laravel-doctrine/orm": "^1.5",
@mirzacodenevis please look at this Migration file: Version20200409152424
You probably have in this file use Doctrine\DBAL\Migrations\AbstractMigration;
It needs to be use Doctrine\Migrations\AbstractMigration;
Also should check for this one:
use Doctrine\Schema\Schema;
needs to be use Doctrine\DBAL\Schema\Schema;
It sounds like this file is not updated with the breaking changes for the newer version of Doctrine Migrations, so you should check your up()
and down()
methods to makes sure they have the correct signature of public function up(Schema $schema): void
and public function down(Schema $schema): void
.
@chewbakartik the problem happens on running php artisan doctrine:migrations:diff
command, I don't have migration file yet
@mirzacodenevis there is something that the diff is comparing to as the base, your error message says that it is Version20200409152424
. Please search your codebase for a file named Version20200409152424.php
, it should be in the database/migrations
folder. Once you find that file, either delete it if it's not needed, or update it with the instructions posted above.
@chewbakartik I had forgotten to clear the cache!! thanks anyway