migrations/Version20231116070037.php line 1

  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 Version20231116070037 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 incident (id INT AUTO_INCREMENT NOT NULL, location_id INT DEFAULT NULL, service_id INT DEFAULT NULL, code VARCHAR(100) NOT NULL, process VARCHAR(25) NOT NULL, status TINYINT(1) NOT NULL, INDEX IDX_3D03A11A64D218E (location_id), INDEX IDX_3D03A11AED5CA9E6 (service_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE prestataire (id INT AUTO_INCREMENT NOT NULL, code VARCHAR(100) NOT NULL, fullname VARCHAR(50) NOT NULL, phone VARCHAR(25) NOT NULL, email VARCHAR(50) DEFAULT NULL, adress VARCHAR(100) DEFAULT NULL, status TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE service (id INT AUTO_INCREMENT NOT NULL, code VARCHAR(100) NOT NULL, name VARCHAR(50) NOT NULL, status TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('ALTER TABLE incident ADD CONSTRAINT FK_3D03A11A64D218E FOREIGN KEY (location_id) REFERENCES location (id)');
  22.         $this->addSql('ALTER TABLE incident ADD CONSTRAINT FK_3D03A11AED5CA9E6 FOREIGN KEY (service_id) REFERENCES service (id)');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('ALTER TABLE incident DROP FOREIGN KEY FK_3D03A11A64D218E');
  28.         $this->addSql('ALTER TABLE incident DROP FOREIGN KEY FK_3D03A11AED5CA9E6');
  29.         $this->addSql('DROP TABLE incident');
  30.         $this->addSql('DROP TABLE prestataire');
  31.         $this->addSql('DROP TABLE service');
  32.     }
  33. }