<?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 Version20210709144700 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 sector (id INT AUTO_INCREMENT NOT NULL, parking_map_id INT NOT NULL, name VARCHAR(32) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_4BA3D9E87D27CF9 (parking_map_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE sector ADD CONSTRAINT FK_4BA3D9E87D27CF9 FOREIGN KEY (parking_map_id) REFERENCES parkingmap (id)');
$this->addSql('ALTER TABLE parkingslot ADD sector_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE parkingslot ADD CONSTRAINT FK_72DCE8D5DE95C867 FOREIGN KEY (sector_id) REFERENCES sector (id)');
$this->addSql('CREATE INDEX IDX_72DCE8D5DE95C867 ON parkingslot (sector_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE parkingslot DROP FOREIGN KEY FK_72DCE8D5DE95C867');
$this->addSql('DROP TABLE sector');
$this->addSql('DROP INDEX IDX_72DCE8D5DE95C867 ON parkingslot');
$this->addSql('ALTER TABLE parkingslot DROP sector_id');
}
}