40 lines
1.6 KiB
PHP
40 lines
1.6 KiB
PHP
<?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 Version20231006144941 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 bpn_date DROP FOREIGN KEY FK_18E376D24584665A');
|
|
$this->addSql('ALTER TABLE bpn_date DROP FOREIGN KEY FK_18E376D23243BB18');
|
|
$this->addSql('DROP INDEX IDX_18E376D24584665A ON bpn_date');
|
|
$this->addSql('DROP INDEX IDX_18E376D23243BB18 ON bpn_date');
|
|
$this->addSql('ALTER TABLE bpn_date ADD code VARCHAR(32) NOT NULL, ADD product VARCHAR(255) NOT NULL, ADD hotel VARCHAR(255) NOT NULL, DROP product_id, DROP hotel_id');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
// this down() migration is auto-generated, please modify it to your needs
|
|
$this->addSql('ALTER TABLE bpn_date ADD product_id INT NOT NULL, ADD hotel_id INT NOT NULL, DROP code, DROP product, DROP hotel');
|
|
$this->addSql('ALTER TABLE bpn_date ADD CONSTRAINT FK_18E376D24584665A FOREIGN KEY (product_id) REFERENCES bpn_date (id)');
|
|
$this->addSql('ALTER TABLE bpn_date ADD CONSTRAINT FK_18E376D23243BB18 FOREIGN KEY (hotel_id) REFERENCES bpn_hotel (id)');
|
|
$this->addSql('CREATE INDEX IDX_18E376D24584665A ON bpn_date (product_id)');
|
|
$this->addSql('CREATE INDEX IDX_18E376D23243BB18 ON bpn_date (hotel_id)');
|
|
}
|
|
}
|