<?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 Version20220419075638 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 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');
$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');
$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');
$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');
$this->addSql('ALTER TABLE msr_equipment_msr_resource ADD CONSTRAINT FK_3716EA3DC4C08E63 FOREIGN KEY (msr_equipment_id) REFERENCES msr_equipment (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE msr_equipment_msr_resource ADD CONSTRAINT FK_3716EA3D891F82ED FOREIGN KEY (msr_resource_id) REFERENCES msr_resource (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE msr_products_msr_cable ADD CONSTRAINT FK_6B40C5F66CA79E61 FOREIGN KEY (msr_products_id) REFERENCES msr_products (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE msr_products_msr_cable ADD CONSTRAINT FK_6B40C5F6A1C8B7E FOREIGN KEY (msr_cable_id) REFERENCES msr_cable (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE msr_products_msr_resource ADD CONSTRAINT FK_31494CDA6CA79E61 FOREIGN KEY (msr_products_id) REFERENCES msr_products (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE msr_products_msr_resource ADD CONSTRAINT FK_31494CDA891F82ED FOREIGN KEY (msr_resource_id) REFERENCES msr_resource (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE msr_products_msr_cable DROP FOREIGN KEY FK_6B40C5F66CA79E61');
$this->addSql('ALTER TABLE msr_products_msr_resource DROP FOREIGN KEY FK_31494CDA6CA79E61');
$this->addSql('DROP TABLE msr_equipment_msr_resource');
$this->addSql('DROP TABLE msr_products');
$this->addSql('DROP TABLE msr_products_msr_cable');
$this->addSql('DROP TABLE msr_products_msr_resource');
}
}