Commit a19b97c6 by Ben Patterson

Don't use 'test' db for mysql since it's reserved.

This db name is reserved and used by mysql installations. This can cause
conflicts when trying to populate our own 'test' database on mysql.
parent a4fea913
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
"default": { "default": {
"ENGINE": "django.db.backends.mysql", "ENGINE": "django.db.backends.mysql",
"HOST": "localhost", "HOST": "localhost",
"NAME": "test", "NAME": "edxtest",
"PASSWORD": "", "PASSWORD": "",
"PORT": "3306", "PORT": "3306",
"USER": "root" "USER": "root"
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
"default": { "default": {
"ENGINE": "django.db.backends.mysql", "ENGINE": "django.db.backends.mysql",
"HOST": "localhost", "HOST": "localhost",
"NAME": "test", "NAME": "edxtest",
"PASSWORD": "", "PASSWORD": "",
"PORT": "3306", "PORT": "3306",
"USER": "root" "USER": "root"
......
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
DB_CACHE_DIR="common/test/db_cache" DB_CACHE_DIR="common/test/db_cache"
# Ensure the test database exists. # Ensure the test database exists.
echo "CREATE DATABASE IF NOT EXISTS test;" | mysql -u root echo "CREATE DATABASE IF NOT EXISTS edxtest;" | mysql -u root
echo "GRANT ALL ON test.* TO mysql@localhost" | mysql -u root
# Clear out the test database # Clear out the test database
./manage.py lms --settings bok_choy reset_db --traceback --noinput ./manage.py lms --settings bok_choy reset_db --traceback --noinput
...@@ -35,7 +34,7 @@ echo "GRANT ALL ON test.* TO mysql@localhost" | mysql -u root ...@@ -35,7 +34,7 @@ echo "GRANT ALL ON test.* TO mysql@localhost" | mysql -u root
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_data.json ]]; then
# Load the schema, then the data (including the migration history) # Load the schema, then the data (including the migration history)
mysql -u root test < $DB_CACHE_DIR/bok_choy_schema.sql mysql -u root edxtest < $DB_CACHE_DIR/bok_choy_schema.sql
./manage.py lms --settings bok_choy loaddata $DB_CACHE_DIR/bok_choy_data.json ./manage.py lms --settings bok_choy loaddata $DB_CACHE_DIR/bok_choy_data.json
# Re-run migrations to ensure we are up-to-date # Re-run migrations to ensure we are up-to-date
...@@ -53,6 +52,6 @@ else ...@@ -53,6 +52,6 @@ else
# Dump the schema and data to the cache # Dump the schema and data to the cache
./manage.py lms --settings bok_choy dumpdata > $DB_CACHE_DIR/bok_choy_data.json ./manage.py lms --settings bok_choy dumpdata > $DB_CACHE_DIR/bok_choy_data.json
mysqldump -u root --no-data --skip-comments --skip-dump-date test > $DB_CACHE_DIR/bok_choy_schema.sql mysqldump -u root --no-data --skip-comments --skip-dump-date edxtest > $DB_CACHE_DIR/bok_choy_schema.sql
fi fi
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