drush
drush copied to clipboard
Drush 10.6, cannot override using --uri from during sql-sync
Describe the bug
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 (us2dev).
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 gbio_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 gbio_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 remote us2 reports DB, so status seems to work, but not sql-sync
Any ideas? I feel like I am missing something obvious.
Here is an image of my sql-sync with the -vvv flag. It seems that first [INFO] line is using the wrong --URI.
To Reproduce I tried to sql-sync using the --uri and -l flag.
Expected behavior I expect the correct database to be pulled down
Actual behavior Specifying --uri or -l does not select the correct database when using sql-sync. drush status with the --uri flag seems to work.
Workaround Is there another way to do the desired action?
System Configuration
Q | A |
---|---|
Drush version? | 10.6 |
Drupal version? | 8.9.14 |
PHP version | 7.4 |
OS? | Mac |
so further investigations are telling me that --uri does not do what I think its supposed to do. I had to create a new yml file: reports.site.yml. I basically copied my dev section from us2.site.yml and put it in a new reports.site.yml and changed the URI and it indeed selected the correct remote DB, but I still had to specify the --uri in order for it to choose the correct local DB
drush sql-sync @reports.dev @self results in replace us2_local with us2dev-reports which is wrong local but correct remote.
drush sql-sync @reports.dev @self --uri=reports results in the correct local db and remote: replace us2_reports_local with us2dev-reports
I think maybe because I am specifying @self ? How do I specify a local multisite?
And another question since I seem to have sort of figured this out...why does --uri not work like this? I feel like that is easier than having to create a whole new yml file. drush @us2.dev status and drush @us2.dev status --uri=reports seem to work regarding multisite