<?php
declare(strict_types=1);
namespace SuppliersBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20231220121748 extends AbstractMigration
{
public function up(Schema $schema): void
{
$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');
$this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold ADD CONSTRAINT FK_F814809E86F2F393 FOREIGN KEY (product_supplier_id) REFERENCES suppliers_bundle__product_supplier (id)');
$this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold ADD CONSTRAINT FK_F814809EB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold ADD CONSTRAINT FK_F814809E896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold ADD CONSTRAINT FK_F814809EC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE suppliers_bundle__product_supplier ADD commission NUMERIC(20, 6) DEFAULT NULL');
$this->addSql('CREATE INDEX commission ON suppliers_bundle__product_supplier (commission)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold DROP FOREIGN KEY FK_F814809E86F2F393');
$this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold DROP FOREIGN KEY FK_F814809EB03A8386');
$this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold DROP FOREIGN KEY FK_F814809E896DBBDE');
$this->addSql('ALTER TABLE suppliers_bundle__quantity_threshold DROP FOREIGN KEY FK_F814809EC76F1F52');
$this->addSql('DROP TABLE suppliers_bundle__quantity_threshold');
$this->addSql('DROP INDEX commission ON suppliers_bundle__product_supplier');
$this->addSql('ALTER TABLE suppliers_bundle__product_supplier DROP commission');
}
}