migrations/Version20220130222752.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 Version20220130222752 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 equipement (id INT AUTO_INCREMENT NOT NULL, site_id INT DEFAULT NULL, type_equipement VARCHAR(255) DEFAULT NULL, categorie VARCHAR(255) DEFAULT NULL, sous_categorie VARCHAR(255) DEFAULT NULL, libelle VARCHAR(255) DEFAULT NULL, compteur_km INT DEFAULT NULL, date_compteur_km DATE DEFAULT NULL, compteur_h INT DEFAULT NULL, date_compteur_h DATE DEFAULT NULL, ref_equipement VARCHAR(255) DEFAULT NULL, url_photo VARCHAR(255) DEFAULT NULL, responsable VARCHAR(255) DEFAULT NULL, sn_chassis VARCHAR(255) DEFAULT NULL, sn_carrossage VARCHAR(255) DEFAULT NULL, date_ini DATE DEFAULT NULL, commentaire VARCHAR(255) DEFAULT NULL, no_parc VARCHAR(10) NOT NULL, INDEX IDX_B8B4C6F3F6BD1646 (site_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19. $this->addSql('CREATE TABLE maintenance (id INT AUTO_INCREMENT NOT NULL, equipement_id INT NOT NULL, operation_id INT NOT NULL, compteur_km INT DEFAULT NULL, compteur_h INT DEFAULT NULL, date DATE DEFAULT NULL, validation TINYINT(1) DEFAULT NULL, commentaire VARCHAR(255) DEFAULT NULL, contrat VARCHAR(255) DEFAULT NULL, date_contrat DATE DEFAULT NULL, INDEX IDX_2F84F8E9806F0F5C (equipement_id), INDEX IDX_2F84F8E944AC3583 (operation_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20. $this->addSql('CREATE TABLE operation (id INT AUTO_INCREMENT NOT NULL, type_operation VARCHAR(255) DEFAULT NULL, categorie VARCHAR(255) DEFAULT NULL, sous_categorie VARCHAR(255) DEFAULT NULL, code_operation VARCHAR(10) DEFAULT NULL, libelle VARCHAR(255) DEFAULT NULL, periode_cpt_km INT DEFAULT NULL, alerte_cpt_km INT DEFAULT NULL, periode_cpt_h INT DEFAULT NULL, alerte_cpt_h INT DEFAULT NULL, periode_date INT DEFAULT NULL, alerte_date INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21. $this->addSql('CREATE TABLE site (id INT AUTO_INCREMENT NOT NULL, libelle VARCHAR(255) DEFAULT NULL, adr VARCHAR(255) DEFAULT NULL, tel VARCHAR(255) DEFAULT NULL, fax VARCHAR(255) DEFAULT NULL, courriel VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22. $this->addSql('ALTER TABLE equipement ADD CONSTRAINT FK_B8B4C6F3F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id)');
  23. $this->addSql('ALTER TABLE maintenance ADD CONSTRAINT FK_2F84F8E9806F0F5C FOREIGN KEY (equipement_id) REFERENCES equipement (id)');
  24. $this->addSql('ALTER TABLE maintenance ADD CONSTRAINT FK_2F84F8E944AC3583 FOREIGN KEY (operation_id) REFERENCES operation (id)');
  25. }
  26. public function down(Schema $schema): void
  27. {
  28. // this down() migration is auto-generated, please modify it to your needs
  29. $this->addSql('ALTER TABLE maintenance DROP FOREIGN KEY FK_2F84F8E9806F0F5C');
  30. $this->addSql('ALTER TABLE maintenance DROP FOREIGN KEY FK_2F84F8E944AC3583');
  31. $this->addSql('ALTER TABLE equipement DROP FOREIGN KEY FK_B8B4C6F3F6BD1646');
  32. $this->addSql('DROP TABLE equipement');
  33. $this->addSql('DROP TABLE maintenance');
  34. $this->addSql('DROP TABLE operation');
  35. $this->addSql('DROP TABLE site');
  36. }
  37. }