migrations/Version20221115081346.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 Version20221115081346 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 external_sales_history (id INT AUTO_INCREMENT NOT NULL, ym VARCHAR(6) NOT NULL, closing VARCHAR(2) NOT NULL, total INT DEFAULT NULL, filename VARCHAR(100) NOT NULL, export_date DATETIME DEFAULT NULL, create_date DATETIME NOT NULL, delete_date DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE partner ADD user_id INT DEFAULT NULL');
  20.         $this->addSql('ALTER TABLE partner ADD CONSTRAINT FK_312B3E16A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
  21.         $this->addSql('CREATE INDEX IDX_312B3E16A76ED395 ON partner (user_id)');
  22.         $this->addSql('ALTER TABLE sales ADD external_sales_history_id INT DEFAULT NULL');
  23.         $this->addSql('ALTER TABLE sales ADD CONSTRAINT FK_6B817044A71EE6B FOREIGN KEY (external_sales_history_id) REFERENCES external_sales_history (id)');
  24.         $this->addSql('CREATE INDEX IDX_6B817044A71EE6B ON sales (external_sales_history_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 sales DROP FOREIGN KEY FK_6B817044A71EE6B');
  30.         $this->addSql('DROP TABLE external_sales_history');
  31.         $this->addSql('ALTER TABLE partner DROP FOREIGN KEY FK_312B3E16A76ED395');
  32.         $this->addSql('DROP INDEX IDX_312B3E16A76ED395 ON partner');
  33.         $this->addSql('ALTER TABLE partner DROP user_id');
  34.         $this->addSql('DROP INDEX IDX_6B817044A71EE6B ON sales');
  35.         $this->addSql('ALTER TABLE sales DROP external_sales_history_id');
  36.     }
  37. }