<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20211115164618 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('ALTER TABLE cash_account_movement DROP FOREIGN KEY FK_8C51940F9C8502E8');
$this->addSql('ALTER TABLE accounting_entry DROP FOREIGN KEY FK_DB6C942A2B5CA896');
$this->addSql('DROP TABLE accounting_entry');
$this->addSql('DROP TABLE iva_aliquot');
$this->addSql('DROP TABLE order_payment');
$this->addSql('DROP TABLE receipt');
$this->addSql('DROP INDEX IDX_D46F56919C8502E8 ON cash_account_movement');
$this->addSql('ALTER TABLE cash_account_movement DROP idAccountingEntry');
$this->addSql('ALTER TABLE trackings CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE accounting_entry (id INT AUTO_INCREMENT NOT NULL, order_id INT DEFAULT NULL, receipt_id INT DEFAULT NULL, customer_id INT DEFAULT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, date DATETIME NOT NULL, entryType VARCHAR(20) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, authorizationCode VARCHAR(50) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`, total NUMERIC(10, 2) NOT NULL, currentTotal NUMERIC(10, 2) NOT NULL, comment TEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, paidUp NUMERIC(10, 2) DEFAULT NULL, idPaymentMethod INT DEFAULT NULL, idCreditCard INT DEFAULT NULL, idPaymentTransaction INT DEFAULT NULL, idBank INT DEFAULT NULL, INDEX IDX_DB6C942AAB9DE1E4 (idBank), INDEX IDX_DB6C942A8D9F6D38 (order_id), INDEX IDX_DB6C942AB03A8386 (created_by_id), INDEX IDX_DB6C942AD6C214F9 (idCreditCard), INDEX IDX_DB6C942AC2C29D6C (idPaymentTransaction), INDEX IDX_DB6C942A9395C3F3 (customer_id), UNIQUE INDEX UNIQ_DB6C942A2B5CA896 (receipt_id), INDEX IDX_DB6C942A4E60B956 (idPaymentMethod), INDEX IDX_DB6C942A896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE iva_aliquot (id INT AUTO_INCREMENT NOT NULL, name INT NOT NULL, value NUMERIC(10, 2) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE order_payment (id INT AUTO_INCREMENT NOT NULL, order_id INT DEFAULT NULL, payment_id INT DEFAULT NULL, UNIQUE INDEX UNIQ_9B522D464C3A3BB (payment_id), INDEX IDX_9B522D468D9F6D38 (order_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE receipt (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, email TINYINT(1) NOT NULL, INDEX IDX_5399B645896DBBDE (updated_by_id), INDEX IDX_5399B645B03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE accounting_entry ADD CONSTRAINT FK_DB6C942A2B5CA896 FOREIGN KEY (receipt_id) REFERENCES receipt (id)');
$this->addSql('ALTER TABLE accounting_entry ADD CONSTRAINT FK_DB6C942A4E60B956 FOREIGN KEY (idPaymentMethod) REFERENCES payment_method (id)');
$this->addSql('ALTER TABLE accounting_entry ADD CONSTRAINT FK_DB6C942A8D9F6D38 FOREIGN KEY (order_id) REFERENCES orders (id)');
$this->addSql('ALTER TABLE accounting_entry ADD CONSTRAINT FK_DB6C942A9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
$this->addSql('ALTER TABLE accounting_entry ADD CONSTRAINT FK_DB6C942AAB9DE1E4 FOREIGN KEY (idBank) REFERENCES bank (id)');
$this->addSql('ALTER TABLE accounting_entry ADD CONSTRAINT FK_DB6C942AC2C29D6C FOREIGN KEY (idPaymentTransaction) REFERENCES payment_transaction (id)');
$this->addSql('ALTER TABLE accounting_entry ADD CONSTRAINT FK_DB6C942AD3564642 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE accounting_entry ADD CONSTRAINT FK_DB6C942AD6C214F9 FOREIGN KEY (idCreditCard) REFERENCES credit_card (id)');
$this->addSql('ALTER TABLE accounting_entry ADD CONSTRAINT FK_DB6C942AE8DE7170 FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE order_payment ADD CONSTRAINT FK_9B522D464C3A3BB FOREIGN KEY (payment_id) REFERENCES payment (id)');
$this->addSql('ALTER TABLE order_payment ADD CONSTRAINT FK_9B522D468D9F6D38 FOREIGN KEY (order_id) REFERENCES orders (id)');
$this->addSql('ALTER TABLE receipt ADD CONSTRAINT FK_5399B645D3564642 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE receipt ADD CONSTRAINT FK_5399B645E8DE7170 FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE cash_account_movement ADD idAccountingEntry INT DEFAULT NULL');
$this->addSql('ALTER TABLE cash_account_movement ADD CONSTRAINT FK_8C51940F9C8502E8 FOREIGN KEY (idAccountingEntry) REFERENCES accounting_entry (id)');
$this->addSql('CREATE INDEX IDX_D46F56919C8502E8 ON cash_account_movement (idAccountingEntry)');
$this->addSql('ALTER TABLE trackings CHANGE created_at created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CHANGE updated_at updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL');
}
public function isTransactional(): bool
{
return false;
}
}