Files
SomniaRooms/migrations/Version20240909114239.php
T
Daniel-Garmig 09f384fce0 DB changed.
- Removed RoomCategoryDetails.
- Updated some constraints and fields.
2024-09-09 13:44:18 +02:00

46 lines
2.3 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 Version20240909114239 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('DROP SEQUENCE room_category_details_id_seq CASCADE');
$this->addSql('ALTER TABLE room_category_details DROP CONSTRAINT fk_3735fabb67333dd');
$this->addSql('DROP TABLE room_category_details');
$this->addSql('ALTER TABLE room_category_photo ADD photo_order INT DEFAULT NULL');
$this->addSql('ALTER TABLE room_category_photo DROP kind');
$this->addSql('ALTER TABLE room_fare DROP CONSTRAINT FK_35C9B213A7233EF2');
$this->addSql('ALTER TABLE room_fare ADD CONSTRAINT FK_35C9B213A7233EF2 FOREIGN KEY (fare_table_id) REFERENCES fare_table (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('CREATE SEQUENCE room_category_details_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE room_category_details (id INT NOT NULL, room_category_id INT NOT NULL, details_section VARCHAR(255) NOT NULL, detail_value VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX idx_3735fabb67333dd ON room_category_details (room_category_id)');
$this->addSql('ALTER TABLE room_category_details ADD CONSTRAINT fk_3735fabb67333dd FOREIGN KEY (room_category_id) REFERENCES room_category (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE room_fare DROP CONSTRAINT fk_35c9b213a7233ef2');
$this->addSql('ALTER TABLE room_fare ADD CONSTRAINT fk_35c9b213a7233ef2 FOREIGN KEY (fare_table_id) REFERENCES fare_table (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE room_category_photo ADD kind VARCHAR(30) NOT NULL');
$this->addSql('ALTER TABLE room_category_photo DROP photo_order');
}
}