<?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 Version20240328131826 extends AbstractMigration
{
public function getDescription(): string
{
return 'TDP-2263 - TourCategory, tur sıralama.';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE tour_tour_category DROP FOREIGN KEY FK_F90194F115ED8D43');
$this->addSql('ALTER TABLE tour_tour_category DROP FOREIGN KEY FK_F90194F17210CF21');
$this->addSql('ALTER TABLE tour_tour_category ADD id INT AUTO_INCREMENT NOT NULL FIRST, ADD sequence SMALLINT NOT NULL, DROP PRIMARY KEY, ADD PRIMARY KEY (id)');
$this->addSql('ALTER TABLE tour_tour_category ADD CONSTRAINT FK_F90194F115ED8D43 FOREIGN KEY (tour_id) REFERENCES tour (id)');
$this->addSql('ALTER TABLE tour_tour_category ADD CONSTRAINT FK_F90194F17210CF21 FOREIGN KEY (tour_category_id) REFERENCES tour_category (id)');
$this->addSql('CREATE UNIQUE INDEX u_tour_tour_category ON tour_tour_category (tour_id, tour_category_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE tour_tour_category MODIFY id INT NOT NULL');
$this->addSql('ALTER TABLE tour_tour_category DROP FOREIGN KEY FK_F90194F17210CF21');
$this->addSql('ALTER TABLE tour_tour_category DROP FOREIGN KEY FK_F90194F115ED8D43');
$this->addSql('DROP INDEX `PRIMARY` ON tour_tour_category');
$this->addSql('ALTER TABLE tour_tour_category DROP id, DROP sequence');
$this->addSql('ALTER TABLE tour_tour_category ADD CONSTRAINT FK_F90194F17210CF21 FOREIGN KEY (tour_category_id) REFERENCES tour_category (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE tour_tour_category ADD CONSTRAINT FK_F90194F115ED8D43 FOREIGN KEY (tour_id) REFERENCES tour (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE tour_tour_category ADD PRIMARY KEY (tour_id, tour_category_id)');
$this->addSql('DROP INDEX u_tour_tour_category ON tour_tour_category');
}
}