<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20250524120756 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add web_user_id, country, and city to std_pages_tracking and link to std_web_users.';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE std_pages_tracking ADD web_user_id INT UNSIGNED DEFAULT NULL COMMENT \'Unique identifier\', ADD country VARCHAR(255) DEFAULT NULL, ADD city VARCHAR(255) DEFAULT NULL, ADD precise_country VARCHAR(255) DEFAULT NULL, ADD precise_city VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE std_pages_tracking ADD CONSTRAINT FK_6BDCE7814FC17D0B FOREIGN KEY (web_user_id) REFERENCES std_web_users (id)');
$this->addSql('CREATE INDEX IDX_6BDCE7814FC17D0B ON std_pages_tracking (web_user_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE std_pages_tracking DROP FOREIGN KEY FK_6BDCE7814FC17D0B');
$this->addSql('DROP INDEX IDX_6BDCE7814FC17D0B ON std_pages_tracking');
$this->addSql('ALTER TABLE std_pages_tracking DROP web_user_id, DROP country, DROP city');
}
}