migrations/Version20250524120756.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 Version20250524120756 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Add web_user_id, country, and city to std_pages_tracking and link to std_web_users.';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $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');
  15.         $this->addSql('ALTER TABLE std_pages_tracking ADD CONSTRAINT FK_6BDCE7814FC17D0B FOREIGN KEY (web_user_id) REFERENCES std_web_users (id)');
  16.         $this->addSql('CREATE INDEX IDX_6BDCE7814FC17D0B ON std_pages_tracking (web_user_id)');
  17.     }
  18.     public function down(Schema $schema): void
  19.     {
  20.         $this->addSql('ALTER TABLE std_pages_tracking DROP FOREIGN KEY FK_6BDCE7814FC17D0B');
  21.         $this->addSql('DROP INDEX IDX_6BDCE7814FC17D0B ON std_pages_tracking');
  22.         $this->addSql('ALTER TABLE std_pages_tracking DROP web_user_id, DROP country, DROP city');
  23.     }
  24. }