<?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 Version20230417124033 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 collaborator (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, collaborator_id INT DEFAULT NULL, INDEX IDX_606D487CA76ED395 (user_id), UNIQUE INDEX UNIQ_606D487C30098C8C (collaborator_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE collaborator ADD CONSTRAINT FK_606D487CA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE collaborator ADD CONSTRAINT FK_606D487C30098C8C FOREIGN KEY (collaborator_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE file CHANGE type type VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE file_company ADD CONSTRAINT FK_14D9B074979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('ALTER TABLE file_company ADD CONSTRAINT FK_14D9B07493CB796C FOREIGN KEY (file_id) REFERENCES file (id)');
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307F9AC0396 FOREIGN KEY (conversation_id) REFERENCES conversation (id)');
$this->addSql('ALTER TABLE paiment ADD CONSTRAINT FK_DC8138F7F2DEE08 FOREIGN KEY (facture_id) REFERENCES facture (id)');
$this->addSql('ALTER TABLE participation ADD CONSTRAINT FK_AB55E24F9AC0396 FOREIGN KEY (conversation_id) REFERENCES conversation (id)');
$this->addSql('ALTER TABLE participation ADD CONSTRAINT FK_AB55E24FA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE profile ADD CONSTRAINT FK_8157AA0FA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE project ADD CONSTRAINT FK_2FB3D0EEA97D1AC3 FOREIGN KEY (enterprise_id) REFERENCES enterprise (id)');
$this->addSql('ALTER TABLE project ADD CONSTRAINT FK_2FB3D0EEF5B7AF75 FOREIGN KEY (address_id) REFERENCES address (id)');
$this->addSql('ALTER TABLE purchase ADD CONSTRAINT FK_6117D13B166D1F9C FOREIGN KEY (project_id) REFERENCES project (id)');
$this->addSql('ALTER TABLE responsable ADD CONSTRAINT FK_52520D07A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE responsable ADD CONSTRAINT FK_52520D07166D1F9C FOREIGN KEY (project_id) REFERENCES project (id)');
$this->addSql('ALTER TABLE signature ADD CONSTRAINT FK_AE88014193CB796C FOREIGN KEY (file_id) REFERENCES file (id)');
$this->addSql('ALTER TABLE user DROP INDEX UNIQ_8D93D649A97D1AC3, ADD INDEX IDX_8D93D649A97D1AC3 (enterprise_id)');
$this->addSql('ALTER TABLE user ADD collaborator TINYINT(1) DEFAULT NULL, ADD can_signe TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649F5B7AF75 FOREIGN KEY (address_id) REFERENCES address (id)');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649A97D1AC3 FOREIGN KEY (enterprise_id) REFERENCES enterprise (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE collaborator DROP FOREIGN KEY FK_606D487CA76ED395');
$this->addSql('ALTER TABLE collaborator DROP FOREIGN KEY FK_606D487C30098C8C');
$this->addSql('DROP TABLE collaborator');
$this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307FA76ED395');
$this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307F9AC0396');
$this->addSql('ALTER TABLE user DROP INDEX IDX_8D93D649A97D1AC3, ADD UNIQUE INDEX UNIQ_8D93D649A97D1AC3 (enterprise_id)');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D649F5B7AF75');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D649A97D1AC3');
$this->addSql('ALTER TABLE user DROP collaborator, DROP can_signe');
$this->addSql('ALTER TABLE purchase DROP FOREIGN KEY FK_6117D13B166D1F9C');
$this->addSql('ALTER TABLE participation DROP FOREIGN KEY FK_AB55E24F9AC0396');
$this->addSql('ALTER TABLE participation DROP FOREIGN KEY FK_AB55E24FA76ED395');
$this->addSql('ALTER TABLE signature DROP FOREIGN KEY FK_AE88014193CB796C');
$this->addSql('ALTER TABLE paiment DROP FOREIGN KEY FK_DC8138F7F2DEE08');
$this->addSql('ALTER TABLE responsable DROP FOREIGN KEY FK_52520D07A76ED395');
$this->addSql('ALTER TABLE responsable DROP FOREIGN KEY FK_52520D07166D1F9C');
$this->addSql('ALTER TABLE project DROP FOREIGN KEY FK_2FB3D0EEA97D1AC3');
$this->addSql('ALTER TABLE project DROP FOREIGN KEY FK_2FB3D0EEF5B7AF75');
$this->addSql('ALTER TABLE file_company DROP FOREIGN KEY FK_14D9B074979B1AD6');
$this->addSql('ALTER TABLE file_company DROP FOREIGN KEY FK_14D9B07493CB796C');
$this->addSql('ALTER TABLE profile DROP FOREIGN KEY FK_8157AA0FA76ED395');
$this->addSql('ALTER TABLE file CHANGE type type VARCHAR(255) DEFAULT NULL');
}
}