Paver commands for storing and retrieving bokchoy db caches from s3 TE-2353
This commit is contained in:
@@ -18,22 +18,24 @@ else
|
||||
SETTINGS="bok_choy_docker"
|
||||
fi
|
||||
|
||||
declare -A databases
|
||||
declare -a database_order
|
||||
databases=(["default"]="edxtest" ["student_module_history"]="student_module_history_test")
|
||||
database_order=("default" "student_module_history")
|
||||
|
||||
for db in "${database_order[@]}"; do
|
||||
echo "CREATE DATABASE IF NOT EXISTS ${databases[$db]};" | mysql $MYSQL_HOST -u root
|
||||
# Use a different database than the one used for testing,
|
||||
# because we will need to empty out the database to calculate
|
||||
# the migrations fingerprint.
|
||||
# Choosing an arbitrary name "calculate_migrations" for the db.
|
||||
echo "DROP DATABASE IF EXISTS calculate_migrations;" | mysql $MYSQL_HOST -u root
|
||||
echo "CREATE DATABASE calculate_migrations;" | mysql $MYSQL_HOST -u root
|
||||
|
||||
# Clear out the test database using the reset_db command which uses "DROP DATABASE" and
|
||||
# "CREATE DATABASE". This will result in an empty database.
|
||||
echo "Clearing out the $db bok_choy MySQL database."
|
||||
./manage.py lms --settings $SETTINGS reset_db --traceback --router $db
|
||||
# Now output all the migrations in the platform to a file.
|
||||
echo "Calculating migrations."
|
||||
echo "Calculating migrations for fingerprinting."
|
||||
|
||||
output_file="common/test/db_cache/bok_choy_${db}_migrations.yaml"
|
||||
./manage.py lms --settings $SETTINGS show_unapplied_migrations --database $db --output_file $output_file
|
||||
|
||||
# Redirect stdout to /dev/null because the script will print
|
||||
# out all migrations to both stdout and the output file.
|
||||
./manage.py lms --settings $SETTINGS show_unapplied_migrations --database $db --output_file $output_file 1>/dev/null
|
||||
done
|
||||
|
||||
echo "DROP DATABASE IF EXISTS calculate_migrations;" | mysql $MYSQL_HOST -u root
|
||||
|
||||
Reference in New Issue
Block a user