diff --git a/classes/migration/upgrade/v3_5_0/I10041_UserGroupsAndUserUserGroupsMastheadValues.php b/classes/migration/upgrade/v3_5_0/I10041_UserGroupsAndUserUserGroupsMastheadValues.php new file mode 100644 index 00000000000..126f3b8bf1c --- /dev/null +++ b/classes/migration/upgrade/v3_5_0/I10041_UserGroupsAndUserUserGroupsMastheadValues.php @@ -0,0 +1,64 @@ +where('setting_name', 'nameLocaleKey') + ->where( + fn (Builder $q) => + $q->where('setting_value', 'default.groups.name.editor') + ->orWhere('setting_value', 'default.groups.name.sectionEditor') + ->orWhere('setting_value', 'default.groups.name.externalReviewer') + ) + ->pluck('user_group_id'); + DB::table('user_groups') + ->whereIn('user_group_id', $userGroupIds) + ->update(['masthead' => 1]); + DB::table('user_user_groups') + ->update(['masthead' => 1]); + } + + /** + * Reverse the migration. + */ + public function down(): void + { + $userGroupIds = DB::table('user_group_settings') + ->where('setting_name', 'nameLocaleKey') + ->where( + fn (Builder $q) => + $q->where('setting_value', 'default.groups.name.editor') + ->orWhere('setting_value', 'default.groups.name.sectionEditor') + ->orWhere('setting_value', 'default.groups.name.externalReviewer') + ) + ->pluck('user_group_id'); + DB::table('user_groups') + ->whereIn('user_group_id', $userGroupIds) + ->update(['masthead' => 0]); + DB::table('user_user_groups') + ->update(['masthead' => null]); + } +}