Docker: create missing 'aurweb' DB if needed

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-06-25 17:09:21 -07:00
parent 61c473405f
commit d95e4ec443

View file

@ -8,9 +8,16 @@ done
# Create test database. # Create test database.
mysql -u root -e "CREATE USER 'aur'@'%' IDENTIFIED BY 'aur'" \ mysql -u root -e "CREATE USER 'aur'@'%' IDENTIFIED BY 'aur'" \
2>/dev/null || /bin/true 2>/dev/null || /bin/true
# Create a brand new 'aurweb_test' DB.
mysql -u root -e "DROP DATABASE aurweb_test" 2>/dev/null || /bin/true mysql -u root -e "DROP DATABASE aurweb_test" 2>/dev/null || /bin/true
mysql -u root -e "CREATE DATABASE aurweb_test" mysql -u root -e "CREATE DATABASE aurweb_test"
mysql -u root -e "GRANT ALL PRIVILEGES ON aurweb_test.* TO 'aur'@'%'" mysql -u root -e "GRANT ALL PRIVILEGES ON aurweb_test.* TO 'aur'@'%'"
# Create the 'aurweb' DB if it does not yet exist.
mysql -u root -e "CREATE DATABASE aurweb" 2>/dev/null || /bin/true
mysql -u root -e "GRANT ALL PRIVILEGES ON aurweb.* TO 'aur'@'%'"
mysql -u root -e "FLUSH PRIVILEGES" mysql -u root -e "FLUSH PRIVILEGES"
# Shutdown mariadb. # Shutdown mariadb.