RVRNEXT-24 add migration for slug for communities
This commit is contained in:
		
							parent
							
								
									54d901e45e
								
							
						
					
					
						commit
						829588150a
					
				| @ -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); | ||||||
|  | } | ||||||
| @ -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`); | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user