migrations/Version20220228085901.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 Version20220228085901 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 carrier (id INT AUTO_INCREMENT NOT NULL, carrier_type_id INT NOT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_4739F11C91BFAADB (carrier_type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE carrier_type (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE carrier_zone (id INT AUTO_INCREMENT NOT NULL, carrier_id INT NOT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_F286BC8021DFC797 (carrier_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE invoice (id INT AUTO_INCREMENT NOT NULL, carrier_id INT NOT NULL, name VARCHAR(255) NOT NULL, date DATE NOT NULL, INDEX IDX_9065174421DFC797 (carrier_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('CREATE TABLE invoice_detail (id INT AUTO_INCREMENT NOT NULL, invoice_id INT NOT NULL, reference VARCHAR(255) NOT NULL, weight DOUBLE PRECISION NOT NULL, zip_dest INT NOT NULL, zip_expe INT DEFAULT NULL, surcharge_carburant DOUBLE PRECISION DEFAULT NULL, redevance_securite DOUBLE PRECISION DEFAULT NULL, livraison_samedi DOUBLE PRECISION DEFAULT NULL, relais_colis DOUBLE PRECISION DEFAULT NULL, avis_rc DOUBLE PRECISION DEFAULT NULL, zone_eloignee DOUBLE PRECISION DEFAULT NULL, hors_norme DOUBLE PRECISION DEFAULT NULL, non_mecanisable DOUBLE PRECISION DEFAULT NULL, tracking VARCHAR(255) NOT NULL, INDEX IDX_9530E2C02989F1FD (invoice_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  23.         $this->addSql('CREATE TABLE price_grid (id INT AUTO_INCREMENT NOT NULL, range_date_id INT DEFAULT NULL, carrier_zone_id INT NOT NULL, UNIQUE INDEX UNIQ_53722B8DE8BBC189 (range_date_id), INDEX IDX_53722B8DCBDF19E3 (carrier_zone_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  24.         $this->addSql('CREATE TABLE range_date (id INT AUTO_INCREMENT NOT NULL, carrier_id INT NOT NULL, begin DATE NOT NULL, end DATE NOT NULL, INDEX IDX_B8FE464321DFC797 (carrier_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  25.         $this->addSql('CREATE TABLE range_weight (id INT AUTO_INCREMENT NOT NULL, price_grid_id INT DEFAULT NULL, weight_begin DOUBLE PRECISION NOT NULL, weight_end DOUBLE PRECISION NOT NULL, price DOUBLE PRECISION NOT NULL, INDEX IDX_2E4B8B3147D7A0C9 (price_grid_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  26.         $this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, firstname VARCHAR(255) NOT NULL, lastname VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  27.         $this->addSql('CREATE TABLE zip_zone (id INT AUTO_INCREMENT NOT NULL, carrier_zone_id INT NOT NULL, zipcode VARCHAR(255) NOT NULL, INDEX IDX_765211C7CBDF19E3 (carrier_zone_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  28.         $this->addSql('ALTER TABLE carrier ADD CONSTRAINT FK_4739F11C91BFAADB FOREIGN KEY (carrier_type_id) REFERENCES carrier_type (id)');
  29.         $this->addSql('ALTER TABLE carrier_zone ADD CONSTRAINT FK_F286BC8021DFC797 FOREIGN KEY (carrier_id) REFERENCES carrier (id)');
  30.         $this->addSql('ALTER TABLE invoice ADD CONSTRAINT FK_9065174421DFC797 FOREIGN KEY (carrier_id) REFERENCES carrier (id)');
  31.         $this->addSql('ALTER TABLE invoice_detail ADD CONSTRAINT FK_9530E2C02989F1FD FOREIGN KEY (invoice_id) REFERENCES invoice (id)');
  32.         $this->addSql('ALTER TABLE price_grid ADD CONSTRAINT FK_53722B8DE8BBC189 FOREIGN KEY (range_date_id) REFERENCES range_date (id)');
  33.         $this->addSql('ALTER TABLE price_grid ADD CONSTRAINT FK_53722B8DCBDF19E3 FOREIGN KEY (carrier_zone_id) REFERENCES carrier_zone (id)');
  34.         $this->addSql('ALTER TABLE range_date ADD CONSTRAINT FK_B8FE464321DFC797 FOREIGN KEY (carrier_id) REFERENCES carrier (id)');
  35.         $this->addSql('ALTER TABLE range_weight ADD CONSTRAINT FK_2E4B8B3147D7A0C9 FOREIGN KEY (price_grid_id) REFERENCES price_grid (id)');
  36.         $this->addSql('ALTER TABLE zip_zone ADD CONSTRAINT FK_765211C7CBDF19E3 FOREIGN KEY (carrier_zone_id) REFERENCES carrier_zone (id)');
  37.     }
  38.     public function down(Schema $schema): void
  39.     {
  40.         // this down() migration is auto-generated, please modify it to your needs
  41.         $this->addSql('ALTER TABLE carrier_zone DROP FOREIGN KEY FK_F286BC8021DFC797');
  42.         $this->addSql('ALTER TABLE invoice DROP FOREIGN KEY FK_9065174421DFC797');
  43.         $this->addSql('ALTER TABLE range_date DROP FOREIGN KEY FK_B8FE464321DFC797');
  44.         $this->addSql('ALTER TABLE carrier DROP FOREIGN KEY FK_4739F11C91BFAADB');
  45.         $this->addSql('ALTER TABLE price_grid DROP FOREIGN KEY FK_53722B8DCBDF19E3');
  46.         $this->addSql('ALTER TABLE zip_zone DROP FOREIGN KEY FK_765211C7CBDF19E3');
  47.         $this->addSql('ALTER TABLE invoice_detail DROP FOREIGN KEY FK_9530E2C02989F1FD');
  48.         $this->addSql('ALTER TABLE range_weight DROP FOREIGN KEY FK_2E4B8B3147D7A0C9');
  49.         $this->addSql('ALTER TABLE price_grid DROP FOREIGN KEY FK_53722B8DE8BBC189');
  50.         $this->addSql('DROP TABLE carrier');
  51.         $this->addSql('DROP TABLE carrier_type');
  52.         $this->addSql('DROP TABLE carrier_zone');
  53.         $this->addSql('DROP TABLE invoice');
  54.         $this->addSql('DROP TABLE invoice_detail');
  55.         $this->addSql('DROP TABLE price_grid');
  56.         $this->addSql('DROP TABLE range_date');
  57.         $this->addSql('DROP TABLE range_weight');
  58.         $this->addSql('DROP TABLE user');
  59.         $this->addSql('DROP TABLE zip_zone');
  60.     }
  61. }