<?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 Version20221025165420 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_duree_operation_travail (id INT AUTO_INCREMENT NOT NULL, created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, deleted_by INT DEFAULT NULL, duree_operation VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', deleted_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_790B959BDE12AB56 (created_by), INDEX IDX_790B959B16FE72E1 (updated_by), INDEX IDX_790B959B1F6FA0AF (deleted_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE ref_type_operation_travail (id INT AUTO_INCREMENT NOT NULL, created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, deleted_by INT DEFAULT NULL, type_operation VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', deleted_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_33113301DE12AB56 (created_by), INDEX IDX_3311330116FE72E1 (updated_by), INDEX IDX_331133011F6FA0AF (deleted_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE ref_type_produit (id INT AUTO_INCREMENT NOT NULL, created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, deleted_by INT DEFAULT NULL, produit_lib VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', deleted_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_E5704521DE12AB56 (created_by), INDEX IDX_E570452116FE72E1 (updated_by), INDEX IDX_E57045211F6FA0AF (deleted_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE tbl_operation_travail (id INT AUTO_INCREMENT NOT NULL, duree_operation_travail_id INT NOT NULL, type_operation_travail_id INT NOT NULL, parcelle_id INT NOT NULL, personnel_id INT NOT NULL, created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, deleted_by INT DEFAULT NULL, heure_debut TIME NOT NULL, heure_fin TIME NOT NULL, date_operation DATE NOT NULL, created_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', deleted_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_8D4934E474FB22DC (duree_operation_travail_id), INDEX IDX_8D4934E4E6861BBE (type_operation_travail_id), INDEX IDX_8D4934E44433ED66 (parcelle_id), INDEX IDX_8D4934E41C109075 (personnel_id), INDEX IDX_8D4934E4DE12AB56 (created_by), INDEX IDX_8D4934E416FE72E1 (updated_by), INDEX IDX_8D4934E41F6FA0AF (deleted_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE tbl_parcelle (id INT AUTO_INCREMENT NOT NULL, created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, deleted_by INT DEFAULT NULL, parcelle VARCHAR(255) NOT NULL, surface_hectare INT DEFAULT NULL, created_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', deleted_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_925DCADBDE12AB56 (created_by), INDEX IDX_925DCADB16FE72E1 (updated_by), INDEX IDX_925DCADB1F6FA0AF (deleted_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE tbl_parcelle_ref_type_produit (tbl_parcelle_id INT NOT NULL, ref_type_produit_id INT NOT NULL, INDEX IDX_F9A833D1C3520DFE (tbl_parcelle_id), INDEX IDX_F9A833D182C5237E (ref_type_produit_id), PRIMARY KEY(tbl_parcelle_id, ref_type_produit_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE ref_duree_operation_travail ADD CONSTRAINT FK_790B959BDE12AB56 FOREIGN KEY (created_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE ref_duree_operation_travail ADD CONSTRAINT FK_790B959B16FE72E1 FOREIGN KEY (updated_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE ref_duree_operation_travail ADD CONSTRAINT FK_790B959B1F6FA0AF FOREIGN KEY (deleted_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE ref_type_operation_travail ADD CONSTRAINT FK_33113301DE12AB56 FOREIGN KEY (created_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE ref_type_operation_travail ADD CONSTRAINT FK_3311330116FE72E1 FOREIGN KEY (updated_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE ref_type_operation_travail ADD CONSTRAINT FK_331133011F6FA0AF FOREIGN KEY (deleted_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE ref_type_produit ADD CONSTRAINT FK_E5704521DE12AB56 FOREIGN KEY (created_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE ref_type_produit ADD CONSTRAINT FK_E570452116FE72E1 FOREIGN KEY (updated_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE ref_type_produit ADD CONSTRAINT FK_E57045211F6FA0AF FOREIGN KEY (deleted_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E474FB22DC FOREIGN KEY (duree_operation_travail_id) REFERENCES ref_duree_operation_travail (id)');
$this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E4E6861BBE FOREIGN KEY (type_operation_travail_id) REFERENCES ref_type_operation_travail (id)');
$this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E44433ED66 FOREIGN KEY (parcelle_id) REFERENCES tbl_parcelle (id)');
$this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E41C109075 FOREIGN KEY (personnel_id) REFERENCES tbl_personnel (id)');
$this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E4DE12AB56 FOREIGN KEY (created_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E416FE72E1 FOREIGN KEY (updated_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E41F6FA0AF FOREIGN KEY (deleted_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE tbl_parcelle ADD CONSTRAINT FK_925DCADBDE12AB56 FOREIGN KEY (created_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE tbl_parcelle ADD CONSTRAINT FK_925DCADB16FE72E1 FOREIGN KEY (updated_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE tbl_parcelle ADD CONSTRAINT FK_925DCADB1F6FA0AF FOREIGN KEY (deleted_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE tbl_parcelle_ref_type_produit ADD CONSTRAINT FK_F9A833D1C3520DFE FOREIGN KEY (tbl_parcelle_id) REFERENCES tbl_parcelle (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE tbl_parcelle_ref_type_produit ADD CONSTRAINT FK_F9A833D182C5237E FOREIGN KEY (ref_type_produit_id) REFERENCES ref_type_produit (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE ref_duree_operation_travail DROP FOREIGN KEY FK_790B959BDE12AB56');
$this->addSql('ALTER TABLE ref_duree_operation_travail DROP FOREIGN KEY FK_790B959B16FE72E1');
$this->addSql('ALTER TABLE ref_duree_operation_travail DROP FOREIGN KEY FK_790B959B1F6FA0AF');
$this->addSql('ALTER TABLE ref_type_operation_travail DROP FOREIGN KEY FK_33113301DE12AB56');
$this->addSql('ALTER TABLE ref_type_operation_travail DROP FOREIGN KEY FK_3311330116FE72E1');
$this->addSql('ALTER TABLE ref_type_operation_travail DROP FOREIGN KEY FK_331133011F6FA0AF');
$this->addSql('ALTER TABLE ref_type_produit DROP FOREIGN KEY FK_E5704521DE12AB56');
$this->addSql('ALTER TABLE ref_type_produit DROP FOREIGN KEY FK_E570452116FE72E1');
$this->addSql('ALTER TABLE ref_type_produit DROP FOREIGN KEY FK_E57045211F6FA0AF');
$this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E474FB22DC');
$this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E4E6861BBE');
$this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E44433ED66');
$this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E41C109075');
$this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E4DE12AB56');
$this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E416FE72E1');
$this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E41F6FA0AF');
$this->addSql('ALTER TABLE tbl_parcelle DROP FOREIGN KEY FK_925DCADBDE12AB56');
$this->addSql('ALTER TABLE tbl_parcelle DROP FOREIGN KEY FK_925DCADB16FE72E1');
$this->addSql('ALTER TABLE tbl_parcelle DROP FOREIGN KEY FK_925DCADB1F6FA0AF');
$this->addSql('ALTER TABLE tbl_parcelle_ref_type_produit DROP FOREIGN KEY FK_F9A833D1C3520DFE');
$this->addSql('ALTER TABLE tbl_parcelle_ref_type_produit DROP FOREIGN KEY FK_F9A833D182C5237E');
$this->addSql('DROP TABLE ref_duree_operation_travail');
$this->addSql('DROP TABLE ref_type_operation_travail');
$this->addSql('DROP TABLE ref_type_produit');
$this->addSql('DROP TABLE tbl_operation_travail');
$this->addSql('DROP TABLE tbl_parcelle');
$this->addSql('DROP TABLE tbl_parcelle_ref_type_produit');
}
}