<?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 Version20240624083551 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('ALTER TABLE lait_traitement CHANGE nom nom VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_produit_categorie');
$this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_produit_lait');
$this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_produit_lait_traitement');
$this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_produit_origine');
$this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_produit_type');
$this->addSql('ALTER TABLE produit CHANGE prix_unitaire prix_unitaire DOUBLE PRECISION DEFAULT NULL, CHANGE photo photo VARCHAR(255) DEFAULT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_29A5EC27989D9B62 ON produit (slug)');
$this->addSql('DROP INDEX idx_29a5ec278a3c7387 ON produit');
$this->addSql('CREATE INDEX IDX_29A5EC27BCF5E72D ON produit (categorie_id)');
$this->addSql('DROP INDEX idx_29a5ec27714819a0 ON produit');
$this->addSql('CREATE INDEX IDX_29A5EC27C54C8C93 ON produit (type_id)');
$this->addSql('DROP INDEX idx_29a5ec275eb5d46a ON produit');
$this->addSql('CREATE INDEX IDX_29A5EC2787998E ON produit (origine_id)');
$this->addSql('DROP INDEX idx_29a5ec27f07485af ON produit');
$this->addSql('CREATE INDEX IDX_29A5EC27FBAD1BC5 ON produit (lait_id)');
$this->addSql('DROP INDEX IDX_29A5EC27F07486FG ON produit');
$this->addSql('CREATE INDEX IDX_29A5EC27A338A393 ON produit (lait_traitement_id)');
$this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_produit_categorie FOREIGN KEY (categorie_id) REFERENCES categorie (id) ON UPDATE NO ACTION ON DELETE SET NULL');
$this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_produit_lait FOREIGN KEY (lait_id) REFERENCES lait (id) ON UPDATE NO ACTION ON DELETE SET NULL');
$this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_produit_lait_traitement FOREIGN KEY (lait_traitement_id) REFERENCES lait_traitement (id) ON UPDATE NO ACTION ON DELETE SET NULL');
$this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_produit_origine FOREIGN KEY (origine_id) REFERENCES origine (id) ON UPDATE NO ACTION ON DELETE SET NULL');
$this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_produit_type FOREIGN KEY (type_id) REFERENCES type (id) ON UPDATE NO ACTION ON DELETE SET NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE lait_traitement CHANGE nom nom VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL COLLATE `latin1_swedish_ci`');
$this->addSql('DROP INDEX UNIQ_29A5EC27989D9B62 ON produit');
$this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_29A5EC27BCF5E72D');
$this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_29A5EC27C54C8C93');
$this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_29A5EC2787998E');
$this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_29A5EC27FBAD1BC5');
$this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_29A5EC27A338A393');
$this->addSql('ALTER TABLE produit CHANGE prix_unitaire prix_unitaire DOUBLE PRECISION NOT NULL, CHANGE photo photo VARCHAR(255) CHARACTER SET utf8mb3 NOT NULL COLLATE `utf8mb3_general_ci`');
$this->addSql('DROP INDEX idx_29a5ec2787998e ON produit');
$this->addSql('CREATE INDEX IDX_29A5EC275EB5D46A ON produit (origine_id)');
$this->addSql('DROP INDEX idx_29a5ec27c54c8c93 ON produit');
$this->addSql('CREATE INDEX IDX_29A5EC27714819A0 ON produit (type_id)');
$this->addSql('DROP INDEX idx_29a5ec27bcf5e72d ON produit');
$this->addSql('CREATE INDEX IDX_29A5EC278A3C7387 ON produit (categorie_id)');
$this->addSql('DROP INDEX idx_29a5ec27fbad1bc5 ON produit');
$this->addSql('CREATE INDEX IDX_29A5EC27F07485AF ON produit (lait_id)');
$this->addSql('DROP INDEX idx_29a5ec27a338a393 ON produit');
$this->addSql('CREATE INDEX IDX_29A5EC27F07486FG ON produit (lait_traitement_id)');
$this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_29A5EC27BCF5E72D FOREIGN KEY (categorie_id) REFERENCES categorie (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_29A5EC27C54C8C93 FOREIGN KEY (type_id) REFERENCES type (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_29A5EC2787998E FOREIGN KEY (origine_id) REFERENCES origine (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_29A5EC27FBAD1BC5 FOREIGN KEY (lait_id) REFERENCES lait (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_29A5EC27A338A393 FOREIGN KEY (lait_traitement_id) REFERENCES lait_traitement (id) ON DELETE SET NULL');
}
}