<?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 Version20231016135427 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add new fields Order (totalPaidReal, totalProductsTaxExcl, totalShippingTaxExcl, totalDiscountTaxExcl, totalTax, invoiceNumber, totalWrappingTaxExcl), create table OrderSlip and add new field OrderProduct (price, ecotax)';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE order_slip (id INT AUTO_INCREMENT NOT NULL, order_id INT DEFAULT NULL, number VARCHAR(20) NOT NULL, total_tax_excl DOUBLE PRECISION NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_B0C879EFFCDAEAAA (order_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE order_slip ADD CONSTRAINT FK_B0C879EFFCDAEAAA FOREIGN KEY (order_id) REFERENCES `order` (id)');
$this->addSql('ALTER TABLE `order` ADD total_paid_real DOUBLE PRECISION DEFAULT NULL, ADD total_products_tax_excl DOUBLE PRECISION DEFAULT NULL, ADD total_shipping_tax_excl DOUBLE PRECISION DEFAULT NULL, ADD total_discount_tax_excl DOUBLE PRECISION DEFAULT NULL, ADD total_wrapping_tax_excl DOUBLE PRECISION DEFAULT NULL, ADD total_tax DOUBLE PRECISION DEFAULT NULL, ADD invoice_number VARCHAR(20) DEFAULT NULL');
$this->addSql('ALTER TABLE order_product ADD price DOUBLE PRECISION DEFAULT NULL, ADD ecotax DOUBLE PRECISION DEFAULT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE order_slip');
$this->addSql('ALTER TABLE `order` DROP total_paid_real, DROP total_products_tax_excl, DROP total_shipping_tax_excl, DROP total_discount_tax_excl, DROP total_wrapping_tax_excl, DROP total_tax, DROP invoice_number');
$this->addSql('ALTER TABLE order_product DROP price, DROP ecotax');
}
}