<?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 Version20211125111145 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->addSql('CREATE TABLE event_vehicle (event_id INT NOT NULL, vehicle_id INT NOT NULL, INDEX IDX_9ED74D2971F7E88B (event_id), INDEX IDX_9ED74D29545317D1 (vehicle_id), PRIMARY KEY(event_id, vehicle_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE vehicle (id INT AUTO_INCREMENT NOT NULL, license_plate VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE event_vehicle ADD CONSTRAINT FK_9ED74D2971F7E88B FOREIGN KEY (event_id) REFERENCES events (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE event_vehicle ADD CONSTRAINT FK_9ED74D29545317D1 FOREIGN KEY (vehicle_id) REFERENCES vehicle (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE logs CHANGE type type enum(\'mail\', \'sms\')');
$this->addSql('ALTER TABLE subscriptions CHANGE transmission_type transmission_type enum(\'manual\',\'automatic\')');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE event_vehicle DROP FOREIGN KEY FK_9ED74D29545317D1');
$this->addSql('DROP TABLE event_vehicle');
$this->addSql('DROP TABLE vehicle');
$this->addSql('ALTER TABLE logs CHANGE type type VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
$this->addSql('ALTER TABLE subscriptions CHANGE transmission_type transmission_type VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
}
}