RVRNEXT-24 add migration for slug for communities

This commit is contained in:
Bence Pőcze 2023-05-07 01:43:14 +02:00
parent 54d901e45e
commit 829588150a
Signed by: bence
GPG Key ID: DC5BD6E95A333E6D
2 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,12 @@
<?php
use RVR\PersistentData\Model\Community;
use SokoWeb\Database\Query\Select;
$select = new Select(Container::$dbConnection);
$communities = Container::$persistentDataManager->selectMultipleFromDb($select, Community::class);
foreach ($communities as $community) {
$community->generateSlug();
Container::$persistentDataManager->saveToDb($community);
}

View File

@ -0,0 +1,3 @@
ALTER TABLE `communities`
ADD `slug` varchar(255) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL AFTER `id`,
ADD UNIQUE `slug` (`slug`);