<?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 Version20210616120631 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 reservation (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, created_by_user_id INT DEFAULT NULL, car_id INT NOT NULL, parking_slot_id INT NOT NULL, `from` DATETIME NOT NULL, `to` DATETIME NOT NULL, paid_at DATETIME DEFAULT NULL, paid_to DATETIME NOT NULL, is_cancelled TINYINT(1) NOT NULL, price DOUBLE PRECISION NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_42C84955A76ED395 (user_id), INDEX IDX_42C849557D182D95 (created_by_user_id), INDEX IDX_42C84955C3C6F69F (car_id), INDEX IDX_42C84955D70FE946 (parking_slot_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE reservation ADD CONSTRAINT FK_42C84955A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE reservation ADD CONSTRAINT FK_42C849557D182D95 FOREIGN KEY (created_by_user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE reservation ADD CONSTRAINT FK_42C84955C3C6F69F FOREIGN KEY (car_id) REFERENCES car (id)');
$this->addSql('ALTER TABLE reservation ADD CONSTRAINT FK_42C84955D70FE946 FOREIGN KEY (parking_slot_id) REFERENCES parkingslot (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE reservation');
}
}