migrations/Version20220503114937.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220503114937 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $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');
  20.         $this->addSql('ALTER TABLE attachment_type ADD CONSTRAINT FK_74AD4316BF396750 FOREIGN KEY (id) REFERENCES choice_element (id) ON DELETE CASCADE');
  21.         $this->addSql('ALTER TABLE recruitment_campaign_attachment_type ADD CONSTRAINT FK_6C6ECF76F639F774 FOREIGN KEY (campaign_id) REFERENCES recruitment_campaign (id)');
  22.         $this->addSql('ALTER TABLE recruitment_campaign_attachment_type ADD CONSTRAINT FK_6C6ECF76C54C8C93 FOREIGN KEY (type_id) REFERENCES attachment_type (id)');
  23.         $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');
  24.         $this->addSql('ALTER TABLE attachment ADD CONSTRAINT FK_795FD9BBC54C8C93 FOREIGN KEY (type_id) REFERENCES attachment_type (id)');
  25.         $this->addSql('ALTER TABLE attachment ADD CONSTRAINT FK_795FD9BB67C8F41D FOREIGN KEY (provider_request_id) REFERENCES provider_request (id)');
  26.         $this->addSql('ALTER TABLE attachment ADD CONSTRAINT FK_795FD9BBA53A8AA FOREIGN KEY (provider_id) REFERENCES provider (id)');
  27.         $this->addSql('ALTER TABLE attachment ADD CONSTRAINT FK_795FD9BB61C9942F FOREIGN KEY (invoice_deposit_id) REFERENCES invoice_deposit (id)');
  28.         $this->addSql('CREATE INDEX IDX_795FD9BBC54C8C93 ON attachment (type_id)');
  29.         $this->addSql('CREATE INDEX IDX_795FD9BB67C8F41D ON attachment (provider_request_id)');
  30.         $this->addSql('CREATE INDEX IDX_795FD9BBA53A8AA ON attachment (provider_id)');
  31.         $this->addSql('CREATE INDEX IDX_795FD9BB61C9942F ON attachment (invoice_deposit_id)');
  32.         $this->addSql('ALTER TABLE users_activities ADD ip VARCHAR(100) DEFAULT NULL');
  33.     }
  34.     public function down(Schema $schema): void
  35.     {
  36.         // this down() migration is auto-generated, please modify it to your needs
  37.         $this->addSql('ALTER TABLE attachment DROP FOREIGN KEY FK_795FD9BBC54C8C93');
  38.         $this->addSql('ALTER TABLE recruitment_campaign_attachment_type DROP FOREIGN KEY FK_6C6ECF76C54C8C93');
  39.         $this->addSql('DROP TABLE attachment_type');
  40.         $this->addSql('DROP TABLE recruitment_campaign_attachment_type');
  41.         $this->addSql('ALTER TABLE attachment DROP FOREIGN KEY FK_795FD9BB67C8F41D');
  42.         $this->addSql('ALTER TABLE attachment DROP FOREIGN KEY FK_795FD9BBA53A8AA');
  43.         $this->addSql('ALTER TABLE attachment DROP FOREIGN KEY FK_795FD9BB61C9942F');
  44.         $this->addSql('DROP INDEX IDX_795FD9BBC54C8C93 ON attachment');
  45.         $this->addSql('DROP INDEX IDX_795FD9BB67C8F41D ON attachment');
  46.         $this->addSql('DROP INDEX IDX_795FD9BBA53A8AA ON attachment');
  47.         $this->addSql('DROP INDEX IDX_795FD9BB61C9942F ON attachment');
  48.         $this->addSql('ALTER TABLE attachment DROP type_id, DROP provider_request_id, DROP provider_id, DROP invoice_deposit_id, DROP issue_date');
  49.         $this->addSql('ALTER TABLE users_activities DROP ip');
  50.     }
  51. }