<?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 Version20220503114937 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 attachment_type (id INT NOT NULL, period_of_validity INT DEFAULT NULL, is_require_for_invoice TINYINT(1) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE recruitment_campaign_attachment_type (id INT AUTO_INCREMENT NOT NULL, campaign_id INT NOT NULL, type_id INT NOT NULL, INDEX IDX_6C6ECF76F639F774 (campaign_id), INDEX IDX_6C6ECF76C54C8C93 (type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE attachment_type ADD CONSTRAINT FK_74AD4316BF396750 FOREIGN KEY (id) REFERENCES choice_element (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE recruitment_campaign_attachment_type ADD CONSTRAINT FK_6C6ECF76F639F774 FOREIGN KEY (campaign_id) REFERENCES recruitment_campaign (id)');
$this->addSql('ALTER TABLE recruitment_campaign_attachment_type ADD CONSTRAINT FK_6C6ECF76C54C8C93 FOREIGN KEY (type_id) REFERENCES attachment_type (id)');
$this->addSql('ALTER TABLE attachment ADD type_id INT DEFAULT NULL, ADD provider_request_id INT DEFAULT NULL, ADD provider_id INT DEFAULT NULL, ADD invoice_deposit_id INT DEFAULT NULL, ADD issue_date DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE attachment ADD CONSTRAINT FK_795FD9BBC54C8C93 FOREIGN KEY (type_id) REFERENCES attachment_type (id)');
$this->addSql('ALTER TABLE attachment ADD CONSTRAINT FK_795FD9BB67C8F41D FOREIGN KEY (provider_request_id) REFERENCES provider_request (id)');
$this->addSql('ALTER TABLE attachment ADD CONSTRAINT FK_795FD9BBA53A8AA FOREIGN KEY (provider_id) REFERENCES provider (id)');
$this->addSql('ALTER TABLE attachment ADD CONSTRAINT FK_795FD9BB61C9942F FOREIGN KEY (invoice_deposit_id) REFERENCES invoice_deposit (id)');
$this->addSql('CREATE INDEX IDX_795FD9BBC54C8C93 ON attachment (type_id)');
$this->addSql('CREATE INDEX IDX_795FD9BB67C8F41D ON attachment (provider_request_id)');
$this->addSql('CREATE INDEX IDX_795FD9BBA53A8AA ON attachment (provider_id)');
$this->addSql('CREATE INDEX IDX_795FD9BB61C9942F ON attachment (invoice_deposit_id)');
$this->addSql('ALTER TABLE users_activities ADD ip VARCHAR(100) DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE attachment DROP FOREIGN KEY FK_795FD9BBC54C8C93');
$this->addSql('ALTER TABLE recruitment_campaign_attachment_type DROP FOREIGN KEY FK_6C6ECF76C54C8C93');
$this->addSql('DROP TABLE attachment_type');
$this->addSql('DROP TABLE recruitment_campaign_attachment_type');
$this->addSql('ALTER TABLE attachment DROP FOREIGN KEY FK_795FD9BB67C8F41D');
$this->addSql('ALTER TABLE attachment DROP FOREIGN KEY FK_795FD9BBA53A8AA');
$this->addSql('ALTER TABLE attachment DROP FOREIGN KEY FK_795FD9BB61C9942F');
$this->addSql('DROP INDEX IDX_795FD9BBC54C8C93 ON attachment');
$this->addSql('DROP INDEX IDX_795FD9BB67C8F41D ON attachment');
$this->addSql('DROP INDEX IDX_795FD9BBA53A8AA ON attachment');
$this->addSql('DROP INDEX IDX_795FD9BB61C9942F ON attachment');
$this->addSql('ALTER TABLE attachment DROP type_id, DROP provider_request_id, DROP provider_id, DROP invoice_deposit_id, DROP issue_date');
$this->addSql('ALTER TABLE users_activities DROP ip');
}
}