<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Driver\Exception;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240905115519 extends AbstractMigration
{
public function getDescription(): string
{
return 'Added indexes';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
try {
$this->connection->executeQuery("CREATE INDEX object_id_index ON auction_bid (object_id);");
} catch (Exception $e) {
if ($e->getCode() == 1061) {
// Index already exists
} else {
throw $e;
}
}
try {
$this->connection->executeQuery("CREATE INDEX status_index ON notification_customer (status);");
} catch (Exception $e) {
if ($e->getCode() == 1061) {
// Index already exists
} else {
throw $e;
}
}
try {
$this->connection->executeQuery("CREATE INDEX related_item_id_index ON notification_customer (related_item_id);");
} catch (Exception $e) {
if ($e->getCode() == 1061) {
// Index already exists
} else {
throw $e;
}
}
try {
$this->connection->executeQuery("CREATE INDEX notification_type_index ON notification_template (notification_type);");
} catch (Exception $e) {
if ($e->getCode() == 1061) {
// Index already exists
} else {
throw $e;
}
}
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX object_id_index ON auction_bid');
$this->addSql('DROP INDEX status_index ON notification_customer');
$this->addSql('DROP INDEX related_item_id_index ON notification_customer');
$this->addSql('DROP INDEX notification_type_index ON notification_type');
}
}