<?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 Version20220130222752 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 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');
$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');
$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');
$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');
$this->addSql('ALTER TABLE equipement ADD CONSTRAINT FK_B8B4C6F3F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id)');
$this->addSql('ALTER TABLE maintenance ADD CONSTRAINT FK_2F84F8E9806F0F5C FOREIGN KEY (equipement_id) REFERENCES equipement (id)');
$this->addSql('ALTER TABLE maintenance ADD CONSTRAINT FK_2F84F8E944AC3583 FOREIGN KEY (operation_id) REFERENCES operation (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE maintenance DROP FOREIGN KEY FK_2F84F8E9806F0F5C');
$this->addSql('ALTER TABLE maintenance DROP FOREIGN KEY FK_2F84F8E944AC3583');
$this->addSql('ALTER TABLE equipement DROP FOREIGN KEY FK_B8B4C6F3F6BD1646');
$this->addSql('DROP TABLE equipement');
$this->addSql('DROP TABLE maintenance');
$this->addSql('DROP TABLE operation');
$this->addSql('DROP TABLE site');
}
}