backdrop-contrib / backdrop-drush-extension

A set of commands and boot class for Drush and Backdrop CMS.
GNU General Public License v2.0
13 stars 18 forks source link

Unable to load class Drush\Sql\Sql #234

Open herbdool opened 3 years ago

herbdool commented 3 years ago

I tried running drush sql-conf --all and it gives me "Unable to load class Drush\Sql\Sql. Error: Call to a member function getAll() on null in drush_sql_conf() (line 213 of phar:///usr/local/bin/drush/commands/sql/sql.drush.inc)."

It can't load an sql version class.

$sqlVersion = drush_sql_get_version();
    return $sqlVersion->getAll();

Note: I'm attempting this in lando with two databases so I can't confirm it's a general error.

And following the trail:

function drush_sql_get_version() {
  return drush_get_class('Drush\Sql\Sql', array(), array(drush_drupal_major_version())) ?: NULL;
}

So it's choking on drush_drupal_major_version(). It needs the Drupal version so it can append it to the end of the class. For example in /lib/Drush/Sql/Sql7.php there is class Sql7 extends SqlVersion.

I believe this is also related to the CiviCRM commands for SQL aren't able to find the right database. The CiviCRM drush commands have the right global $GLOBALS['databases']['default']['default'] but it can't find or use the sql class.