[DC-830] Migration for up() not adding suffix for index Created: 16/Aug/10  Updated: 21/Aug/10

Status: Open
Project: Doctrine 1
Component/s: Migrations
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: webPragmatist Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 2
Labels: None
Environment:

Postgresql 8.4 / Symfony 1.4.6



 Description   

I am still getting the same issue as previously closed a while ago on trac http://trac.doctrine-project.org/ticket/1964

migration.php
<?php
/**
 * This class has been auto-generated by the Doctrine ORM Framework
 */
class Add_Category_Slug_Index extends Doctrine_Migration_Base
{
    public function up()
    {
        $this->addIndex('category', 'category_sluggable', array(
             'fields' => 
             array(
              0 => 'slug',
             ),
             'type' => 'unique',
             ));
    }

    public function down()
    {
        $this->removeIndex('category', 'category_sluggable', array(
             'fields' => 
             array(
              0 => 'slug',
             ),
             'type' => 'unique',
             ));
    }
}

The above migration generates an index named category_sluggable instead of category_sluggable_idx



 Comments   
Comment by webPragmatist [ 16/Aug/10 ]

If I change the name in the up() to category_sluggable_idx both up and down work properly.

Comment by Jakub ArgasiƄski [ 21/Aug/10 ]

Confirming. I had the same problem last week and as a workaround I had to change suffix from "%s_idx" to "%s". Even if the bug is not reproducible in a test case, it indeed happens in live environment on PostgreSQL (in my case, Symphony is not used).

Generated at Fri Nov 21 02:49:16 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.