<?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 Version20220914142725 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 service_material (id INT AUTO_INCREMENT NOT NULL, service_id INT NOT NULL, material_id INT NOT 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)\', UNIQUE INDEX UNIQ_85C82EA8ED5CA9E6 (service_id), UNIQUE INDEX UNIQ_85C82EA8E308AC6F (material_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE service_material ADD CONSTRAINT FK_85C82EA8ED5CA9E6 FOREIGN KEY (service_id) REFERENCES service (id)');
$this->addSql('ALTER TABLE service_material ADD CONSTRAINT FK_85C82EA8E308AC6F FOREIGN KEY (material_id) REFERENCES material (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE service_material DROP FOREIGN KEY FK_85C82EA8E308AC6F');
$this->addSql('ALTER TABLE service_material DROP FOREIGN KEY FK_85C82EA8ED5CA9E6');
$this->addSql('DROP TABLE service_material');
}
}