<?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 Version20251008130630 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 eaf_educ_jardin_potager DROP CONSTRAINT fk_85b65ca35cb73291');
$this->addSql('ALTER TABLE educ_parcelle_commune DROP CONSTRAINT fk_5178fb435cb73291');
$this->addSql('DROP SEQUENCE educ_speculation_id_seq CASCADE');
$this->addSql('DROP TABLE educ_speculation');
$this->addSql('DROP INDEX idx_85b65ca35cb73291');
$this->addSql('ALTER TABLE eaf_educ_jardin_potager ADD speculation VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE eaf_educ_jardin_potager ADD unite_sup_emblave VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE eaf_educ_jardin_potager ADD unite_qte_semence VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE eaf_educ_jardin_potager ADD technique_diffuse VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE eaf_educ_jardin_potager RENAME COLUMN speculation_id TO education_id');
$this->addSql('ALTER TABLE eaf_educ_jardin_potager ADD CONSTRAINT FK_85B65CA32CA1BD71 FOREIGN KEY (education_id) REFERENCES education_nutritionnelle (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_85B65CA32CA1BD71 ON eaf_educ_jardin_potager (education_id)');
$this->addSql('DROP INDEX idx_5178fb435cb73291');
$this->addSql('ALTER TABLE educ_parcelle_commune ADD speculation VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE educ_parcelle_commune ADD unite_qte_recolte VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE educ_parcelle_commune DROP speculation_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('CREATE SEQUENCE educ_speculation_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE educ_speculation (id INT NOT NULL, libelle VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('ALTER TABLE eaf_educ_jardin_potager DROP CONSTRAINT FK_85B65CA32CA1BD71');
$this->addSql('DROP INDEX IDX_85B65CA32CA1BD71');
$this->addSql('ALTER TABLE eaf_educ_jardin_potager DROP speculation');
$this->addSql('ALTER TABLE eaf_educ_jardin_potager DROP unite_sup_emblave');
$this->addSql('ALTER TABLE eaf_educ_jardin_potager DROP unite_qte_semence');
$this->addSql('ALTER TABLE eaf_educ_jardin_potager DROP technique_diffuse');
$this->addSql('ALTER TABLE eaf_educ_jardin_potager RENAME COLUMN education_id TO speculation_id');
$this->addSql('ALTER TABLE eaf_educ_jardin_potager ADD CONSTRAINT fk_85b65ca35cb73291 FOREIGN KEY (speculation_id) REFERENCES educ_speculation (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_85b65ca35cb73291 ON eaf_educ_jardin_potager (speculation_id)');
$this->addSql('ALTER TABLE educ_parcelle_commune ADD speculation_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE educ_parcelle_commune DROP speculation');
$this->addSql('ALTER TABLE educ_parcelle_commune DROP unite_qte_recolte');
$this->addSql('ALTER TABLE educ_parcelle_commune ADD CONSTRAINT fk_5178fb435cb73291 FOREIGN KEY (speculation_id) REFERENCES educ_speculation (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_5178fb435cb73291 ON educ_parcelle_commune (speculation_id)');
}
}