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

Added support for dropping the CiviCRM database with drush. #407

Open
wants to merge 1 commit into
base: 7.x-master
Choose a base branch
from

Conversation

mollux
Copy link
Contributor

@mollux mollux commented Oct 31, 2016

No description provided.

@eileenmcnaughton
Copy link
Contributor

@bgm @jmcclelland have any thoughts about this? Does the fact that it would also drop CMS tables if in the same DB cause major concerns? Or do we expect drush users to user with care

@jmcclelland
Copy link
Contributor

I think I don't understand the purpose of the command. Why would we need civicrm-sql-drop if drush already offers sql-drop which does the same thing? I'm probably missing something.

On the other hand, if civicrm-sql-drop only dropped tables prefixed with civicrm_ it would be quiet useful to me (since powerbase keeps all drupal and civicrm tables in the same database).

@mlutfy
Copy link
Member

mlutfy commented May 8, 2017

I understand that this mimics other drush commands, such as civicrm-sql-cli, which will automatically connect to the CiviCRM database (if separated from the Drupal database). The sql-drop command won't work as-is currently, if your CiviCRM db is separate.

However, I agree with Eileen that it could easily be misinterpreted as "drop all civicrm tables only".

Instead of drush_sql_drop(); I would recommend something (via CRM_Core_DAO) that would do the equivalent of:

echo 'show tables' | drush sqlc | grep civicrm | grep -v Tables | gawk -v NOFOREIGNCHECK='SET FOREIGN_KEY_CHECKS=0;' 'BEGIN {print NOFOREIGNCHECK}{print "drop table " $1 ";"}' | drush sqlc

and also drop view.. which would have the added benefit of working for people who have the drupal/civicrm tables in the same database, as Jamie mentions.

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

Successfully merging this pull request may close these issues.

5 participants