Commit 86725415 by Kevin Falcone

Our two migraton scripts for csmh -> csmhe

Additionally, a slow deleting scripts for sites that cannot
use truncate.
parent 01690432
MINID=0
MAXID=1003426362
STEP=10000
MIGRATE_USER=migrate
PASSWORD='secret-password'
HOST='my-database-instance'
for ((i=0; i<=$MAXID; i+=$STEP)); do
echo -n "$i";
mysql -u $MIGRATE_USER -p$PASSWORD -h $HOST wwc <<EOF
INSERT INTO edxapp_csmh.coursewarehistoryextended_studentmodulehistoryextended (id, version, created, state, grade, max_grade, student_module_id)
SELECT id, version, created, state, grade, max_grade, student_module_id
FROM wwc.courseware_studentmodulehistory
WHERE id BETWEEN $i AND $(($i+$STEP-1));
EOF
echo '.';
sleep 2
done
MINID=0
MAXID=1003426362
STEP=10000
MIGRATE_USER=migrate
PASSWORD='secret-password'
HOST='my-database-instance'
for ((i=$MINID-1; i<=$MAXID; i+=$STEP)); do
echo -n "$i";
mysql -u $MIGRATE_USER -p$PASSWORD -h $HOST wwc <<EOF
INSERT INTO wwc.coursewarehistoryextended_studentmodulehistoryextended (id, version, created, state, grade, max_grade, student_module_id)
SELECT id, version, created, state, grade, max_grade, student_module_id
FROM wwc.courseware_studentmodulehistory
WHERE id BETWEEN $i AND $(($i+$STEP-1));
EOF
echo '.';
sleep 2;
done
MINID=0
MAXID=1003426362
STEP=20000
MIGRATE_USER=migrate
PASSWORD='secret'
HOST='host'
for ((i=$MINID-1; i<=$MAXID; i+=$STEP)); do
echo -n "$i";
time mysql -u $MIGRATE_USER -p$PASSWORD -h $HOST wwc <<EOF
DELETE FROM courseware_studentmodulehistory where id < $i
EOF
sleep 3;
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment