<?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 Version20240502075526 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add new column point_of_interest_id to Payment entity join with PointOfInterest entity with foreign key';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE payment ADD point_of_interest_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE payment ADD CONSTRAINT FK_6D28840D4F3KI93F FOREIGN KEY (point_of_interest_id) REFERENCES point_of_interest (id)');
$this->addSql('CREATE INDEX IDX_6D28840D4F3KI93F ON payment (point_of_interest_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE payment DROP FOREIGN KEY FK_6D28840D4F3KI93F');
$this->addSql('DROP INDEX IDX_6D28840D4F3KI93F ON payment');
$this->addSql('ALTER TABLE payment DROP point_of_interest_id');
}
}