<?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 Version20201104043411 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('CREATE TABLE event_price (id INT AUTO_INCREMENT NOT NULL, event_id INT NOT NULL, created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_8BD393F571F7E88B (event_id), INDEX IDX_8BD393F5DE12AB56 (created_by), INDEX IDX_8BD393F516FE72E1 (updated_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE event_type_price (id INT AUTO_INCREMENT NOT NULL, event_type_id INT NOT NULL, created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_9C2A7C01401B253C (event_type_id), INDEX IDX_9C2A7C01DE12AB56 (created_by), INDEX IDX_9C2A7C0116FE72E1 (updated_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE ticket_type (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('INSERT INTO ticket_type (id, name) VALUES (1, "Default")');
$this->addSql('ALTER TABLE event_price ADD CONSTRAINT FK_8BD393F571F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
$this->addSql('ALTER TABLE event_price ADD CONSTRAINT FK_8BD393F5DE12AB56 FOREIGN KEY (created_by) REFERENCES fos_user (id)');
$this->addSql('ALTER TABLE event_price ADD CONSTRAINT FK_8BD393F516FE72E1 FOREIGN KEY (updated_by) REFERENCES fos_user (id)');
$this->addSql('ALTER TABLE event_type_price ADD CONSTRAINT FK_9C2A7C01401B253C FOREIGN KEY (event_type_id) REFERENCES event_type (id)');
$this->addSql('ALTER TABLE event_type_price ADD CONSTRAINT FK_9C2A7C01DE12AB56 FOREIGN KEY (created_by) REFERENCES fos_user (id)');
$this->addSql('ALTER TABLE event_type_price ADD CONSTRAINT FK_9C2A7C0116FE72E1 FOREIGN KEY (updated_by) REFERENCES fos_user (id)');
$this->addSql('ALTER TABLE event_type CHANGE image image VARCHAR(255) DEFAULT NULL');
}
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 TABLE event_price');
$this->addSql('DROP TABLE event_type_price');
$this->addSql('DROP TABLE ticket_type');
$this->addSql('ALTER TABLE event_type CHANGE image image VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`');
}
}