phpci/PHPCI/Migrations/20150324174958_unique_email_and_name_user_fields.php
2015-04-22 13:54:02 +02:00

31 lines
665 B
PHP

<?php
use Phinx\Migration\AbstractMigration;
class UniqueEmailAndNameUserFields extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
$user_table = $this->table('user');
$user_table
->addIndex('email', array('unique' => true))
->addIndex('name', array('unique' => true))
->save();
}
/**
* Migrate Down.
*/
public function down()
{
$user_table = $this->table('user');
$user_table
->removeIndex('email', array('unique' => true))
->removeIndex('name', array('unique' => true))
->save();
}
}