migrations/Version20230206090005.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. final class Version20230206090005 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'alter [reference_service_type] _BUY to SEARCH_BUY and add a new one SEARCH_RENT';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql("UPDATE public.reference_property_service_type 
  15.                            SET name = 'reference.property.service.type.SEARCH_BUY' 
  16.                            WHERE name = 'reference.property.service.type.BUY'");
  17.         $this->addSql("INSERT INTO public.reference_property_service_type 
  18.                            VALUES (nextval('\"public\".reference_property_service_type_id_seq'::regclass),
  19.                                    'reference.property.service.type.SEARCH_RENT', '4')");
  20.         $this->addSql('ALTER TABLE reference_property_service_type  ADD rank INT DEFAULT NULL');
  21.         $this->addSql("UPDATE reference_property_service_type  
  22.                            SET rank = 1 WHERE name = 'reference.property.service.type.SEARCH_BUY'");
  23.         $this->addSql("UPDATE reference_property_service_type  
  24.                            SET rank = 2 WHERE name = 'reference.property.service.type.SEARCH_RENT'");
  25.         $this->addSql("UPDATE reference_property_service_type  
  26.                            SET rank = 3 WHERE name = 'reference.property.service.type.SELL'");
  27.         $this->addSql("UPDATE reference_property_service_type
  28.                            SET rank = 4 WHERE name = 'reference.property.service.type.RENTAL'");
  29.     }
  30. }