migrations/Version20211020060536.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 Version20211020060536 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Added company_demand table';
  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 company_demand (id INT AUTO_INCREMENT NOT NULL, demand_id INT NOT NULL, company_id INT NOT NULL, selected TINYINT(1) NOT NULL, INDEX IDX_7F121D065D022E59 (demand_id), INDEX IDX_7F121D06979B1AD6 (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE company_demand ADD CONSTRAINT FK_7F121D065D022E59 FOREIGN KEY (demand_id) REFERENCES demand (id)');
  20.         $this->addSql('ALTER TABLE company_demand ADD CONSTRAINT FK_7F121D06979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
  21.         $this->addSql('ALTER TABLE demand DROP FOREIGN KEY FK_428D7973979B1AD6');
  22.         $this->addSql('DROP INDEX IDX_428D7973979B1AD6 ON demand');
  23.         $this->addSql('ALTER TABLE demand DROP company_id');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('DROP TABLE company_demand');
  29.         $this->addSql('ALTER TABLE demand ADD company_id INT DEFAULT NULL');
  30.         $this->addSql('ALTER TABLE demand ADD CONSTRAINT FK_428D7973979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
  31.         $this->addSql('CREATE INDEX IDX_428D7973979B1AD6 ON demand (company_id)');
  32.     }
  33. }