<?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 Version20251223070255 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 invoice_item (id INT AUTO_INCREMENT NOT NULL, invoice_id INT DEFAULT NULL, product_id INT DEFAULT NULL, selected_unit_id INT DEFAULT NULL, product_name VARCHAR(255) NOT NULL, measurement VARCHAR(255) NOT NULL, quantity NUMERIC(10, 4) NOT NULL, unit_price_fob NUMERIC(10, 3) NOT NULL, unit_price_navlun NUMERIC(10, 3) NOT NULL, total_unit_price NUMERIC(10, 3) NOT NULL, total_purchase_price NUMERIC(10, 3) NOT NULL, total_unit_purchase_price NUMERIC(10, 3) NOT NULL, tax NUMERIC(10, 0) NOT NULL, discount NUMERIC(10, 0) NOT NULL, un_allocated_quantity NUMERIC(10, 4) NOT NULL, base_unit_quantity NUMERIC(10, 4) NOT NULL, created_at DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', updated_at DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, u_date INT DEFAULT NULL, INDEX IDX_1DDE477B2989F1FD (invoice_id), INDEX IDX_1DDE477B4584665A (product_id), INDEX IDX_1DDE477B10F90E93 (selected_unit_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE invoice_item ADD CONSTRAINT FK_1DDE477B2989F1FD FOREIGN KEY (invoice_id) REFERENCES invoice (id)');
$this->addSql('ALTER TABLE invoice_item ADD CONSTRAINT FK_1DDE477B4584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('ALTER TABLE invoice_item ADD CONSTRAINT FK_1DDE477B10F90E93 FOREIGN KEY (selected_unit_id) REFERENCES measurement_units (id) ON DELETE SET NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE invoice_item DROP FOREIGN KEY FK_1DDE477B2989F1FD');
$this->addSql('ALTER TABLE invoice_item DROP FOREIGN KEY FK_1DDE477B4584665A');
$this->addSql('ALTER TABLE invoice_item DROP FOREIGN KEY FK_1DDE477B10F90E93');
$this->addSql('DROP TABLE invoice_item');
}
}