database: fix PostgreSQL connection string
If all databases drivers are loaded, MySQL SQLAlchemy driver
overrides all the other one that might not have set one.
This patches fixes that.
Change-Id: If6d8d08e5b7b7c48ca012677b536d71058def6fd
Closes-Bug: #1493304
diff --git a/lib/databases/mysql b/lib/databases/mysql
index ada56a7..c2ab32e 100644
--- a/lib/databases/mysql
+++ b/lib/databases/mysql
@@ -12,12 +12,6 @@
set +o xtrace
MYSQL_DRIVER=${MYSQL_DRIVER:-PyMySQL}
-# Force over to pymysql driver by default if we are using it.
-if is_service_enabled mysql; then
- if [[ "$MYSQL_DRIVER" == "PyMySQL" ]]; then
- SQLALCHEMY_DATABASE_DRIVER=${SQLALCHEMY_DATABASE_DRIVER:-"pymysql"}
- fi
-fi
register_database mysql
@@ -30,6 +24,14 @@
# Functions
# ---------
+function get_database_type_mysql {
+ if [[ "$MYSQL_DRIVER" == "PyMySQL" ]]; then
+ echo mysql+pymysql
+ else
+ echo mysql
+ fi
+}
+
# Get rid of everything enough to cleanly change database backends
function cleanup_database_mysql {
stop_service $MYSQL