<?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 Version20221108040939 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 (id INT AUTO_INCREMENT NOT NULL, partner_id INT DEFAULT NULL, ym VARCHAR(6) NOT NULL, invoice_date DATETIME DEFAULT NULL, total INT DEFAULT NULL, pdf_filename VARCHAR(100) NOT NULL, print_date DATETIME DEFAULT NULL, create_date DATETIME NOT NULL, delete_date DATETIME DEFAULT NULL, INDEX IDX_906517449393F8FE (partner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE invoice ADD CONSTRAINT FK_906517449393F8FE FOREIGN KEY (partner_id) REFERENCES partner (id)');
$this->addSql('ALTER TABLE sales ADD invoice_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE sales ADD CONSTRAINT FK_6B8170442989F1FD FOREIGN KEY (invoice_id) REFERENCES invoice (id)');
$this->addSql('CREATE INDEX IDX_6B8170442989F1FD ON sales (invoice_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE sales DROP FOREIGN KEY FK_6B8170442989F1FD');
$this->addSql('ALTER TABLE invoice DROP FOREIGN KEY FK_906517449393F8FE');
$this->addSql('DROP TABLE invoice');
$this->addSql('DROP INDEX IDX_6B8170442989F1FD ON sales');
$this->addSql('ALTER TABLE sales DROP invoice_id');
}
}