<?php
declare(strict_types=1);
namespace CoreMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220318133337 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE suppliers_bundle__supplier_address (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', supplier_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', country_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', country_state_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)\', alias VARCHAR(255) DEFAULT NULL, address VARCHAR(255) DEFAULT NULL, address2 VARCHAR(255) DEFAULT NULL, city VARCHAR(128) DEFAULT NULL, postcode VARCHAR(32) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_2052C0582ADD6D8C (supplier_id), INDEX IDX_2052C058F92F3E70 (country_id), INDEX IDX_2052C05836126D7C (country_state_id), INDEX IDX_2052C058B03A8386 (created_by_id), INDEX IDX_2052C058896DBBDE (updated_by_id), INDEX IDX_2052C058C76F1F52 (deleted_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE suppliers_bundle__supplier_contact (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', supplier_id BINARY(16) NOT 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)\', firstname VARCHAR(128) DEFAULT NULL, lastname VARCHAR(128) DEFAULT NULL, phone VARCHAR(32) DEFAULT NULL, mobile_phone VARCHAR(32) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, fax VARCHAR(255) DEFAULT NULL, work_post VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_617E49E12ADD6D8C (supplier_id), INDEX IDX_617E49E1B03A8386 (created_by_id), INDEX IDX_617E49E1896DBBDE (updated_by_id), INDEX IDX_617E49E1C76F1F52 (deleted_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE suppliers_bundle__supplier_address ADD CONSTRAINT FK_2052C0582ADD6D8C FOREIGN KEY (supplier_id) REFERENCES suppliers_bundle__supplier (id)');
$this->addSql('ALTER TABLE suppliers_bundle__supplier_address ADD CONSTRAINT FK_2052C058F92F3E70 FOREIGN KEY (country_id) REFERENCES country (id)');
$this->addSql('ALTER TABLE suppliers_bundle__supplier_address ADD CONSTRAINT FK_2052C05836126D7C FOREIGN KEY (country_state_id) REFERENCES country_state (id)');
$this->addSql('ALTER TABLE suppliers_bundle__supplier_address ADD CONSTRAINT FK_2052C058B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE suppliers_bundle__supplier_address ADD CONSTRAINT FK_2052C058896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE suppliers_bundle__supplier_address ADD CONSTRAINT FK_2052C058C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE suppliers_bundle__supplier_contact ADD CONSTRAINT FK_617E49E12ADD6D8C FOREIGN KEY (supplier_id) REFERENCES suppliers_bundle__supplier (id)');
$this->addSql('ALTER TABLE suppliers_bundle__supplier_contact ADD CONSTRAINT FK_617E49E1B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE suppliers_bundle__supplier_contact ADD CONSTRAINT FK_617E49E1896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE suppliers_bundle__supplier_contact ADD CONSTRAINT FK_617E49E1C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE currency CHANGE change_rate change_rate NUMERIC(20, 12) DEFAULT \'1\' NOT NULL');
$this->addSql('DROP INDEX email ON suppliers_bundle__supplier');
$this->addSql('DROP INDEX mobile_phone ON suppliers_bundle__supplier');
$this->addSql('DROP INDEX phone ON suppliers_bundle__supplier');
$this->addSql('CREATE INDEX activity ON suppliers_bundle__supplier (activity)');
$this->addSql('ALTER TABLE suppliers_orders_bundle__receipt_note_line ADD stock_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', ADD warehouse_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', ADD location_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', ADD sub_location_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE suppliers_orders_bundle__receipt_note_line ADD CONSTRAINT FK_2C547A1EDCD6110 FOREIGN KEY (stock_id) REFERENCES stocks_bundle__stock (id)');
$this->addSql('ALTER TABLE suppliers_orders_bundle__receipt_note_line ADD CONSTRAINT FK_2C547A1E5080ECDE FOREIGN KEY (warehouse_id) REFERENCES stocks_bundle__warehouse (id)');
$this->addSql('ALTER TABLE suppliers_orders_bundle__receipt_note_line ADD CONSTRAINT FK_2C547A1E64D218E FOREIGN KEY (location_id) REFERENCES stocks_bundle__location (id)');
$this->addSql('ALTER TABLE suppliers_orders_bundle__receipt_note_line ADD CONSTRAINT FK_2C547A1EE3B45410 FOREIGN KEY (sub_location_id) REFERENCES stocks_bundle__sub_location (id)');
$this->addSql('CREATE INDEX IDX_2C547A1EDCD6110 ON suppliers_orders_bundle__receipt_note_line (stock_id)');
$this->addSql('CREATE INDEX IDX_2C547A1E5080ECDE ON suppliers_orders_bundle__receipt_note_line (warehouse_id)');
$this->addSql('CREATE INDEX IDX_2C547A1E64D218E ON suppliers_orders_bundle__receipt_note_line (location_id)');
$this->addSql('CREATE INDEX IDX_2C547A1EE3B45410 ON suppliers_orders_bundle__receipt_note_line (sub_location_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE suppliers_bundle__supplier_address');
$this->addSql('DROP TABLE suppliers_bundle__supplier_contact');
$this->addSql('ALTER TABLE currency CHANGE change_rate change_rate NUMERIC(20, 12) DEFAULT \'1.000000000000\' NOT NULL');
$this->addSql('DROP INDEX activity ON suppliers_bundle__supplier');
$this->addSql('CREATE INDEX email ON suppliers_bundle__supplier (email)');
$this->addSql('CREATE INDEX mobile_phone ON suppliers_bundle__supplier (mobile_phone)');
$this->addSql('CREATE INDEX phone ON suppliers_bundle__supplier (phone)');
$this->addSql('ALTER TABLE suppliers_orders_bundle__receipt_note_line DROP FOREIGN KEY FK_2C547A1EDCD6110');
$this->addSql('ALTER TABLE suppliers_orders_bundle__receipt_note_line DROP FOREIGN KEY FK_2C547A1E5080ECDE');
$this->addSql('ALTER TABLE suppliers_orders_bundle__receipt_note_line DROP FOREIGN KEY FK_2C547A1E64D218E');
$this->addSql('ALTER TABLE suppliers_orders_bundle__receipt_note_line DROP FOREIGN KEY FK_2C547A1EE3B45410');
$this->addSql('DROP INDEX IDX_2C547A1EDCD6110 ON suppliers_orders_bundle__receipt_note_line');
$this->addSql('DROP INDEX IDX_2C547A1E5080ECDE ON suppliers_orders_bundle__receipt_note_line');
$this->addSql('DROP INDEX IDX_2C547A1E64D218E ON suppliers_orders_bundle__receipt_note_line');
$this->addSql('DROP INDEX IDX_2C547A1EE3B45410 ON suppliers_orders_bundle__receipt_note_line');
$this->addSql('ALTER TABLE suppliers_orders_bundle__receipt_note_line DROP stock_id, DROP warehouse_id, DROP location_id, DROP sub_location_id');
}
}