diff --git a/database/migrations/data/20230507_0051_slug_for_communities.php b/database/migrations/data/20230507_0051_slug_for_communities.php new file mode 100644 index 0000000..5be5665 --- /dev/null +++ b/database/migrations/data/20230507_0051_slug_for_communities.php @@ -0,0 +1,12 @@ +selectMultipleFromDb($select, Community::class); + +foreach ($communities as $community) { + $community->generateSlug(); + Container::$persistentDataManager->saveToDb($community); +} diff --git a/database/migrations/structure/20230507_0051_slug_for_communities.sql b/database/migrations/structure/20230507_0051_slug_for_communities.sql new file mode 100644 index 0000000..2ec5162 --- /dev/null +++ b/database/migrations/structure/20230507_0051_slug_for_communities.sql @@ -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`);