migrations/Version20221103105900.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. final class Version20221103105900 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return '';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->skipIf(
  15.             false === $schema->getTable('tariff')->hasIndex('UNIQ_9465207D816B8778'),
  16.             'The cns_code index already removed from the tariff table!'
  17.         );
  18.         $schema->getTable('tariff')
  19.             ->dropIndex('UNIQ_9465207D816B8778');
  20.     }
  21.     public function down(Schema $schema): void
  22.     {
  23.         $this->skipIf(
  24.             true === $schema->getTable('tariff')->hasIndex('UNIQ_9465207D816B8778'),
  25.             'The cns_code index already exists in the tariff table!'
  26.         );
  27.         $schema->getTable('tariff')
  28.             ->addIndex(['cns_code'], 'UNIQ_9465207D816B8778');
  29.     }
  30. }