<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230206090005 extends AbstractMigration
{
public function getDescription(): string
{
return 'alter [reference_service_type] _BUY to SEARCH_BUY and add a new one SEARCH_RENT';
}
public function up(Schema $schema): void
{
$this->addSql("UPDATE public.reference_property_service_type
SET name = 'reference.property.service.type.SEARCH_BUY'
WHERE name = 'reference.property.service.type.BUY'");
$this->addSql("INSERT INTO public.reference_property_service_type
VALUES (nextval('\"public\".reference_property_service_type_id_seq'::regclass),
'reference.property.service.type.SEARCH_RENT', '4')");
$this->addSql('ALTER TABLE reference_property_service_type ADD rank INT DEFAULT NULL');
$this->addSql("UPDATE reference_property_service_type
SET rank = 1 WHERE name = 'reference.property.service.type.SEARCH_BUY'");
$this->addSql("UPDATE reference_property_service_type
SET rank = 2 WHERE name = 'reference.property.service.type.SEARCH_RENT'");
$this->addSql("UPDATE reference_property_service_type
SET rank = 3 WHERE name = 'reference.property.service.type.SELL'");
$this->addSql("UPDATE reference_property_service_type
SET rank = 4 WHERE name = 'reference.property.service.type.RENTAL'");
}
}