<?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 Version20231022051343 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 gift_card ADD balance INT NOT NULL');
$this->addSql('ALTER TABLE gift_card ADD plastic_card TINYINT(1) DEFAULT 0 NOT NULL');
$this->addSql('UPDATE gift_card SET balance = nominal WHERE apply_order_id IS NULL');
$this->addSql('CREATE TABLE gift_card_applied_orders (gift_card_id INT NOT NULL, order_id INT NOT NULL, INDEX IDX_95C66C62696A98F (gift_card_id), INDEX IDX_95C66C68D9F6D38 (order_id), PRIMARY KEY(gift_card_id, order_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE gift_card_applied_orders ADD CONSTRAINT FK_95C66C62696A98F FOREIGN KEY (gift_card_id) REFERENCES gift_card (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE gift_card_applied_orders ADD CONSTRAINT FK_95C66C68D9F6D38 FOREIGN KEY (order_id) REFERENCES `order` (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
}
}