<?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 Version20231030125747 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 colonne (id INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE couleur (id INT AUTO_INCREMENT NOT NULL, libelle VARCHAR(10) NOT NULL, code VARCHAR(7) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE famille (id INT AUTO_INCREMENT NOT NULL, couleur_id INT NOT NULL, libelle VARCHAR(255) NOT NULL, INDEX IDX_2473F213C31BA576 (couleur_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE historique_donnee (id INT NOT NULL, annee INT NOT NULL, parcelle_id VARCHAR(255) NOT NULL, colonne_id INT NOT NULL, valeur VARCHAR(255) NOT NULL, INDEX IDX_4C65C0004433ED66 (parcelle_id), INDEX IDX_4C65C000213EAC9D (colonne_id), PRIMARY KEY(id, annee, parcelle_id, colonne_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE historique_plan (annee INT NOT NULL, partie_id INT NOT NULL, legume_id INT DEFAULT NULL, engrais TINYINT(1) NOT NULL, INDEX IDX_59037C9FE075F7A4 (partie_id), INDEX IDX_59037C9F25F18E37 (legume_id), PRIMARY KEY(annee, partie_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE legume (id INT AUTO_INCREMENT NOT NULL, type_id INT NOT NULL, famille_id INT DEFAULT NULL, nom VARCHAR(30) NOT NULL, INDEX IDX_86667383C54C8C93 (type_id), INDEX IDX_8666738397A77B84 (famille_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE parcelle (id VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, viewbox VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE partie (id INT AUTO_INCREMENT NOT NULL, parcelle_id VARCHAR(255) NOT NULL, svg VARCHAR(255) NOT NULL, svg_detail VARCHAR(255) NOT NULL, INDEX IDX_59B1F3D4433ED66 (parcelle_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE type (id INT AUTO_INCREMENT NOT NULL, couleur_id INT NOT NULL, libelle VARCHAR(255) NOT NULL, INDEX IDX_8CDE5729C31BA576 (couleur_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649F85E0677 (username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL, available_at DATETIME NOT NULL, delivered_at DATETIME DEFAULT NULL, INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE famille ADD CONSTRAINT FK_2473F213C31BA576 FOREIGN KEY (couleur_id) REFERENCES couleur (id)');
$this->addSql('ALTER TABLE historique_donnee ADD CONSTRAINT FK_4C65C0004433ED66 FOREIGN KEY (parcelle_id) REFERENCES parcelle (id)');
$this->addSql('ALTER TABLE historique_donnee ADD CONSTRAINT FK_4C65C000213EAC9D FOREIGN KEY (colonne_id) REFERENCES colonne (id)');
$this->addSql('ALTER TABLE historique_plan ADD CONSTRAINT FK_59037C9FE075F7A4 FOREIGN KEY (partie_id) REFERENCES partie (id)');
$this->addSql('ALTER TABLE historique_plan ADD CONSTRAINT FK_59037C9F25F18E37 FOREIGN KEY (legume_id) REFERENCES legume (id)');
$this->addSql('ALTER TABLE legume ADD CONSTRAINT FK_86667383C54C8C93 FOREIGN KEY (type_id) REFERENCES type (id)');
$this->addSql('ALTER TABLE legume ADD CONSTRAINT FK_8666738397A77B84 FOREIGN KEY (famille_id) REFERENCES famille (id)');
$this->addSql('ALTER TABLE partie ADD CONSTRAINT FK_59B1F3D4433ED66 FOREIGN KEY (parcelle_id) REFERENCES parcelle (id)');
$this->addSql('ALTER TABLE type ADD CONSTRAINT FK_8CDE5729C31BA576 FOREIGN KEY (couleur_id) REFERENCES couleur (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE famille DROP FOREIGN KEY FK_2473F213C31BA576');
$this->addSql('ALTER TABLE historique_donnee DROP FOREIGN KEY FK_4C65C0004433ED66');
$this->addSql('ALTER TABLE historique_donnee DROP FOREIGN KEY FK_4C65C000213EAC9D');
$this->addSql('ALTER TABLE historique_plan DROP FOREIGN KEY FK_59037C9FE075F7A4');
$this->addSql('ALTER TABLE historique_plan DROP FOREIGN KEY FK_59037C9F25F18E37');
$this->addSql('ALTER TABLE legume DROP FOREIGN KEY FK_86667383C54C8C93');
$this->addSql('ALTER TABLE legume DROP FOREIGN KEY FK_8666738397A77B84');
$this->addSql('ALTER TABLE partie DROP FOREIGN KEY FK_59B1F3D4433ED66');
$this->addSql('ALTER TABLE type DROP FOREIGN KEY FK_8CDE5729C31BA576');
$this->addSql('DROP TABLE colonne');
$this->addSql('DROP TABLE couleur');
$this->addSql('DROP TABLE famille');
$this->addSql('DROP TABLE historique_donnee');
$this->addSql('DROP TABLE historique_plan');
$this->addSql('DROP TABLE legume');
$this->addSql('DROP TABLE parcelle');
$this->addSql('DROP TABLE partie');
$this->addSql('DROP TABLE type');
$this->addSql('DROP TABLE user');
$this->addSql('DROP TABLE messenger_messages');
}
}