Details
-
Type:
Bug
-
Status:
Reopened
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.0-RC1
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
the generate-migrations-diff does not create migrations if the template changes fields on the model.
For example:
File:
tableName: files
inheritance:
extends: Eeecore_Record_File
actAs:
Fileable:
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.
I added coverage for this issue and it is working as expected. I compare two schemas:
Article: columns: title: string(255) body: cloband I compare it to this one:
Article: actAs: [Timestampable] columns: title: string(255) body: clobAnd now I do this:
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 ) ) )