diff --git a/database/migrations/data/20230923_1905_username.php b/database/migrations/data/20230923_1905_username.php new file mode 100644 index 0000000..a73e130 --- /dev/null +++ b/database/migrations/data/20230923_1905_username.php @@ -0,0 +1,13 @@ +selectMultipleFromDb($select, User::class); + +foreach ($users as $user) { + $user->setUsername(Factory::create()->userName); + Container::$persistentDataManager->saveToDb($user); +} diff --git a/database/migrations/structure/20230923_1905_username.sql b/database/migrations/structure/20230923_1905_username.sql new file mode 100644 index 0000000..bb7f9f7 --- /dev/null +++ b/database/migrations/structure/20230923_1905_username.sql @@ -0,0 +1,3 @@ +ALTER TABLE `users` + ADD `username` VARCHAR(255) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL AFTER `email`, + ADD UNIQUE `username` (`username`);