feature/RVRNEXT-24-use-slugs-for-communities #52
@ -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