<?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 Version20220914124335 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 request_modification (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, responsable_id INT NOT NULL, company_id INT DEFAULT NULL, text VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, deleted TINYINT(1) NOT NULL, is_read TINYINT(1) NOT NULL, INDEX IDX_F44E7C0AB03A8386 (created_by_id), INDEX IDX_F44E7C0A53C59D72 (responsable_id), INDEX IDX_F44E7C0A979B1AD6 (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE request_modification_status (id INT AUTO_INCREMENT NOT NULL, request_modification_id INT NOT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_B46477B379381A7F (request_modification_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE request_modification ADD CONSTRAINT FK_F44E7C0AB03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE request_modification ADD CONSTRAINT FK_F44E7C0A53C59D72 FOREIGN KEY (responsable_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE request_modification ADD CONSTRAINT FK_F44E7C0A979B1AD6 FOREIGN KEY (company_id) REFERENCES establishments (id)');
$this->addSql('ALTER TABLE request_modification_status ADD CONSTRAINT FK_B46477B379381A7F FOREIGN KEY (request_modification_id) REFERENCES request_modification (id)');
$this->addSql('ALTER TABLE establishments ADD responsable_id INT NOT NULL');
$this->addSql('ALTER TABLE establishments ADD CONSTRAINT FK_5C67EFC553C59D72 FOREIGN KEY (responsable_id) REFERENCES users (id)');
$this->addSql('CREATE INDEX IDX_5C67EFC553C59D72 ON establishments (responsable_id)');
$this->addSql('ALTER TABLE users ADD my_responsable_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE users ADD CONSTRAINT FK_1483A5E9F2C67B7C FOREIGN KEY (my_responsable_id) REFERENCES users (id)');
$this->addSql('CREATE INDEX IDX_1483A5E9F2C67B7C ON users (my_responsable_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE request_modification DROP FOREIGN KEY FK_F44E7C0AB03A8386');
$this->addSql('ALTER TABLE request_modification DROP FOREIGN KEY FK_F44E7C0A53C59D72');
$this->addSql('ALTER TABLE request_modification DROP FOREIGN KEY FK_F44E7C0A979B1AD6');
$this->addSql('ALTER TABLE request_modification_status DROP FOREIGN KEY FK_B46477B379381A7F');
$this->addSql('DROP TABLE request_modification');
$this->addSql('DROP TABLE request_modification_status');
$this->addSql('ALTER TABLE establishments DROP FOREIGN KEY FK_5C67EFC553C59D72');
$this->addSql('DROP INDEX IDX_5C67EFC553C59D72 ON establishments');
$this->addSql('ALTER TABLE establishments DROP responsable_id');
$this->addSql('ALTER TABLE users DROP FOREIGN KEY FK_1483A5E9F2C67B7C');
$this->addSql('DROP INDEX IDX_1483A5E9F2C67B7C ON users');
$this->addSql('ALTER TABLE users DROP my_responsable_id');
}
}