diff --git a/test-and-deploy.yml b/test-and-deploy.yml
index b047007a21c6836c7022778abe43baf219f258ce..c6982c79ec535478ca2a08cba906f4642d9a002b 100644
--- a/test-and-deploy.yml
+++ b/test-and-deploy.yml
@@ -67,8 +67,8 @@ stages:
       if [[ ! -n ${ID} ]]; then
         DBREQUIRED="yes"
       else
-        TABLES=$(docker exec ${COMPOSE_PROJECT_NAME}_mariadb_1 mysql -u drupal --password=drupal -e "show tables;" drupal 2>/dev/null|grep users)
-        if [[ ! -n ${TABLES} ]]; then
+        TABLES=$(docker exec -i ${COMPOSE_PROJECT_NAME}_mariadb_1 mysql -u drupal --password=drupal -e "show tables;" drupal)
+        if [[ "${TABLES}" != *"users_data"* ]]; then
           DBREQUIRED="yes"
         fi
       fi