migrations/Version20220313212218.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 Version20220313212218 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 product_in (id INT AUTO_INCREMENT NOT NULL, product_id INT NOT NULL, user_id INT DEFAULT NULL, date DATE NOT NULL, updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', qty INT NOT NULL, INDEX IDX_A5518F444584665A (product_id), INDEX IDX_A5518F44A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE product_out (id INT AUTO_INCREMENT NOT NULL, product_id INT DEFAULT NULL, user_id INT DEFAULT NULL, qty INT NOT NULL, date DATE NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_59C539864584665A (product_id), INDEX IDX_59C53986A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE supplier (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, address VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, phone VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('ALTER TABLE product_in ADD CONSTRAINT FK_A5518F444584665A FOREIGN KEY (product_id) REFERENCES product (id)');
  22.         $this->addSql('ALTER TABLE product_in ADD CONSTRAINT FK_A5518F44A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
  23.         $this->addSql('ALTER TABLE product_out ADD CONSTRAINT FK_59C539864584665A FOREIGN KEY (product_id) REFERENCES product (id)');
  24.         $this->addSql('ALTER TABLE product_out ADD CONSTRAINT FK_59C53986A76ED395 FOREIGN KEY (user_id) REFERENCES user (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('DROP TABLE product_in');
  30.         $this->addSql('DROP TABLE product_out');
  31.         $this->addSql('DROP TABLE supplier');
  32.     }
  33. }