Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
executable file 19 lines (17 sloc) 618 Bytes
#! /bin/sh
id=$1
current_year=$(date +%Y)
cat <<EOF
UPDATE riders
SET class = class + 1, version = version + 1
WHERE id = $id AND class IN (3, 6) AND YEAR(date_of_birth) < $((current_year - 45));
UPDATE riders
SET class = class + 1, version = version + 1
WHERE id = $id AND class = 5 AND YEAR(date_of_birth) < $((current_year - 12));
UPDATE riders
SET class = class - 1, version = version - 1
WHERE id = $id AND class = 12 AND YEAR(date_of_birth) < $((current_year - 18));
UPDATE riders
SET class = class - 1, version = version - 1
WHERE id = $id AND class = 13 AND YEAR(date_of_birth) < $((current_year - 16));
EOF