<?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 Version20240310174330 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_etat_lapin (id INT AUTO_INCREMENT NOT NULL, libelle VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE ref_produit_ref_type_produit (ref_produit_id INT NOT NULL, ref_type_produit_id INT NOT NULL, INDEX IDX_129B1C7A9F191E5 (ref_produit_id), INDEX IDX_129B1C7A82C5237E (ref_type_produit_id), PRIMARY KEY(ref_produit_id, ref_type_produit_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE ref_type_production (id INT AUTO_INCREMENT NOT NULL, libelle VARCHAR(255) NOT NULL, nbr_jours INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE ref_type_saillie (id INT AUTO_INCREMENT NOT NULL, libelle VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE tbl_details_production (id INT AUTO_INCREMENT NOT NULL, type_id INT NOT NULL, date DATE DEFAULT NULL, etat TINYINT(1) NOT NULL, INDEX IDX_DC294916C54C8C93 (type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE tbl_production (id INT AUTO_INCREMENT NOT NULL, pere_id INT NOT NULL, mere_id INT NOT NULL, type_saillie_id INT NOT NULL, total_enfants INT DEFAULT NULL, mort_enfants INT DEFAULT NULL, INDEX IDX_BAAEFB713FD73900 (pere_id), INDEX IDX_BAAEFB7139DEC40E (mere_id), INDEX IDX_BAAEFB7155B14920 (type_saillie_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE ref_produit_ref_type_produit ADD CONSTRAINT FK_129B1C7A9F191E5 FOREIGN KEY (ref_produit_id) REFERENCES ref_produit (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE ref_produit_ref_type_produit ADD CONSTRAINT FK_129B1C7A82C5237E FOREIGN KEY (ref_type_produit_id) REFERENCES ref_type_produit (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE tbl_details_production ADD CONSTRAINT FK_DC294916C54C8C93 FOREIGN KEY (type_id) REFERENCES ref_type_production (id)');
$this->addSql('ALTER TABLE tbl_production ADD CONSTRAINT FK_BAAEFB713FD73900 FOREIGN KEY (pere_id) REFERENCES tbl_lapin_production (id)');
$this->addSql('ALTER TABLE tbl_production ADD CONSTRAINT FK_BAAEFB7139DEC40E FOREIGN KEY (mere_id) REFERENCES tbl_lapin_production (id)');
$this->addSql('ALTER TABLE tbl_production ADD CONSTRAINT FK_BAAEFB7155B14920 FOREIGN KEY (type_saillie_id) REFERENCES ref_type_saillie (id)');
$this->addSql('ALTER TABLE tbl_lapin_production DROP FOREIGN KEY FK_FA8825F29DAE278B');
$this->addSql('DROP INDEX fk_fa8825f29dae278b ON tbl_lapin_production');
$this->addSql('CREATE INDEX IDX_FA8825F29DAE278B ON tbl_lapin_production (image_lapin_id)');
$this->addSql('ALTER TABLE tbl_lapin_production ADD CONSTRAINT FK_FA8825F29DAE278B FOREIGN KEY (image_lapin_id) REFERENCES tbl_file (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE ref_produit_ref_type_produit DROP FOREIGN KEY FK_129B1C7A9F191E5');
$this->addSql('ALTER TABLE ref_produit_ref_type_produit DROP FOREIGN KEY FK_129B1C7A82C5237E');
$this->addSql('ALTER TABLE tbl_details_production DROP FOREIGN KEY FK_DC294916C54C8C93');
$this->addSql('ALTER TABLE tbl_production DROP FOREIGN KEY FK_BAAEFB713FD73900');
$this->addSql('ALTER TABLE tbl_production DROP FOREIGN KEY FK_BAAEFB7139DEC40E');
$this->addSql('ALTER TABLE tbl_production DROP FOREIGN KEY FK_BAAEFB7155B14920');
$this->addSql('DROP TABLE ref_etat_lapin');
$this->addSql('DROP TABLE ref_produit_ref_type_produit');
$this->addSql('DROP TABLE ref_type_production');
$this->addSql('DROP TABLE ref_type_saillie');
$this->addSql('DROP TABLE tbl_details_production');
$this->addSql('DROP TABLE tbl_production');
$this->addSql('ALTER TABLE lnk_tbl_mouvement_tbl_file DROP FOREIGN KEY FK_FB1949F71282B8B4');
$this->addSql('ALTER TABLE lnk_tbl_mouvement_tbl_file DROP FOREIGN KEY FK_FB1949F7C8987118');
$this->addSql('ALTER TABLE lnk_tbl_mouvement_tbl_file DROP FOREIGN KEY FK_FB1949F71282B8B4');
$this->addSql('ALTER TABLE lnk_tbl_mouvement_tbl_file DROP FOREIGN KEY FK_FB1949F7C8987118');
$this->addSql('ALTER TABLE lnk_tbl_mouvement_tbl_file ADD CONSTRAINT FK_A41CD54CC8987118 FOREIGN KEY (tbl_file_id) REFERENCES tbl_file (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE lnk_tbl_mouvement_tbl_file ADD CONSTRAINT FK_A41CD54C1282B8B4 FOREIGN KEY (tbl_mouvement_id) REFERENCES tbl_mouvement (id) ON DELETE CASCADE');
$this->addSql('DROP INDEX idx_fb1949f7c8987118 ON lnk_tbl_mouvement_tbl_file');
$this->addSql('CREATE INDEX IDX_A41CD54CC8987118 ON lnk_tbl_mouvement_tbl_file (tbl_file_id)');
$this->addSql('DROP INDEX idx_fb1949f71282b8b4 ON lnk_tbl_mouvement_tbl_file');
$this->addSql('CREATE INDEX IDX_A41CD54C1282B8B4 ON lnk_tbl_mouvement_tbl_file (tbl_mouvement_id)');
$this->addSql('ALTER TABLE lnk_tbl_mouvement_tbl_file ADD CONSTRAINT FK_FB1949F71282B8B4 FOREIGN KEY (tbl_mouvement_id) REFERENCES tbl_mouvement (id)');
$this->addSql('ALTER TABLE lnk_tbl_mouvement_tbl_file ADD CONSTRAINT FK_FB1949F7C8987118 FOREIGN KEY (tbl_file_id) REFERENCES tbl_file (id)');
$this->addSql('ALTER TABLE lnk_operationTravail_parcelle DROP FOREIGN KEY FK_96102F094433ED66');
$this->addSql('ALTER TABLE lnk_operationTravail_parcelle ADD CONSTRAINT FK_96102F094433ED66 FOREIGN KEY (parcelle_id) REFERENCES tbl_parcelle (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE lnk_tbl_mouvementCaisse_tbl_file DROP FOREIGN KEY FK_3A38EAF68997C6E');
$this->addSql('ALTER TABLE lnk_tbl_mouvementCaisse_tbl_file DROP FOREIGN KEY FK_3A38EAF693CB796C');
$this->addSql('DROP INDEX idx_3a38eaf693cb796c ON lnk_tbl_mouvementCaisse_tbl_file');
$this->addSql('CREATE INDEX IDX_3A38EAF6C8987118 ON lnk_tbl_mouvementCaisse_tbl_file (file_id)');
$this->addSql('DROP INDEX idx_3a38eaf68997c6e ON lnk_tbl_mouvementCaisse_tbl_file');
$this->addSql('CREATE INDEX IDX_3A38EAF616268FC8 ON lnk_tbl_mouvementCaisse_tbl_file (mouvementCaisse_id)');
$this->addSql('ALTER TABLE lnk_tbl_mouvementCaisse_tbl_file ADD CONSTRAINT FK_3A38EAF68997C6E FOREIGN KEY (mouvementCaisse_id) REFERENCES tbl_mouvement_caisse (id)');
$this->addSql('ALTER TABLE lnk_tbl_mouvementCaisse_tbl_file ADD CONSTRAINT FK_3A38EAF693CB796C FOREIGN KEY (file_id) REFERENCES tbl_file (id)');
$this->addSql('ALTER TABLE tbl_lapin_production DROP FOREIGN KEY FK_FA8825F29DAE278B');
$this->addSql('DROP INDEX idx_fa8825f29dae278b ON tbl_lapin_production');
$this->addSql('CREATE INDEX FK_FA8825F29DAE278B ON tbl_lapin_production (image_lapin_id)');
$this->addSql('ALTER TABLE tbl_lapin_production ADD CONSTRAINT FK_FA8825F29DAE278B FOREIGN KEY (image_lapin_id) REFERENCES tbl_file (id)');
$this->addSql('ALTER TABLE lnk_moyen_transport_tbl_operation_vente DROP FOREIGN KEY FK_F5DAEC47860E9B21');
$this->addSql('ALTER TABLE lnk_moyen_transport_tbl_operation_vente DROP FOREIGN KEY FK_F5DAEC476C645A7F');
$this->addSql('DROP INDEX `PRIMARY` ON lnk_moyen_transport_tbl_operation_vente');
$this->addSql('ALTER TABLE lnk_moyen_transport_tbl_operation_vente DROP FOREIGN KEY FK_F5DAEC47860E9B21');
$this->addSql('ALTER TABLE lnk_moyen_transport_tbl_operation_vente DROP FOREIGN KEY FK_F5DAEC476C645A7F');
$this->addSql('ALTER TABLE lnk_moyen_transport_tbl_operation_vente ADD CONSTRAINT FK_6B7C3D42860E9B21 FOREIGN KEY (tbl_operation_vente_id) REFERENCES tbl_operation_vente (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE lnk_moyen_transport_tbl_operation_vente ADD CONSTRAINT FK_6B7C3D426C645A7F FOREIGN KEY (ref_moyen_transport_id) REFERENCES ref_moyen_transport (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE lnk_moyen_transport_tbl_operation_vente ADD PRIMARY KEY (ref_moyen_transport_id, tbl_operation_vente_id)');
$this->addSql('DROP INDEX idx_f5daec47860e9b21 ON lnk_moyen_transport_tbl_operation_vente');
$this->addSql('CREATE INDEX IDX_6B7C3D42860E9B21 ON lnk_moyen_transport_tbl_operation_vente (tbl_operation_vente_id)');
$this->addSql('DROP INDEX idx_f5daec476c645a7f ON lnk_moyen_transport_tbl_operation_vente');
$this->addSql('CREATE INDEX IDX_6B7C3D426C645A7F ON lnk_moyen_transport_tbl_operation_vente (ref_moyen_transport_id)');
$this->addSql('ALTER TABLE lnk_moyen_transport_tbl_operation_vente ADD CONSTRAINT FK_F5DAEC47860E9B21 FOREIGN KEY (tbl_operation_vente_id) REFERENCES tbl_operation_vente (id)');
$this->addSql('ALTER TABLE lnk_moyen_transport_tbl_operation_vente ADD CONSTRAINT FK_F5DAEC476C645A7F FOREIGN KEY (ref_moyen_transport_id) REFERENCES ref_moyen_transport (id)');
$this->addSql('ALTER TABLE tbl_mouvement ADD parcelle_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE tbl_mouvement ADD CONSTRAINT FK_1ED993AD4433ED66 FOREIGN KEY (parcelle_id) REFERENCES tbl_parcelle (id)');
$this->addSql('CREATE INDEX IDX_1ED993AD4433ED66 ON tbl_mouvement (parcelle_id)');
}
}