<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20221023154503 extends AbstractMigration
{
public function getDescription(): string
{
return 'Remove the "service_material" table.';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE service_material DROP FOREIGN KEY FK_85C82EA8ED5CA9E6');
$this->addSql('ALTER TABLE service_material DROP FOREIGN KEY FK_85C82EA8E308AC6F');
$this->addSql('DROP TABLE service_material');
}
public function down(Schema $schema): void
{
$this->addSql('CREATE TABLE service_material (id INT AUTO_INCREMENT NOT NULL, service_id INT DEFAULT NULL, material_id INT DEFAULT NULL, quantity INT DEFAULT 1 NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', deleted_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_85C82EA8ED5CA9E6 (service_id), INDEX IDX_85C82EA8E308AC6F (material_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE service_material ADD CONSTRAINT FK_85C82EA8ED5CA9E6 FOREIGN KEY (service_id) REFERENCES service (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('ALTER TABLE service_material ADD CONSTRAINT FK_85C82EA8E308AC6F FOREIGN KEY (material_id) REFERENCES material (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
}
}