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