vendor/bluue/suppliers-bundle/migrations/Version20231220121748.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace SuppliersBundleMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. final class Version20231220121748 extends AbstractMigration
  7. {
  8.     public function up(Schema $schema): void
  9.     {
  10.         $this->addSql('CREATE TABLE suppliers_bundle__quantity_threshold (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_supplier_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', updated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', deleted_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', wholesale_price NUMERIC(20, 6) NOT NULL, quantity NUMERIC(20, 6) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_F814809E86F2F393 (product_supplier_id), INDEX IDX_F814809EB03A8386 (created_by_id), INDEX IDX_F814809E896DBBDE (updated_by_id), INDEX IDX_F814809EC76F1F52 (deleted_by_id), INDEX wholesale_price (wholesale_price), INDEX quantity (quantity), INDEX deleted_at (deleted_at), INDEX created_at (created_at), INDEX updated_at (updated_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  11.         $this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold ADD CONSTRAINT FK_F814809E86F2F393 FOREIGN KEY (product_supplier_id) REFERENCES suppliers_bundle__product_supplier (id)');
  12.         $this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold ADD CONSTRAINT FK_F814809EB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
  13.         $this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold ADD CONSTRAINT FK_F814809E896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
  14.         $this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold ADD CONSTRAINT FK_F814809EC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
  15.         $this->addSql('ALTER TABLE suppliers_bundle__product_supplier ADD commission NUMERIC(20, 6) DEFAULT NULL');
  16.         $this->addSql('CREATE INDEX commission ON suppliers_bundle__product_supplier (commission)');
  17.     }
  18.     public function down(Schema $schema): void
  19.     {
  20.         $this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold DROP FOREIGN KEY FK_F814809E86F2F393');
  21.         $this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold DROP FOREIGN KEY FK_F814809EB03A8386');
  22.         $this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold DROP FOREIGN KEY FK_F814809E896DBBDE');
  23.         $this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold DROP FOREIGN KEY FK_F814809EC76F1F52');
  24.         $this->addSql('DROP TABLE suppliers_bundle__quantity_threshold');
  25.         $this->addSql('DROP INDEX commission ON suppliers_bundle__product_supplier');
  26.         $this->addSql('ALTER TABLE suppliers_bundle__product_supplier DROP commission');
  27.     }
  28. }