for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Spiral Framework.
*
* @license MIT
* @author Anton Titov (Wolfy-J)
*/
declare(strict_types=1);
namespace Cycle\Migrations\Operation\Index;
use Cycle\Migrations\CapsuleInterface;
use Cycle\Migrations\Exception\Operation\IndexException;
final class Drop extends Index
{
* {@inheritdoc}
public function execute(CapsuleInterface $capsule): void
$schema = $capsule->getSchema($this->getTable());
if (!$schema->hasIndex($this->columns)) {
$columns = implode(',', $this->columns);
throw new IndexException(
"Unable to drop index '{$schema->getName()}'.({$columns}), index does not exists"
);
}
$schema->dropIndex($this->columns);