<?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 Version20221204174719 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 ref_unite (id INT AUTO_INCREMENT NOT NULL, unite VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE ref_type_produit ADD unite_id INT NOT NULL');
$this->addSql('ALTER TABLE ref_type_produit ADD CONSTRAINT FK_E5704521EC4A74AB FOREIGN KEY (unite_id) REFERENCES ref_unite (id)');
$this->addSql('CREATE INDEX IDX_E5704521EC4A74AB ON ref_type_produit (unite_id)');
$this->addSql('ALTER TABLE tbl_mouvement ADD entrepot_id INT NOT NULL');
$this->addSql('ALTER TABLE tbl_mouvement ADD CONSTRAINT FK_1ED993AD72831E97 FOREIGN KEY (entrepot_id) REFERENCES ref_type_stock (id)');
$this->addSql('CREATE INDEX IDX_1ED993AD72831E97 ON tbl_mouvement (entrepot_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE ref_type_produit DROP FOREIGN KEY FK_E5704521EC4A74AB');
$this->addSql('DROP TABLE ref_unite');
$this->addSql('DROP INDEX IDX_E5704521EC4A74AB ON ref_type_produit');
$this->addSql('ALTER TABLE ref_type_produit DROP unite_id');
$this->addSql('ALTER TABLE tbl_mouvement DROP FOREIGN KEY FK_1ED993AD72831E97');
$this->addSql('DROP INDEX IDX_1ED993AD72831E97 ON tbl_mouvement');
$this->addSql('ALTER TABLE tbl_mouvement DROP entrepot_id');
}
}