New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql-sync (and other operations) won't work after sql-drop #161
Comments
I've similar issue. I'm trying to sync the database between two remotes as below:
But it's showing the following error (destination database exists and it's empty):
I've seen separate option to create a new database:
But it seems it's happening by default (when this option is not specified), even if the user doesn't have access to drop the existing database. This is what it's executed on the remote:
Which points me to createdb_sql() in lib/Drush/Sql/Sqlmysql.php. Is this is a correct behavior? |
Please confirm the version of Drush on both sides. Two remote sites for sql-sync is only supported by master branch. Please show the alias definitions and drushrc for both sides. I'm curious if create-db option is specified somewhere. If not, I'd like to know how we that code is being called. Consider adding a backtrace so that this can be determined. Thanks for your help. This is relatively new code so is good to shake out any bugs. |
Local drush: 7.0-dev (where command is executed) I've tried to print backtrace in createdb_sql(), but it's not get called. Maybe it's different function, or the code is executed on remote drush? |
I would be happy if this feature worked with Drush7 on all sides. I think we need to prove that, and then work on latest 6.x on both sides. You have an older version of 6.x and there is no way thats going to work. |
I've upgraded drush on remote to 7.0-dev, 'Access denied' disappeared and it went further. It log-in to the remote 3 times and on the 3rd one in stopped on rsync:
Other notice:
So it seems it's not possible to sql-sync the database between two remotes which are on the same remote. I'll double check this again tomorrow. |
My remote doesn't have defined information about the aliases. However
Probably I'm using these in my aliases somewhere. Also I'm a bit confused, because as far as I remember in drush 6.x you could sql-sync the database between two remotes. I think I'm still confused, so I've documented what's happening in here: How to sql-sync database between two remotes which share the same host?, so maybe it would be more clear what's going on. |
Those options used to be valid for sql-sync but are not valid anymore for Drush7. In Drush6, either source or destination must be local.
rsync can happen on source or on destination. We try to do it on the machine that originates the sql-sync regardless of whether it is source or destination. If both are remote, we arbitrarily do rsync on destination.
|
When starting a "drush sql-sync @Local @Remote" I first want to remove all tables at remote-db to get a clean cloned database avoiding a merge of both databases on remote target stage.
After making a "drush @Remote sql-drop" a "drush sql-sync @Local @Remote" won't work as drush fires sql-error-messages and aborts operation.
In the drush training-session @ DC-Prague I talked to Moshe and Greg about this. They confirmed this behaviour and Moshe found out, that some variables (site-path?) are losing their content while running script (in the bootstrap-process?) and sql-sync cannot find remote settings.php to get access-data for db after this.
This behavior appears only by syncing database to a remote target. When syncing a remote db against a local db it is no problem starting with "drush @Local sql-drop" before syncing.
I found one similar Issue "sql-connect does not work if used after sql-drop" at Github , which may be caused by same reason.
There is also an issue "add a --delete-all-tables-first option for sql-sync ?" at d.o., which deals with an additional parameter to gain the option to drop tables on target-db.
The text was updated successfully, but these errors were encountered: