migrations/Version20220128123436.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 Version20220128123436 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 end_user (id INT AUTO_INCREMENT NOT NULL, country_id INT DEFAULT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, address VARCHAR(255) NOT NULL, apartment VARCHAR(255) NOT NULL, zip VARCHAR(255) NOT NULL, city VARCHAR(255) NOT NULL, active TINYINT(1) DEFAULT \'1\' NOT NULL, INDEX IDX_A3515A0DF92F3E70 (country_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE orders (id INT AUTO_INCREMENT NOT NULL, payment_provider_id INT DEFAULT NULL, shipping_provider_id INT DEFAULT NULL, end_user_id INT DEFAULT NULL, product_id INT DEFAULT NULL, shipping_status VARCHAR(255) NOT NULL, payment_status VARCHAR(255) NOT NULL, product_name VARCHAR(255) NOT NULL, product_variant_name VARCHAR(255) NOT NULL, count INT NOT NULL, discount INT DEFAULT NULL, total_price NUMERIC(10, 0) NOT NULL, sale_supply_id VARCHAR(255) DEFAULT NULL, terms_and_conditions VARCHAR(255) NOT NULL, payment_id VARCHAR(255) DEFAULT NULL, status VARCHAR(255) DEFAULT NULL, INDEX IDX_E52FFDEEFCDF7870 (payment_provider_id), INDEX IDX_E52FFDEE86382F09 (shipping_provider_id), INDEX IDX_E52FFDEE32A1827C (end_user_id), INDEX IDX_E52FFDEE4584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE end_user ADD CONSTRAINT FK_A3515A0DF92F3E70 FOREIGN KEY (country_id) REFERENCES country (id)');
  21.         $this->addSql('ALTER TABLE orders ADD CONSTRAINT FK_E52FFDEEFCDF7870 FOREIGN KEY (payment_provider_id) REFERENCES payment_provider (id)');
  22.         $this->addSql('ALTER TABLE orders ADD CONSTRAINT FK_E52FFDEE86382F09 FOREIGN KEY (shipping_provider_id) REFERENCES shipping_provider (id)');
  23.         $this->addSql('ALTER TABLE orders ADD CONSTRAINT FK_E52FFDEE32A1827C FOREIGN KEY (end_user_id) REFERENCES end_user (id)');
  24.         $this->addSql('ALTER TABLE orders ADD CONSTRAINT FK_E52FFDEE4584665A FOREIGN KEY (product_id) REFERENCES product (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 orders DROP FOREIGN KEY FK_E52FFDEE32A1827C');
  30.         $this->addSql('DROP TABLE end_user');
  31.         $this->addSql('DROP TABLE orders');
  32.     }
  33. }