<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20201106002755 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
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('ALTER TABLE attendee ADD ticket_type_id INT NOT NULL, ADD price NUMERIC(8, 2) NOT NULL');
$this->addSql('UPDATE attendee SET ticket_type_id=(SELECT id FROM ticket_type LIMIT 1), price=0');
$this->addSql('ALTER TABLE attendee ADD CONSTRAINT FK_1150D567C980D5C1 FOREIGN KEY (ticket_type_id) REFERENCES ticket_type (id)');
$this->addSql('CREATE INDEX IDX_1150D567C980D5C1 ON attendee (ticket_type_id)');
}
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('ALTER TABLE attendee DROP FOREIGN KEY FK_1150D567C980D5C1');
$this->addSql('DROP INDEX IDX_1150D567C980D5C1 ON attendee');
$this->addSql('ALTER TABLE attendee DROP ticket_type_id, DROP price');
}
}