Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Critical
-
Resolution: Unresolved
-
Affects Version/s: 1.2.3
-
Fix Version/s: None
-
Component/s: Migrations
-
Labels:None
-
Environment:Current HEAD of Doctrine 1.2
Description
Replicating the bug:
1. Set ATTR_MODEL_CLASS_PREFIX non-null
2. create schema file with entity
3. run doctrine build-all
4. copy schema file
5. edit schema file to add column to entity
6. run generate-migrations-diff from copy of schema file to edited schema file
Expected (previous) behaviour:
Migration is generated to add the new column to entity
Real behaviour:
Drops entity from database and creates new
This seems to be a regression caused by the fix for
DC-558which added the MODEL_CLASS_PREFIX to the $_toPrefix in Doctrine_Migration_Diff::generateChanges.While this fixed the issue when generating diff from models to YAML, it has now created the reverse issue for generating diffs from YAML to YAML - as the models generated for the "from" schema do not get MODEL_CLASS_PREFIX prepended and so now this command will drop all existing tables and recreate.
I believe the fix may be to amend as:
Since it seems that when presented with a folder of models _generateModels ignores the prefix anyway. However, I'm not sure of other impacts possible as a result?