User login

Drush

Gotcha: drush sql-sync does not drop existing tables

When you run drush sql-sync @example.prod @example.dev you do not have exactly what is on your example production site. Tables that do not exist on production but do exist on your local development site will still exist.

You need to drop all tables in the database, or simply drop and re-create the database, first.

How to create a Feature without the initial download through the UI

If you hate downloading and unzipping the initial feature you create as much as i do, because you haven't bothered with that foolishness since Drush, this post is for you.

This is the minimal information needed (from my experimentation) for Features to recognize your module as a Features module. Then you can add variables and other features through the UI (or Drush), and drush fu feature_example to update your module code (where feature_example is the name of your feature) and fu stands for features-update.

In feature_example.info:

Get development and site-building modules and enable and configure them automatically

update: it exists, http://drupal.org/sandbox/mlncn/1204336

it should be a drush script that puts files in sites/all/modules/devel
keeps them up-to-date with git
and then enables them

http://drupal.org/project/environment

is just too much overhead.

Basically all the reasonable approaches are here:

Agaric going to Drush Aliases

It would be nice to package our Drush aliases with our projects.

Where does drush look for aliases?

It is possible to have your site-specific aliases in sites/default, such as sites/default/aliases.drushrc.php.

Somewhat Related

Drush site-upgrade and re-running upgrades over existing code

Drush's site-upgrade command asks whether to replace or re-use an existing target site.

Drupal site already exists at /home/ben/code/anjali7/web. Would you like to:
[0] : Cancel
[1] : Delete the existing site and start over.
[2] : Re-use the existing code, re-import the database from the source site
and run updatedb again.

This can be avoided by running the command with the --reuse flag.

Install Drupal 7 from the command line... with Drush, of course

Given a Drupal installation (that is, drush dl drupal), Drush can fully install Drupal, even creating the database if it has permission.

drush site-install standard --account-name=admin --account-pass=[useruser_pass] --db-url=mysql://[db_user]:[db_pass]@localhost/[db_name]

Or, shorter:
drush si --db-url=mysql://[db_user]:[db_pass]@localhost/[db_name]

(The profile defaults to standard, and the account name and account pass to 'admin'.)

The site name flag is --site-name=yada

Drush commands to enable Devel module and Page Render Array display

drush -y en devel
drush vset devel_page_alter 1

To enable the broader set of modules, it would be great to have these wrapped in a couple drush commands.

Enable

drush -y en enabled_modules views_ui xray

Use Drush to sync files from one site to another

Believe it or not, this is the function you want:

core-rsync (rsync) Rsync the Drupal tree to/from another server using ssh.

For example:

drush rsync @example.stage:%files @example.local:%files

Can't do remote to remote though.

Use Drush to sync the database from one site to another

Based on Greg Anderson's chapter in the Definitive Guide to Drupal 7.

drush sql-sync @dgd7.prod @dgd7.local

Prerequisites

A dgd7.aliases.drushrc.php file in a ~/.drush directory (that's a .drush folder in your home directory) that contains something like:

Update disabled

Until drush upc is fixed for disabled modules, this is the fastest way to fully upgrade

rm -rf logintoboggan; drush dl logintoboggan
git add -u logintoboggan

Syndicate content