Created
June 20, 2014 17:36
-
-
Save jasonwbarnett/1f15bd7035f59907b097 to your computer and use it in GitHub Desktop.
This was used to convert component default assignee values if the user has example.com in their address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
components=$(mysql -BNe 'select * from bugs.components;' | tr '\t' '|') | |
AMY_ID=277 | |
IFS=$'\n' | |
for x in $components;do | |
component_id=$(echo ${x} | awk -F\| '{print $1}') | |
default_assignee_id=$(echo ${x} | awk -F\| '{print $4}') | |
default_assignee_email=$(mysql -BNe "select login_name from bugs.profiles where userid = '${default_assignee_id}';") | |
example_email=$(echo ${default_assignee_email} | egrep -o 'example\.com') | |
[[ -n ${example_email} ]] && example_email=true || example_email=false | |
if [[ ${example_email} == "true" ]];then | |
echo "Updated component id ${component_id} initialowner from ${default_assignee_id} to ${AMY_ID}" | |
mysql -e "UPDATE bugs.components SET initialowner = '${AMY_ID}' WHERE id='${component_id}';" | |
fi | |
#mysql -e "UPDATE bugs.components SET initialqacontact = NULL WHERE id='${component_id}';" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment