Skip to content
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 should validate aliases #3103

Closed
danepowell opened this issue Oct 25, 2017 · 6 comments
Closed

sql-sync should validate aliases #3103

danepowell opened this issue Oct 25, 2017 · 6 comments

Comments

@danepowell
Copy link
Contributor

danepowell commented Oct 25, 2017

If you run sql-sync with an invalid alias (i.e. drush sql-sync @foo.remote @foo.local, where @foo.remote isn't a valid alias), you get an obscure error:

PHP Fatal error: Uncaught TypeError: Argument 1 passed to Drush\Commands\sql\SqlSyncCommands::databaseName() must be an instance of Drush\SiteAlias\AliasRecord, boolean given,

This looks like a bug, but in fact is just Drush's way of telling you that you are using an invalid alias.

Ideally sql-sync would validate the provided aliases and provide a more helpful error message, such as if you provide an invalid alias to drush si:

The alias @foo.remote could not be found.

@weitzman
Copy link
Member

We do validate aliases -

if (!$sourceRecord = $manager->get($source)) {
. not sure whats going on here.

@greg-1-anderson
Copy link
Member

My results:

$ drush9 -s sql-sync @foo.bar @baz.boz
 [error]  Error: no alias record could be found for source @foo.bar 

Are you sure you're using the most up-to-date version of Drush 9?

@danepowell
Copy link
Contributor Author

We're on beta7 (latest stable), it looks like that validation was only added in the last couple weeks, so it'll be in beta8

@greg-1-anderson
Copy link
Member

beta8 has been released now 🎉

@greg-1-anderson
Copy link
Member

Reopen if there is a problem.

@danepowell
Copy link
Contributor Author

Thanks I will try beta8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants