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