<?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 Version20250909133749 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE taxonomies.categories ADD external_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE taxonomies.categories ADD external_ref INT DEFAULT NULL');
$this->addSql('ALTER TABLE real_estates ADD external_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE real_estates ADD external_ref INT DEFAULT NULL');
//$this->addSql('CREATE SEQUENCE taxonomies.categories__groups_id_seq');
$this->addSql('SELECT setval(\'taxonomies.categories__groups_id_seq\', (SELECT MAX(id) FROM taxonomies.categories__groups))');
$this->addSql('ALTER TABLE taxonomies.categories__groups ALTER id SET DEFAULT nextval(\'taxonomies.categories__groups_id_seq\')');
//$this->addSql('CREATE SEQUENCE taxonomies.categories__real_estates_id_seq');
$this->addSql('SELECT setval(\'taxonomies.categories__real_estates_id_seq\', (SELECT MAX(id) FROM taxonomies.categories__real_estates))');
$this->addSql('ALTER TABLE taxonomies.categories__real_estates ALTER id SET DEFAULT nextval(\'taxonomies.categories__real_estates_id_seq\')');
//$this->addSql('CREATE SEQUENCE taxonomies.categories_types_id_seq');
$this->addSql('SELECT setval(\'taxonomies.categories_types_id_seq\', (SELECT MAX(id) FROM taxonomies.categories_types))');
$this->addSql('ALTER TABLE taxonomies.categories_types ALTER id SET DEFAULT nextval(\'taxonomies.categories_types_id_seq\')');
$this->addSql('ALTER TABLE instance ADD company_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE instance ADD CONSTRAINT FK_4230B1DE979B1AD6 FOREIGN KEY (company_id) REFERENCES companies (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_4230B1DE979B1AD6 ON instance (company_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE real_estates DROP external_id');
$this->addSql('ALTER TABLE real_estates DROP external_ref');
$this->addSql('ALTER TABLE taxonomies.categories DROP external_id');
$this->addSql('ALTER TABLE taxonomies.categories DROP external_ref');
}
}