I am doing some D8 to D9 migrations and having a problem with a multisite. I upgraded my local version to drush 10 as well as on my dev server and included the drush/sites/us2.site.yml file.

I can sql-sync the default db no problem, but when I try and specify a --uri it still targets my default database.

drush sql-sync @us2.dev @self says it will replace us2_local with us2dev which is correct.

drush sql-sync @us2.dev @self --uri="reports" says it will replace us2_reports_local with us2dev. That is incorrect. The source DB should be a different database in this case. It did get the target database correct as my local db is us2_reports_local.

if I do drush @us2.dev status database points to us2dev

if I do drush @us2.dev status --uri="reports" it shows the correct us2 reports db so status seems to work, but not sql-sync

Any ideas? I feel like I am missing something obvious. I am still on the latest version of drupal 8 until I get the modules up to date.

  • --uri passes a URL (eg. http://example.com/) that is used as the URL accessing Drupal. 'reports' doesn't look valid. What is it you're t trying to do with --uri?
    – Jaypan
    Oct 19 '21 at 23:18
  • reports is a site defined in the sites.php file used in multisite. For example, in sites.php $sites['reports.us2.local'] = 'reports';. If I pass that URL instead of the site name, it still does not work @Jaypan
    – Ronnie
    Oct 19 '21 at 23:22
  • 1
    I don't believe that's what --uri does. It sounds like you need to set up a drush alias, and set the URI there. Then you can call drush with the alias.
    – Jaypan
    Oct 20 '21 at 1:28
  • That was indeed the problem @Jaypan. I still have to specify --uri in order for sql-sync to select the correct local DB which I find odd. I may not have the new reports.site.yml entirely correct
    – Ronnie
    Oct 20 '21 at 16:30
  • for example: drush sql-sync @reports.dev @self results in replace us2_local with us2dev-reports drush sql-sync @reports.dev @self --uri=reports results in the correct local db: replace us2_reports_local with us2dev-reports
    – Ronnie
    Oct 20 '21 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.