Backup, Empty and Import databases with Drush in Drupal.


Create a backup.

drush sql-dump > /path/to/folder/backup.sql

Empty the database tables.

drush sql-drop

Import the tables.

drush sql-cli < /path/to/folder/backup.sql

How to create Features and add components with Drush in Drupal


Creation

drush fe --d --destination="sites/all/modules/custom"  my_feature views:my_view

We can find this information in the .info file

name = my_feature
core = 7.x
package = Features
dependencies[] = views
features[ctools][] = views:views_default:3.0
features[features_api][] = api:2
features[views_view][] = my_view

Enable your Feature

drush cc all
drush en my_feature

Adding Components

To see that components are available to add into your feature we’ll run Feature Compile

drush fc
If we get something like this:
Available sources
image:adaptive
image:thumbnail
image:medium
image:large

I could add into the .info file the following syntax.

features[image][] = thumbnail

Update the Feature

via Drush usingdrush fu, short for drush features-update.

drush --d fu my_feature

Disable Drupal cache with Drush


drush vset cache 0
drush vset preprocess_css 0
drush vset preprocess_js 0

 

Disable advagg and memcache if you have it enabled

drush dis -y advagg
drush dis -y memcache

Finally we clear all the cache.

 drush cc all