Skip to content

Instantly share code, notes, and snippets.

@tworzenieweb
Created March 12, 2012 09:59
Show Gist options
  • Save tworzenieweb/2020992 to your computer and use it in GitHub Desktop.
Save tworzenieweb/2020992 to your computer and use it in GitHub Desktop.
Doctrine 1.2 How to drop non standard index in migration
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class Version73 extends Doctrine_Migration_Base
{
public function up()
{
$manager = Doctrine_Manager::getInstance();
// by default index name will be formated and _idx suffix is added. Sometimes this could be forced
$manager->setAttribute(Doctrine_Core::ATTR_IDXNAME_FORMAT, '%s');
$this->removeIndex('internship', 'name');
}
public function down()
{
$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(Doctrine_Core::ATTR_IDXNAME_FORMAT, '%s');
$this->addIndex('internship', 'name', array(
'fields' =>
array(
0 => 'name',
),
'unique' => true
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment