<?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 Version20201024000807 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 vehicle_feature (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_A42809B03A8386 (created_by_id), INDEX IDX_A42809896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE vehicle_vehicle_feature (vehicle_id INT NOT NULL, vehicle_feature_id INT NOT NULL, INDEX IDX_246B6D55545317D1 (vehicle_id), INDEX IDX_246B6D55E57637E4 (vehicle_feature_id), PRIMARY KEY(vehicle_id, vehicle_feature_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE vehicle_feature ADD CONSTRAINT FK_A42809B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE vehicle_feature ADD CONSTRAINT FK_A42809896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE vehicle_vehicle_feature ADD CONSTRAINT FK_246B6D55545317D1 FOREIGN KEY (vehicle_id) REFERENCES vehicle (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE vehicle_vehicle_feature ADD CONSTRAINT FK_246B6D55E57637E4 FOREIGN KEY (vehicle_feature_id) REFERENCES vehicle_feature (id) ON DELETE CASCADE');
}
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 vehicle_vehicle_feature DROP FOREIGN KEY FK_246B6D55E57637E4');
$this->addSql('DROP TABLE vehicle_vehicle_feature');
$this->addSql('DROP TABLE vehicle_feature');
}
}