<?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 Version20210719204520 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 visitation (id INT AUTO_INCREMENT NOT NULL, parking_slot_id INT NOT NULL, company_id INT NOT NULL, created_by INT NOT NULL, `from` DATETIME NOT NULL, `to` DATETIME NOT NULL, gate_open_from DATETIME DEFAULT NULL, gate_open_to DATETIME DEFAULT NULL, first_name VARCHAR(40) NOT NULL, last_name VARCHAR(40) NOT NULL, email VARCHAR(40) NOT NULL, car_plate VARCHAR(40) NOT NULL, internal_contact VARCHAR(40) NOT NULL, visitation_place VARCHAR(40) NOT NULL, price DOUBLE PRECISION NOT NULL, is_cancelled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_B39D86AD70FE946 (parking_slot_id), INDEX IDX_B39D86A979B1AD6 (company_id), INDEX IDX_B39D86ADE12AB56 (created_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE visitation ADD CONSTRAINT FK_B39D86AD70FE946 FOREIGN KEY (parking_slot_id) REFERENCES parkingslot (id)');
$this->addSql('ALTER TABLE visitation ADD CONSTRAINT FK_B39D86A979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('ALTER TABLE visitation ADD CONSTRAINT FK_B39D86ADE12AB56 FOREIGN KEY (created_by) REFERENCES user (id)');
$this->addSql('ALTER TABLE parkingslot ADD company_id INT DEFAULT NULL, ADD is_active TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE parkingslot ADD CONSTRAINT FK_72DCE8D5979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('CREATE INDEX IDX_72DCE8D5979B1AD6 ON parkingslot (company_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE visitation');
$this->addSql('ALTER TABLE parkingslot DROP FOREIGN KEY FK_72DCE8D5979B1AD6');
$this->addSql('DROP INDEX IDX_72DCE8D5979B1AD6 ON parkingslot');
$this->addSql('ALTER TABLE parkingslot DROP company_id, DROP is_active');
}
}