<?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 Version20231019145134 extends AbstractMigration
{
public function getDescription(): string
{
return 'Create table OrderInvoice';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE order_invoice (id INT AUTO_INCREMENT NOT NULL, order_id INT NOT NULL, shop_id INT NOT NULL, number VARCHAR(20) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_661FBE0F8D9F6D38 (order_id), INDEX IDX_661FBE0F4D16C4DD (shop_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE order_invoice ADD CONSTRAINT FK_661FBE0F8D9F6D38 FOREIGN KEY (order_id) REFERENCES `order` (id)');
$this->addSql('ALTER TABLE order_invoice ADD CONSTRAINT FK_661FBE0F4D16C4DD FOREIGN KEY (shop_id) REFERENCES shop (id)');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE order_invoice');
}
}