migrations/Version20230509160715.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 Version20230509160715 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 basket (id INT AUTO_INCREMENT NOT NULL, user_of_id INT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', total_price DOUBLE PRECISION DEFAULT NULL, status VARCHAR(255) NOT NULL, payment_method VARCHAR(255) NOT NULL, INDEX IDX_2246507BB8CF5824 (user_of_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE config (id INT AUTO_INCREMENT NOT NULL, label VARCHAR(255) NOT NULL, value VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE contact (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, mail VARCHAR(255) NOT NULL, phone VARCHAR(255) NOT NULL, message LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE place_parking (id INT AUTO_INCREMENT NOT NULL, nbre_place INT NOT NULL, start_date DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', end_date DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('CREATE TABLE temp_file (id INT AUTO_INCREMENT NOT NULL, file_entity_id INT NOT NULL, identifiant VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_2596B95AF2AC22B (file_entity_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  23.         $this->addSql('CREATE TABLE vehicles (id INT AUTO_INCREMENT NOT NULL, user_of_id INT DEFAULT NULL, model VARCHAR(254) NOT NULL, immatriculation VARCHAR(254) NOT NULL, handicap TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_1FCE69FAB8CF5824 (user_of_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  24.         $this->addSql('ALTER TABLE basket ADD CONSTRAINT FK_2246507BB8CF5824 FOREIGN KEY (user_of_id) REFERENCES `user` (id)');
  25.         $this->addSql('ALTER TABLE temp_file ADD CONSTRAINT FK_2596B95AF2AC22B FOREIGN KEY (file_entity_id) REFERENCES file (id)');
  26.         $this->addSql('ALTER TABLE vehicles ADD CONSTRAINT FK_1FCE69FAB8CF5824 FOREIGN KEY (user_of_id) REFERENCES `user` (id)');
  27.     }
  28.     public function down(Schema $schema): void
  29.     {
  30.         // this down() migration is auto-generated, please modify it to your needs
  31.         $this->addSql('ALTER TABLE basket DROP FOREIGN KEY FK_2246507BB8CF5824');
  32.         $this->addSql('ALTER TABLE temp_file DROP FOREIGN KEY FK_2596B95AF2AC22B');
  33.         $this->addSql('ALTER TABLE vehicles DROP FOREIGN KEY FK_1FCE69FAB8CF5824');
  34.         $this->addSql('DROP TABLE basket');
  35.         $this->addSql('DROP TABLE config');
  36.         $this->addSql('DROP TABLE contact');
  37.         $this->addSql('DROP TABLE place_parking');
  38.         $this->addSql('DROP TABLE temp_file');
  39.         $this->addSql('DROP TABLE vehicles');
  40.     }
  41. }