1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Application\Migration; |
6
|
|
|
|
7
|
|
|
use Doctrine\DBAL\Schema\Schema; |
8
|
|
|
use Doctrine\Migrations\AbstractMigration; |
9
|
|
|
|
10
|
|
|
class Version20221117163523 extends AbstractMigration |
11
|
|
|
{ |
12
|
|
|
public function up(Schema $schema): void |
13
|
|
|
{ |
14
|
|
|
// Some cards have empty plain_name, even tough they never should, so we re-affect them here |
15
|
|
|
$this->addSql("UPDATE card SET plain_name = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(name, '<strong>', ''), '</strong>', ''), '<em>', ''), '</em>', ''), '<u>', ''), '</u>', '') WHERE plain_name = ''"); |
16
|
|
|
|
17
|
|
|
// Convert unbreakable spaces into normal spaces |
18
|
|
|
$unbreakable = html_entity_decode(' '); |
19
|
|
|
$this->addSql( |
20
|
|
|
<<<STRING |
21
|
|
|
UPDATE `card` SET |
22
|
|
|
name = REPLACE(REPLACE(name, ' ', ' '), '$unbreakable', ' '), |
23
|
|
|
expanded_name = REPLACE(REPLACE(expanded_name, ' ', ' '), '$unbreakable', ' '), |
24
|
|
|
literature = REPLACE(REPLACE(literature, ' ', ' '), '$unbreakable', ' '), |
25
|
|
|
corpus = REPLACE(REPLACE(corpus, ' ', ' '), '$unbreakable', ' '), |
26
|
|
|
url_description = REPLACE(REPLACE(url_description, ' ', ' '), '$unbreakable', ' '), |
27
|
|
|
plain_name = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(plain_name, |
28
|
|
|
' ', ' '), |
29
|
|
|
'$unbreakable', ' '), |
30
|
|
|
'&', '&'), |
31
|
|
|
'>', '>'), |
32
|
|
|
'<', '<'), |
33
|
|
|
'"', '"') |
34
|
|
|
STRING |
35
|
|
|
); |
36
|
|
|
} |
37
|
|
|
} |
38
|
|
|
|