<?php
use Phinx\Migration\AbstractMigration;
class ReplaceCharsInAdverts extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up(): void
{
$this->execute("UPDATE adverts SET name = replace(`name`, '&', '&')");
$this->execute("UPDATE adverts SET name = replace(`name`, '"', '\"')");
$this->execute("UPDATE adverts SET name = replace(`name`, ''', \"'\")");
$this->execute("UPDATE adverts SET name = replace(`name`, ''', \"'\")");
$this->execute("UPDATE adverts SET name = replace(`name`, '$', '$')");
$this->execute("UPDATE adverts SET name = replace(`name`, '\', '\\\')");
$this->execute("UPDATE adverts SET name = replace(`name`, '|', '|')");
$this->execute("UPDATE adverts SET name = replace(`name`, '^', '^')");
$this->execute("UPDATE adverts SET name = replace(`name`, '`', '`')");
$this->execute("UPDATE adverts SET name = replace(`name`, '%', '%')");
$this->execute("UPDATE adverts SET name = replace(`name`, ':', ':')");
$this->execute("UPDATE adverts SET name = replace(`name`, '@', '@')");
$this->execute("UPDATE adverts SET name = replace(`name`, '<', '<')");
$this->execute("UPDATE adverts SET name = replace(`name`, '>', '>')");
}
/**
* Migrate Down.
*/
public function down(): void
{
$this->execute("UPDATE adverts SET name = replace(`name`, '&', '&')");
$this->execute("UPDATE adverts SET name = replace(`name`, '\"', '"')");
$this->execute("UPDATE adverts SET name = replace(`name`, \"'\", ''')");
$this->execute("UPDATE adverts SET name = replace(`name`, '<', '<')");
$this->execute("UPDATE adverts SET name = replace(`name`, '>', '>')");
}
}