Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does doctrine:generate-migrations-diff do a diff against?

Tags:

doctrine

This function purports to build doctrine migration classes based upon a diff between old and new schemas.

Well, where is the old schema stored that the system is diff'ing against? I'm in a symfony project and there is only one schema.yml in my configs.

The brunt of my problem, is that there was a problem with my schema that caused a migration to fail (I had a column named "group")... after making the name change in my schema... ensuring migration generates and migration attempts would invariable give errors because prior migration attempts only partially completed.

So, I've been wanting to set everything back to a "pristine" state, as if there had never been a migration, I want the current schema / database taken as if it were version 0, and fresh migration class made.

However, manually resetting my db, and wiping the migration classes out is not working, and the generated diff classes insist on dropping tables which no longer exist.

So, I'm assuming there is a cached file somewhere with old schema data it's comparing against?

Thanks for any help.

like image 296
user469703 Avatar asked Oct 13 '22 23:10

user469703


1 Answers

Ah... the answer was here:

Extra changeColumns in Doctrine generate-migrations-diff

It isn't diff'ing with a cached schema.yml, it's comparing against your model classes.

So, solution for "resetting" the migration process would be to manually sync your database and model (probably by resetting the schema.yml to the old structure, regenning models, then manually reverting the database), then all back in the new schema elements, and run generate-migrations-diff.

This worked for me.

like image 78
user469703 Avatar answered Oct 29 '22 16:10

user469703