<?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 Version20210706131854 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 cal_maintenance_appointment (id INT AUTO_INCREMENT NOT NULL, maintenance_id INT DEFAULT NULL, user_id INT DEFAULT NULL, status VARCHAR(50) NOT NULL, waiting_material TINYINT(1) DEFAULT NULL, delay INT DEFAULT NULL, comment LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, INDEX IDX_FB1E4445F6C202BC (maintenance_id), INDEX IDX_FB1E4445A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE cal_maintenance_appointment_date (id INT AUTO_INCREMENT NOT NULL, appointment_id INT DEFAULT NULL, date DATETIME NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_922EE93EE5B533F9 (appointment_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE cal_maintenance_appointment ADD CONSTRAINT FK_FB1E4445F6C202BC FOREIGN KEY (maintenance_id) REFERENCES cal_maintenance (id)');
$this->addSql('ALTER TABLE cal_maintenance_appointment ADD CONSTRAINT FK_FB1E4445A76ED395 FOREIGN KEY (user_id) REFERENCES cal_user (id)');
$this->addSql('ALTER TABLE cal_maintenance_appointment_date ADD CONSTRAINT FK_922EE93EE5B533F9 FOREIGN KEY (appointment_id) REFERENCES cal_maintenance_appointment (id)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE cal_maintenance_appointment_date DROP FOREIGN KEY FK_922EE93EE5B533F9');
$this->addSql('DROP TABLE cal_maintenance_appointment');
$this->addSql('DROP TABLE cal_maintenance_appointment_date');
}
}