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