Merge pull request #10664 from edx/usman/regenerate-db-cache

Recreate db caches for bokchoy and lettuce
This commit is contained in:
Usman Khalid
2015-11-19 19:20:21 +05:00
5 changed files with 4191 additions and 6 deletions

View File

@@ -24,17 +24,15 @@
DB_CACHE_DIR="common/test/db_cache"
# Ensure the test database exists.
echo "CREATE DATABASE IF NOT EXISTS edxtest;" | mysql -u root
# Clear out the test database
./manage.py lms --settings bok_choy reset_db --traceback --noinput
# If there are cached database schemas/data, load them
if [[ -f $DB_CACHE_DIR/bok_choy_schema.sql && -f $DB_CACHE_DIR/bok_choy_data.json ]]; then
if [[ -f $DB_CACHE_DIR/bok_choy_schema.sql && -f $DB_CACHE_DIR/bok_choy_migrations_data.sql && -f $DB_CACHE_DIR/bok_choy_data.json ]]; then
# Load the schema, then the data (including the migration history)
mysql -u root edxtest < $DB_CACHE_DIR/bok_choy_schema.sql
mysql -u root edxtest < $DB_CACHE_DIR/bok_choy_migrations_data.sql
./manage.py lms --settings bok_choy loaddata $DB_CACHE_DIR/bok_choy_data.json
# Re-run migrations to ensure we are up-to-date
@@ -52,7 +50,9 @@ else
./manage.py cms --settings bok_choy migrate --traceback --noinput
# Dump the schema and data to the cache
# ./manage.py lms --settings bok_choy dumpdata > $DB_CACHE_DIR/bok_choy_data.json
# mysqldump -u root --no-data --skip-comments --skip-dump-date edxtest > $DB_CACHE_DIR/bok_choy_schema.sql
./manage.py lms --settings bok_choy dumpdata > $DB_CACHE_DIR/bok_choy_data.json
# dump_data does not dump the django_migrations table so we do it separately.
mysqldump -u root --no-create-info edxtest django_migrations > $DB_CACHE_DIR/bok_choy_migrations_data.sql
mysqldump -u root --no-data --skip-comments --skip-dump-date edxtest > $DB_CACHE_DIR/bok_choy_schema.sql
fi