2015-10-09 12:10:14 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
|
|
|
|
class RemoveUniqueNameIndex extends AbstractMigration
|
|
|
|
{
|
2016-05-07 08:43:21 +02:00
|
|
|
public function up()
|
2015-10-09 12:10:14 +02:00
|
|
|
{
|
|
|
|
$user = $this->table('user');
|
|
|
|
|
2018-02-23 11:40:56 +01:00
|
|
|
if ($user->hasIndex('name')) {
|
|
|
|
$user->removeIndex(['name'])->save();
|
2015-10-09 12:10:14 +02:00
|
|
|
}
|
|
|
|
|
2018-02-23 11:40:56 +01:00
|
|
|
if (!$user->hasIndex('name')) {
|
2017-01-29 03:49:43 +01:00
|
|
|
$user->addIndex(['name'], ['unique' => false])->save();
|
2016-05-05 18:33:12 +02:00
|
|
|
}
|
2015-10-09 12:10:14 +02:00
|
|
|
}
|
|
|
|
}
|