<?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 Version20221013162946 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_intervention (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, roommate_id INT DEFAULT NULL, maintenance_id INT DEFAULT NULL, document_id INT DEFAULT NULL, status VARCHAR(50) NOT NULL, date DATETIME DEFAULT NULL, time_start TIME DEFAULT NULL, time_end TIME DEFAULT NULL, description LONGTEXT DEFAULT NULL, equipment LONGTEXT DEFAULT NULL, finished LONGTEXT DEFAULT NULL, new_appointment LONGTEXT DEFAULT NULL, comment LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, INDEX IDX_A61A0281A76ED395 (user_id), INDEX IDX_A61A0281957252FA (roommate_id), INDEX IDX_A61A0281F6C202BC (maintenance_id), UNIQUE INDEX UNIQ_A61A0281C33F7837 (document_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE cal_signature (id INT AUTO_INCREMENT NOT NULL, intervention_id INT DEFAULT NULL, user_id INT DEFAULT NULL, status VARCHAR(50) NOT NULL, date DATETIME DEFAULT NULL, created_at DATETIME NOT NULL, INDEX IDX_55EA1CA08EAE3863 (intervention_id), INDEX IDX_55EA1CA0A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE cal_maintenance_intervention ADD CONSTRAINT FK_A61A0281A76ED395 FOREIGN KEY (user_id) REFERENCES cal_user (id)');
$this->addSql('ALTER TABLE cal_maintenance_intervention ADD CONSTRAINT FK_A61A0281957252FA FOREIGN KEY (roommate_id) REFERENCES cal_user (id)');
$this->addSql('ALTER TABLE cal_maintenance_intervention ADD CONSTRAINT FK_A61A0281F6C202BC FOREIGN KEY (maintenance_id) REFERENCES cal_maintenance (id)');
$this->addSql('ALTER TABLE cal_maintenance_intervention ADD CONSTRAINT FK_A61A0281C33F7837 FOREIGN KEY (document_id) REFERENCES cal_maintenance_document (id)');
$this->addSql('ALTER TABLE cal_signature ADD CONSTRAINT FK_55EA1CA08EAE3863 FOREIGN KEY (intervention_id) REFERENCES cal_maintenance_intervention (id)');
$this->addSql('ALTER TABLE cal_signature ADD CONSTRAINT FK_55EA1CA0A76ED395 FOREIGN KEY (user_id) REFERENCES cal_user (id)');
$this->addSql('ALTER TABLE cal_room_item ADD is_important TINYINT(1) NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE cal_maintenance_intervention DROP FOREIGN KEY FK_A61A0281A76ED395');
$this->addSql('ALTER TABLE cal_maintenance_intervention DROP FOREIGN KEY FK_A61A0281957252FA');
$this->addSql('ALTER TABLE cal_maintenance_intervention DROP FOREIGN KEY FK_A61A0281F6C202BC');
$this->addSql('ALTER TABLE cal_maintenance_intervention DROP FOREIGN KEY FK_A61A0281C33F7837');
$this->addSql('ALTER TABLE cal_signature DROP FOREIGN KEY FK_55EA1CA08EAE3863');
$this->addSql('ALTER TABLE cal_signature DROP FOREIGN KEY FK_55EA1CA0A76ED395');
$this->addSql('DROP TABLE cal_maintenance_intervention');
$this->addSql('DROP TABLE cal_signature');
$this->addSql('ALTER TABLE cal_room_item DROP is_important');
}
}