Fixed default tag category
This commit is contained in:
parent
178b17897c
commit
2ede81e1d8
5 changed files with 22 additions and 4 deletions
|
@ -32,7 +32,7 @@ class TagViewProxy extends AbstractViewProxy
|
|||
$result->name = $tag->getName();
|
||||
$result->usages = $tag->getUsages();
|
||||
$result->banned = $tag->isBanned();
|
||||
$result->category = !empty($tag->getCategory()) ? $tag->getCategory() : 'default';
|
||||
$result->category = $tag->getCategory();
|
||||
|
||||
if (!empty($config[self::FETCH_IMPLICATIONS]))
|
||||
$result->implications = $this->fromArray($tag->getImpliedTags());
|
||||
|
|
|
@ -6,7 +6,7 @@ final class Tag extends Entity
|
|||
private $name;
|
||||
private $creationTime;
|
||||
private $banned = false;
|
||||
private $category;
|
||||
private $category = 'default';
|
||||
|
||||
const LAZY_LOADER_IMPLIED_TAGS = 'implications';
|
||||
const LAZY_LOADER_SUGGESTED_TAGS = 'suggestions';
|
||||
|
|
19
src/Upgrades/Upgrade32.php
Normal file
19
src/Upgrades/Upgrade32.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
namespace Szurubooru\Upgrades;
|
||||
use Szurubooru\DatabaseConnection;
|
||||
|
||||
class Upgrade32 implements IUpgrade
|
||||
{
|
||||
public function run(DatabaseConnection $databaseConnection)
|
||||
{
|
||||
$pdo = $databaseConnection->getPDO();
|
||||
|
||||
$pdo->exec('
|
||||
UPDATE snapshots SET
|
||||
data = REPLACE(data, \'"category":null\', \'"category":"default"\'),
|
||||
dataDifference = REPLACE(dataDifference, \'"category",null\', \'"category","default"\')');
|
||||
|
||||
$pdo->exec('UPDATE tags SET category = \'default\' WHERE category IS NULL');
|
||||
$pdo->exec('ALTER TABLE tags CHANGE category category VARCHAR(25) NOT NULL DEFAULT \'default\'');
|
||||
}
|
||||
}
|
|
@ -48,6 +48,7 @@ return [
|
|||
$container->get(\Szurubooru\Upgrades\Upgrade29::class),
|
||||
$container->get(\Szurubooru\Upgrades\Upgrade30::class),
|
||||
$container->get(\Szurubooru\Upgrades\Upgrade31::class),
|
||||
$container->get(\Szurubooru\Upgrades\Upgrade32::class),
|
||||
];
|
||||
}),
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ final class TagDaoFilterTest extends AbstractDatabaseTestCase
|
|||
$tag1 = $this->getTestTag('test 1');
|
||||
$tag2 = $this->getTestTag('test 2');
|
||||
$tag3 = $this->getTestTag('test 3');
|
||||
$tag1->setCategory(null);
|
||||
$tag2->setCategory('misc');
|
||||
$tag3->setCategory('other');
|
||||
$tagDao = $this->getTagDao();
|
||||
|
@ -40,7 +39,6 @@ final class TagDaoFilterTest extends AbstractDatabaseTestCase
|
|||
$tag1 = $this->getTestTag('test 1');
|
||||
$tag2 = $this->getTestTag('test 2');
|
||||
$tag3 = $this->getTestTag('test 3');
|
||||
$tag1->setCategory(null);
|
||||
$tag2->setCategory('misc');
|
||||
$tag3->setCategory('other');
|
||||
$tagDao = $this->getTagDao();
|
||||
|
|
Loading…
Reference in a new issue