<?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 Version20220601082305 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 accounting_bundle__account (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)\', name VARCHAR(128) NOT NULL, number VARCHAR(32) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_F422CBC796901F54 (number), INDEX IDX_F422CBC7B03A8386 (created_by_id), INDEX IDX_F422CBC7896DBBDE (updated_by_id), INDEX IDX_F422CBC7C76F1F52 (deleted_by_id), INDEX name (name), INDEX number (number), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE accounting_bundle__account_translations (id INT AUTO_INCREMENT NOT NULL, object_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', locale VARCHAR(8) NOT NULL, field VARCHAR(32) NOT NULL, content LONGTEXT DEFAULT NULL, INDEX IDX_1A196C21232D562B (object_id), UNIQUE INDEX lookup_unique_idx (locale, object_id, field), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE accounting_bundle__customer_account (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', customer_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)\', number VARCHAR(32) DEFAULT NULL, auxiliary_number VARCHAR(32) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_1AAE13969395C3F3 (customer_id), INDEX IDX_1AAE1396B03A8386 (created_by_id), INDEX IDX_1AAE1396896DBBDE (updated_by_id), INDEX IDX_1AAE1396C76F1F52 (deleted_by_id), INDEX number (number), INDEX auxiliary_number (auxiliary_number), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE accounting_bundle__product_account (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)\', product_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', sales_number VARCHAR(32) DEFAULT NULL, purchases_number VARCHAR(32) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_58256FDEB03A8386 (created_by_id), INDEX IDX_58256FDE896DBBDE (updated_by_id), INDEX IDX_58256FDEC76F1F52 (deleted_by_id), INDEX IDX_58256FDE4584665A (product_id), INDEX sales_number (sales_number), INDEX purchases_number (purchases_number), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE accounting_bundle__account ADD CONSTRAINT FK_F422CBC7B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE accounting_bundle__account ADD CONSTRAINT FK_F422CBC7896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE accounting_bundle__account ADD CONSTRAINT FK_F422CBC7C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE accounting_bundle__account_translations ADD CONSTRAINT FK_1A196C21232D562B FOREIGN KEY (object_id) REFERENCES accounting_bundle__account (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE accounting_bundle__customer_account ADD CONSTRAINT FK_1AAE13969395C3F3 FOREIGN KEY (customer_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE accounting_bundle__customer_account ADD CONSTRAINT FK_1AAE1396B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE accounting_bundle__customer_account ADD CONSTRAINT FK_1AAE1396896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE accounting_bundle__customer_account ADD CONSTRAINT FK_1AAE1396C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE accounting_bundle__product_account ADD CONSTRAINT FK_58256FDEB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE accounting_bundle__product_account ADD CONSTRAINT FK_58256FDE896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE accounting_bundle__product_account ADD CONSTRAINT FK_58256FDEC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE accounting_bundle__product_account ADD CONSTRAINT FK_58256FDE4584665A FOREIGN KEY (product_id) REFERENCES products_bundle__product (id)');
$this->addSql('ALTER TABLE currency CHANGE change_rate change_rate NUMERIC(20, 12) DEFAULT \'1\' NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE accounting_bundle__account_translations DROP FOREIGN KEY FK_1A196C21232D562B');
$this->addSql('DROP TABLE accounting_bundle__account');
$this->addSql('DROP TABLE accounting_bundle__account_translations');
$this->addSql('DROP TABLE accounting_bundle__customer_account');
$this->addSql('DROP TABLE accounting_bundle__product_account');
$this->addSql('ALTER TABLE currency CHANGE change_rate change_rate NUMERIC(20, 12) DEFAULT \'1.000000000000\' NOT NULL');
}
}