migrations/Version20220419075638.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 Version20220419075638 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 msr_equipment_msr_resource (msr_equipment_id INT NOT NULL, msr_resource_id INT NOT NULL, INDEX IDX_3716EA3DC4C08E63 (msr_equipment_id), INDEX IDX_3716EA3D891F82ED (msr_resource_id), PRIMARY KEY(msr_equipment_id, msr_resource_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE msr_products (id INT AUTO_INCREMENT NOT NULL, bezeichnung VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, price_ek DOUBLE PRECISION DEFAULT NULL, version VARCHAR(10) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE msr_products_msr_cable (msr_products_id INT NOT NULL, msr_cable_id INT NOT NULL, INDEX IDX_6B40C5F66CA79E61 (msr_products_id), INDEX IDX_6B40C5F6A1C8B7E (msr_cable_id), PRIMARY KEY(msr_products_id, msr_cable_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE msr_products_msr_resource (msr_products_id INT NOT NULL, msr_resource_id INT NOT NULL, INDEX IDX_31494CDA6CA79E61 (msr_products_id), INDEX IDX_31494CDA891F82ED (msr_resource_id), PRIMARY KEY(msr_products_id, msr_resource_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('ALTER TABLE msr_equipment_msr_resource ADD CONSTRAINT FK_3716EA3DC4C08E63 FOREIGN KEY (msr_equipment_id) REFERENCES msr_equipment (id) ON DELETE CASCADE');
  23.         $this->addSql('ALTER TABLE msr_equipment_msr_resource ADD CONSTRAINT FK_3716EA3D891F82ED FOREIGN KEY (msr_resource_id) REFERENCES msr_resource (id) ON DELETE CASCADE');
  24.         $this->addSql('ALTER TABLE msr_products_msr_cable ADD CONSTRAINT FK_6B40C5F66CA79E61 FOREIGN KEY (msr_products_id) REFERENCES msr_products (id) ON DELETE CASCADE');
  25.         $this->addSql('ALTER TABLE msr_products_msr_cable ADD CONSTRAINT FK_6B40C5F6A1C8B7E FOREIGN KEY (msr_cable_id) REFERENCES msr_cable (id) ON DELETE CASCADE');
  26.         $this->addSql('ALTER TABLE msr_products_msr_resource ADD CONSTRAINT FK_31494CDA6CA79E61 FOREIGN KEY (msr_products_id) REFERENCES msr_products (id) ON DELETE CASCADE');
  27.         $this->addSql('ALTER TABLE msr_products_msr_resource ADD CONSTRAINT FK_31494CDA891F82ED FOREIGN KEY (msr_resource_id) REFERENCES msr_resource (id) ON DELETE CASCADE');
  28.     }
  29.     public function down(Schema $schema): void
  30.     {
  31.         // this down() migration is auto-generated, please modify it to your needs
  32.         $this->addSql('ALTER TABLE msr_products_msr_cable DROP FOREIGN KEY FK_6B40C5F66CA79E61');
  33.         $this->addSql('ALTER TABLE msr_products_msr_resource DROP FOREIGN KEY FK_31494CDA6CA79E61');
  34.         $this->addSql('DROP TABLE msr_equipment_msr_resource');
  35.         $this->addSql('DROP TABLE msr_products');
  36.         $this->addSql('DROP TABLE msr_products_msr_cable');
  37.         $this->addSql('DROP TABLE msr_products_msr_resource');
  38.     }
  39. }