[DC-292] no migrations diff on template change Created: 25/Nov/09 Updated: 01/Mar/10 |
|
| Status: | Reopened |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | 1.2.0-RC1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Christian Jaentsch | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
the generate-migrations-diff does not create migrations if the template changes fields on the model. For example: File: The Fileable Template does the following... (the "fileFields" option stores a couple of fields to add to the model) public function setTableDefinition() foreach ($this->_options['fileFields'] as $key => $field) { $this->hasColumn($field['name'], $field['type'], $field['length'], $field['options']); }} everything works fine on generate-migrations-models (the initial migrations)... but if we change something on the "fileFields" the generate-migrations-diff call doesn't do anything. We have to rebuild all migrations or write a new migration by hand. |
| Comments |
| Comment by Jonathan H. Wage [ 07/Dec/09 ] |
|
I added coverage for this issue and it is working as expected. I compare two schemas: Article:
columns:
title: string(255)
body: clob
and I compare it to this one: Article:
actAs: [Timestampable]
columns:
title: string(255)
body: clob
And now I do this: $migration = new Doctrine_Migration(dirname(__FILE__) . '/DC292/migrations'); $diff = new Doctrine_Migration_Diff(dirname(__FILE__) . '/DC292/from.yml', dirname(__FILE__) . '/DC292/to.yml', $migration); $changes = $diff->generateChanges(); print_r($changes); It has this in the array: [created_columns] => Array
(
[article] => Array
(
[created_at] => Array
(
[notnull] => 1
[type] => timestamp
[length] => 25
)
[updated_at] => Array
(
[notnull] => 1
[type] => timestamp
[length] => 25
)
)
)
|
| Comment by Christian Jaentsch [ 08/Dec/09 ] |
|
The problem does not occur if you compare 2 schemas while one has a certain template and the other not. In my case the problem occurs when the 2 schemas both already have the same template definition but in one case the template itself has changed (e.g. injects one more field into the database table of a certain model via setTableDefinition). |
| Comment by Jonathan H. Wage [ 08/Dec/09 ] |
|
When I test that it works as well. Can you show some kind of reproducible test case? |
| Comment by Jonathan H. Wage [ 01/Mar/10 ] |
|
Maybe you could add a test case for this? |