<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20200611095349 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('UPDATE hoard SET find_spot_name = UPPER(find_spot_name)');
$this->addSql('CREATE TRIGGER ucase_insert_findspotname BEFORE INSERT ON hoard FOR EACH ROW SET NEW.find_spot_name = UPPER(NEW.find_spot_name)');
$this->addSql('CREATE TRIGGER ucase_update_findspotname BEFORE UPDATE ON hoard FOR EACH ROW SET NEW.find_spot_name = UPPER(NEW.find_spot_name)');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('DROP TRIGGER ucase_update_findspotname');
$this->addSql('DROP TRIGGER ucase_insert_findspotname');
}
}