migrations/Version20221025165420.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20221025165420 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $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');
  20.         $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');
  21.         $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');
  22.         $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');
  23.         $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');
  24.         $this->addSql('ALTER TABLE ref_duree_operation_travail ADD CONSTRAINT FK_790B959BDE12AB56 FOREIGN KEY (created_by) REFERENCES user (user_id)');
  25.         $this->addSql('ALTER TABLE ref_duree_operation_travail ADD CONSTRAINT FK_790B959B16FE72E1 FOREIGN KEY (updated_by) REFERENCES user (user_id)');
  26.         $this->addSql('ALTER TABLE ref_duree_operation_travail ADD CONSTRAINT FK_790B959B1F6FA0AF FOREIGN KEY (deleted_by) REFERENCES user (user_id)');
  27.         $this->addSql('ALTER TABLE ref_type_operation_travail ADD CONSTRAINT FK_33113301DE12AB56 FOREIGN KEY (created_by) REFERENCES user (user_id)');
  28.         $this->addSql('ALTER TABLE ref_type_operation_travail ADD CONSTRAINT FK_3311330116FE72E1 FOREIGN KEY (updated_by) REFERENCES user (user_id)');
  29.         $this->addSql('ALTER TABLE ref_type_operation_travail ADD CONSTRAINT FK_331133011F6FA0AF FOREIGN KEY (deleted_by) REFERENCES user (user_id)');
  30.         $this->addSql('ALTER TABLE ref_type_produit ADD CONSTRAINT FK_E5704521DE12AB56 FOREIGN KEY (created_by) REFERENCES user (user_id)');
  31.         $this->addSql('ALTER TABLE ref_type_produit ADD CONSTRAINT FK_E570452116FE72E1 FOREIGN KEY (updated_by) REFERENCES user (user_id)');
  32.         $this->addSql('ALTER TABLE ref_type_produit ADD CONSTRAINT FK_E57045211F6FA0AF FOREIGN KEY (deleted_by) REFERENCES user (user_id)');
  33.         $this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E474FB22DC FOREIGN KEY (duree_operation_travail_id) REFERENCES ref_duree_operation_travail (id)');
  34.         $this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E4E6861BBE FOREIGN KEY (type_operation_travail_id) REFERENCES ref_type_operation_travail (id)');
  35.         $this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E44433ED66 FOREIGN KEY (parcelle_id) REFERENCES tbl_parcelle (id)');
  36.         $this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E41C109075 FOREIGN KEY (personnel_id) REFERENCES tbl_personnel (id)');
  37.         $this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E4DE12AB56 FOREIGN KEY (created_by) REFERENCES user (user_id)');
  38.         $this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E416FE72E1 FOREIGN KEY (updated_by) REFERENCES user (user_id)');
  39.         $this->addSql('ALTER TABLE tbl_operation_travail ADD CONSTRAINT FK_8D4934E41F6FA0AF FOREIGN KEY (deleted_by) REFERENCES user (user_id)');
  40.         $this->addSql('ALTER TABLE tbl_parcelle ADD CONSTRAINT FK_925DCADBDE12AB56 FOREIGN KEY (created_by) REFERENCES user (user_id)');
  41.         $this->addSql('ALTER TABLE tbl_parcelle ADD CONSTRAINT FK_925DCADB16FE72E1 FOREIGN KEY (updated_by) REFERENCES user (user_id)');
  42.         $this->addSql('ALTER TABLE tbl_parcelle ADD CONSTRAINT FK_925DCADB1F6FA0AF FOREIGN KEY (deleted_by) REFERENCES user (user_id)');
  43.         $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');
  44.         $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');
  45.     }
  46.     public function down(Schema $schema): void
  47.     {
  48.         // this down() migration is auto-generated, please modify it to your needs
  49.         $this->addSql('ALTER TABLE ref_duree_operation_travail DROP FOREIGN KEY FK_790B959BDE12AB56');
  50.         $this->addSql('ALTER TABLE ref_duree_operation_travail DROP FOREIGN KEY FK_790B959B16FE72E1');
  51.         $this->addSql('ALTER TABLE ref_duree_operation_travail DROP FOREIGN KEY FK_790B959B1F6FA0AF');
  52.         $this->addSql('ALTER TABLE ref_type_operation_travail DROP FOREIGN KEY FK_33113301DE12AB56');
  53.         $this->addSql('ALTER TABLE ref_type_operation_travail DROP FOREIGN KEY FK_3311330116FE72E1');
  54.         $this->addSql('ALTER TABLE ref_type_operation_travail DROP FOREIGN KEY FK_331133011F6FA0AF');
  55.         $this->addSql('ALTER TABLE ref_type_produit DROP FOREIGN KEY FK_E5704521DE12AB56');
  56.         $this->addSql('ALTER TABLE ref_type_produit DROP FOREIGN KEY FK_E570452116FE72E1');
  57.         $this->addSql('ALTER TABLE ref_type_produit DROP FOREIGN KEY FK_E57045211F6FA0AF');
  58.         $this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E474FB22DC');
  59.         $this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E4E6861BBE');
  60.         $this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E44433ED66');
  61.         $this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E41C109075');
  62.         $this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E4DE12AB56');
  63.         $this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E416FE72E1');
  64.         $this->addSql('ALTER TABLE tbl_operation_travail DROP FOREIGN KEY FK_8D4934E41F6FA0AF');
  65.         $this->addSql('ALTER TABLE tbl_parcelle DROP FOREIGN KEY FK_925DCADBDE12AB56');
  66.         $this->addSql('ALTER TABLE tbl_parcelle DROP FOREIGN KEY FK_925DCADB16FE72E1');
  67.         $this->addSql('ALTER TABLE tbl_parcelle DROP FOREIGN KEY FK_925DCADB1F6FA0AF');
  68.         $this->addSql('ALTER TABLE tbl_parcelle_ref_type_produit DROP FOREIGN KEY FK_F9A833D1C3520DFE');
  69.         $this->addSql('ALTER TABLE tbl_parcelle_ref_type_produit DROP FOREIGN KEY FK_F9A833D182C5237E');
  70.         $this->addSql('DROP TABLE ref_duree_operation_travail');
  71.         $this->addSql('DROP TABLE ref_type_operation_travail');
  72.         $this->addSql('DROP TABLE ref_type_produit');
  73.         $this->addSql('DROP TABLE tbl_operation_travail');
  74.         $this->addSql('DROP TABLE tbl_parcelle');
  75.         $this->addSql('DROP TABLE tbl_parcelle_ref_type_produit');
  76.     }
  77. }