<?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 Version20240326103621 extends AbstractMigration
{
public function getDescription(): string
{
return 'paymentType for reservation entity';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE reservation ADD payment_type VARCHAR(32) DEFAULT NULL');
$this->addSql('UPDATE reservation SET payment_type = "TRANSFER" WHERE status = "WAITING_TRANSFER"');
$this->addSql('UPDATE reservation r LEFT JOIN reservation_payment rp ON r.id = rp.reservation_id INNER JOIN payment p ON p.id = rp.payment_id SET r.payment_type = p.type');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE reservation DROP payment_type');
}
}