Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.0, 1.2.1
-
Fix Version/s: None
-
Component/s: Extensions, Migrations
-
Labels:None
-
Environment:osx 10.6, apache 2, php 5.3, symfony 1.4
Description
When adding the Taggable behaviour to an entity, the doctrine migration fails (i'm using the symfony task) with the follwing error:
>> doctrine Migrating from version 0 to 1
The following errors occurred:
- SQLSTATE[23000]: Integrity constraint violation: 1217 Cannot delete or update a parent row: a foreign key constraint fails. Failing Query: "DROP TABLE taggable_tag"
I have a single entity in my schema, with the Taggable behavior attached:
Article:
actAs:
Taggable: ~
columns:
title:
body:
{ type: clob }The Version1 class which was generate by the generate-migrations-diff task looks like this:
<?php
/**
- This class has been auto-generated by the Doctrine ORM Framework
*/
class Version1 extends Doctrine_Migration_Base
{
public function up() { $this->dropTable('taggable_tag'); }
public function down()
{ $this->createTable('taggable_tag', array( 'id' => array( 'type' => 'integer', 'length' => '8', 'autoincrement' => '1', 'primary' => '1', ), 'name' => array( 'unique' => '1', 'type' => 'string', 'length' => '255', ), ), array( 'type' => '', 'indexes' => array( ), 'primary' => array( 0 => 'id', ), 'collate' => '', 'charset' => '', )); }}
i think i found the reason for this. The sfDoctrineGenerateMigrationsDiffTask seems to build it's diff from yml schema files:
protected function execute()....
$this->callDoctrineCli('generate-migrations-diff', array(
'yaml_schema_path' => $this->prepareSchemaFile($config['yaml_schema_path']),
));
The task does not know anything about the models in the doctrine_extensions folder, and there are no yaml files for their
schema, so symfony migration tasks won't work with extensions.
It would be great if this would be mentioned somewhere in the docs of the extensions.